Learn Automake

Swe05
In these exercises you learn to use the Makefile abstractions provided by automake applied to the interpreter package. Make a new version of the package to do these exercises with (i.e., make a tag for the trunk after finishing LearnAutoconf.)

Online documentation for automake is available in the info pages (command info automake).

A simple example of the use of automake is provided in the following package:

Unpack and build it using the following commands:

  gtar zxf hello-4.0.tar.gz
  cd hello-4.0
  ./reconf
  ./configure --prefix=/tmp/hello-4.0
  make
  make install
  make dist
  make rpm

Study the files in the package to see how automake is used.

Note that the Makefile.in is generated from Makefile.am and that routine targets for deployment (install, dist, ...) are now generated by automake from declarations. Have a look at Makefile.in to get an impression of the complexity of a complete Makefile.in. The reconf script calls the relevant autotools. The hello.spec file for RPM uses variables to refer to the installation target directories to make it more generic.

Exercises

Now change the interpreter package to make use of automake.

  1. Extend configure.in to use automake (AM_INIT_AUTOMAKE).
  2. Promote the Makefile.in from the previous exercise to a Makefile.am. Make use of automake macro definitions such as for bin_PROGRAMS to abbreviate the Makefile.
  3. Remove the dist, install, uninstall, and clean targets and make sure that they are generated by automake.

  4. (Optional.) Turn the package into a hierarchical directory structure with src/, doc/, and config/ subdirectories. Distribute the code over the subdirectories as appropriate. Extend the configure.in and Makefile.am to support the new structure.