6.6. Multiple Directories

So far, we have dealt only with single-directory projects. Automake can also handle projects with many directories. The variable 'SUBDIRS' is used to list the subdirectories that should be built. Here is an example from Automake itself:

SUBDIRS = . m4 tests

Automake does not need to know the list of subdirectories statically, so there is no 'EXTRA_SUBDIRS' variable. You might think that Automake would use 'SUBDIRS' to see which 'Makefile.am's to scan, but it actually gets this information from 'configure.in'. This means that if you have a subdirectory optionally built, you should still list it unconditionally in your call to AC_OUTPUT, and then arrange for it to be substituted (or not, as appropriate) at configure

Get GNU Autoconf, Automake, and Libtool now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.