[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
By studying the diagram in Generated File Dependencies, it should be possible to see which commands must be run to generate the required output files from the input files shown in the last section.
First, we generate ‘configure’:
$ aclocal $ autoconf |
Because ‘configure.in’ contains macro invocations which are not
known to autoconf itself–AM_INIT_AUTOMAKE
being a case in
point, it is necessary to collect all of the macro definitions for
autoconf to use when generating ‘configure’. This is done using
the aclocal
program, so called because it generates
‘aclocal.m4’ (see section Generated File Dependencies). If you were to
examine the contents of ‘aclocal.m4’, you would find the definition
of the AM_INIT_AUTOMAKE
macro contained within.
After running autoconf
, you will find a ‘configure’
script in the current directory. It is important to run aclocal
first because automake
relies on the contents of
‘configure.in’ and ‘aclocal.m4’. On to automake
:
$ automake --add-missing automake: configure.in: installing ./install-sh automake: configure.in: installing ./mkinstalldirs automake: configure.in: installing ./missing automake: Makefile.am: installing ./INSTALL automake: Makefile.am: required file ./NEWS not found automake: Makefile.am: required file ./README not found automake: Makefile.am: installing ./COPYING automake: Makefile.am: required file ./AUTHORS not found automake: Makefile.am: required file ./ChangeLog not found |
The ‘--add-missing’ option copies some boilerplate files from
your Automake installation into the current directory. Files such as
‘COPYING’, which contain the GNU General Public License change
infrequently, and so can be generated without user intervention. A
number of utility scripts are also installed–these are used by the
generated ‘Makefile’s, particularly by the install
target.
Notice that some required files are still missing. These are:
A record of user-visible changes to a package. The format is not strict, but the changes to the most recent version should appear at the top of the file.
The first place a user will look to get an overview for the purpose of a package, and perhaps special installation instructions.
Lists the names, and usually mail addresses, of individuals who worked on the package.
The ChangeLog is an important file–it records the changes that are made to a package. The format of this file is quite strict (see section Documentation and ChangeLogs).
For now, we’ll do enough to placate Automake:
$ touch NEWS README AUTHORS ChangeLog $ automake --add-missing |
Automake has now produced a ‘Makefile.in’. At this point, you may wish to take a snapshot of this directory before we really let loose with automatically generated files.
By now, the contents of the directory will be looking fairly complete and reminiscent of the top-level directory of a GNU package you may have installed in the past:
AUTHORS INSTALL NEWS install-sh mkinstalldirs COPYING Makefile.am README configure missing ChangeLog Makefile.in aclocal.m4 configure.in |
It should now be possible to package up your tree in a tar
file
and give it to other users for them to install on their own systems.
One of the make
targets that Automake generates in
‘Makefile.in’ makes it easy to generate distributions
(see section Rolling Distribution Tarballs). A user would merely have to
unpack the tar
file, run configure
(see section How to run configure and make) and finally type make all
:
$ ./configure creating cache ./config.cache checking for a BSD compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking whether make sets ${MAKE}... yes checking for working aclocal... found checking for working autoconf... found checking for working automake... found checking for working autoheader... found checking for working makeinfo... found checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking how to run the C preprocessor... gcc -E checking for flex... flex checking for flex... (cached) flex checking for yywrap in -lfl... yes checking lex output file root... lex.yy checking whether yytext is a pointer... yes checking for bison... bison -y updating cache ./config.cache creating ./config.status creating Makefile $ make all gcc -DPACKAGE=\"foonly\" -DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. \ -g -O2 -c main.c gcc -DPACKAGE=\"foonly\" -DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. \ -g -O2 -c foo.c flex scanner.l && mv lex.yy.c scanner.c gcc -DPACKAGE=\"foonly\" -DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. \ -g -O2 -c scanner.c bison -y parser.y && mv y.tab.c parser.c if test -f y.tab.h; then \ if cmp -s y.tab.h parser.h; then rm -f y.tab.h; \ else mv y.tab.h parser.h; fi; \ else :; fi gcc -DPACKAGE=\"foonly\" -DVERSION=\"1.0\" -DYYTEXT_POINTER=1 -I. -I. \ -g -O2 -c parser.c gcc -g -O2 -o foonly main.o foo.o scanner.o parser.o -lfl |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by Ben Elliston on July 10, 2015 using texi2html 1.82.