Next: , Previous: , Up: GNU Automake   [Contents][Index]


6 The top-level Makefile.am

In non-flat packages, the top level Makefile.am must tell Automake which subdirectories are to be built. This is done via the SUBDIRS variable.

The SUBDIRS macro holds a list of subdirectories in which building of various sorts can occur. Many targets (eg all) in the generated Makefile will run both locally and in all specified subdirectories. Note that the directories listed in SUBDIRS are not required to contain Makefile.ams; only Makefiles (after configuration). This allows inclusion of libraries from packages which do not use Automake (such as gettext). The directories mentioned in SUBDIRS must be direct children of the current directory. For instance, you cannot put ‘src/subdir’ into SUBDIRS.

In a deep package, the top-level Makefile.am is often very short. For instance, here is the Makefile.am from the Hello distribution:

EXTRA_DIST = BUGS ChangeLog.O README-alpha
SUBDIRS = doc intl po src tests

SUBDIRS can contain configure substitutions (eg ‘@DIRS@’); Automake itself does not actually examine the contents of this variable.

If SUBDIRS is defined, then your configure.in must include AC_PROG_MAKE_SET.

The use of SUBDIRS is not restricted to just the top-level Makefile.am. Automake can be used to construct packages of arbitrary depth.