Back: User-Provided Input Files
Forward: Maintaining Input Files
FastBack: Maintaining Input Files
Up: A Minimal GNU Autotools Project
FastForward: Writing
Top: Autoconf, Automake, and Libtool
Contents: Table of Contents
Index: Index
About: About this document

5.2 Generated Output Files

By studying the diagram in C. 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 `' 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 C. 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 `' and `aclocal.m4'. On to automake:

$ automake --add-missing
automake: installing ./install-sh
automake: installing ./mkinstalldirs
automake: installing ./missing
automake: installing ./INSTALL
automake: required file ./NEWS not found
automake: required file ./README not found
automake: installing ./COPYING
automake: required file ./AUTHORS not found
automake: 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 5.5 Documentation and ChangeLogs).

For now, we'll do enough to placate Automake:

$ automake --add-missing

Automake has now produced a `'. 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  README      configure     missing
ChangeLog  aclocal.m4

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 `' makes it easy to generate distributions (see section 13. Rolling Distribution Tarballs). A user would merely have to unpack the tar file, run configure (see section 3. 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 parser.c
if test -f; then \
  if cmp -s parser.h; then rm -f; \
  else mv 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

This document was generated by Gary V. Vaughan on February, 8 2006 using texi2html