swt.cs.tu-berlin.de

Download Report

Transcript swt.cs.tu-berlin.de

Das GNU Build System
Autotools
Roman Leshchinsky
David Schulz, Shaoke Wu
History of autotools
1980s
Multible variants of Unix
Varios differences (even with POSIX)
Familiarity for software developers with all
differences
-> more organized approach needed
Goal: Easy distribution of source
code programs
Source
Code
System V
BSD
Linux
AIX
Solaris
HP-UX
History (2)
1992
Metaconfig, configure, GNU autoconf, Imake
Building process in two steps
Configuration - generates Makefile's
build step – using UNIX make
1994
Autoconf solid framework
But creation of large Makefile.in's nesseccary
Autoconf Konzept
Automatische Konfiguration von Programmen
Probleme
Computer
Test
configure
Konfigurat
ion
Was macht autoconf
configure.in
autoconf
aclocla.m4
configure
Autoconf erzeugt configure
Input: configure.ac (oder configure.in bei aelteren Versionen )
configure.ac enthaelt Aufruf von Makros
Autoconf benutzt m4
aclocal.m4 definiert eigene Makros
Aufbau von configure.ac
AC_INIT(helloworld.c)
...
AC_OUTPUT(Makefile)
Reihenfolge egal
AC_INIT
Source-Katalog finden
Kommando Zeilenargumente
AC_OUTPUT
Dateien generieren
Welche Tests gibt es?
Programs
Files
Library Files
Types
System Services
./configure Optionen
--prefix=<install-path>
--help: alle Optionen auflisten
--version: autoconf Version anzeigen
Shell Umgebungsvariable:
LDFLAGS: linker flags, e.g. -L<lib dir>
CFLAGS
C compiler flags
Automake
Makefile.am
automake
(configure.in)
Makefile.in
Goal: create Makefile.in
Remove burden of Makefile maintenance from
individual Developer (put it on automake
maintainer)
Input: Makefile.am
Only make sence with autoconf
Reads configure.in contents
Needs perl
Makefile.am
SUBDIRS = src
bin_PROGRAMS = hello
hello_SOURCES = hello.c hello.h
Easy to create by developer
Syntax: prefix+primary
Primarys: PROGRAMS, LIBRARIES, SCRIPTS
Arbitrary code
## Automake comment
Automake options
--add-missing: create some files
automaticly
--copy: dont create links
--foreign: lower strictness level
--help: show options
--verbose: show files being read
--version: show automake version
Makefile.in
Created by automake out of Makefile.am
Makefile conforms with make syntax
Tags to be substituted by configure script
Overview
Create configure.ac and Makefile.am
aclocal
autoconf
Automake --add-missing
./configure
make
make install