Previous: Format of configure.ac, Up: Input files [Contents][Index]
For simple projects that distribute all files in the same directory it is enough to have a single Makefile.am that builds everything in place.
In larger projects, it is common to organize files in different directories, in a tree. For example, there could be a directory for the program’s source, one for the testsuite, and one for the documentation; or, for very large projects, there could be one directory per program, per library or per module.
One approach is to build these subdirectories recursively,
employing make recursion: each directory contains its
own Makefile.am. The top-level directory has its own
Makefile.am as well as a configure.ac that is used for all
subdirectories.
When make
is run from the top-level
directory, it enters each subdirectory in turn, and invokes there a
new make
instance to build the directory’s contents.
However, it is worth nothing that the use of make recursion has issues and drawbacks, and that it’s certainly possible to have packages with a multi-directory layout that make little or no use of such recursion (examples of such packages are GNU Bison and GNU Automake itself); see the Alternative section below.
• Subdirectories | Building subdirectories recursively | |
• Conditional Subdirectories | Conditionally not building directories | |
• Alternative | Subdirectories without recursion | |
• Third-Party Makefiles | ||
• Subpackages | Nesting packages |