[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In packages with subdirectories, the top level `Makefile.am' must
tell Automake which subdirectories are to be built. This is done via
the SUBDIRS
variable.
The SUBDIRS
variable holds a list of subdirectories in which
building of various sorts can occur. Many targets (e.g. 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.am's; only `Makefile's
(after configuration). This allows inclusion of libraries from packages
which do not use Automake (such as gettext
).
In packages that use subdirectories, the top-level `Makefile.am' is often very short. For instance, here is the `Makefile.am' from the GNU Hello distribution:
EXTRA_DIST = BUGS ChangeLog.O README-alpha SUBDIRS = doc intl po src tests |
When Automake invokes make
in a subdirectory, it uses the value
of the MAKE
variable. It passes the value of the variable
AM_MAKEFLAGS
to the make
invocation; this can be set in
`Makefile.am' if there are flags you must always pass to
make
.
The directories mentioned in SUBDIRS
must be direct children of
the current directory. For instance, you cannot put `src/subdir'
into SUBDIRS
. Instead you should put SUBDIRS = subdir
into `src/Makefile.am'. Automake can be used to construct packages
of arbitrary depth this way.
By default, Automake generates `Makefiles' which work depth-first
(`postfix'). However, it is possible to change this ordering. You
can do this by putting `.' into SUBDIRS
. For instance,
putting `.' first will cause a `prefix' ordering of
directories. All `clean' targets are run in reverse order of build
targets.