Go to the first, previous, next, last section, table of contents.

Recursion

In leaf `Makefiles' the variable `SUBDIRS' is undefined. In non-leaf `Makefiles', `SUBDIRS' is set to the list of sub-directories that contain subordinate `Makefile's. It is up to you to set `SUBDIRS' in the `Makefile'. There is no automation here -- `SUBDIRS' is too important automate.

When `SUBDIRS' is defined, `target.mk' includes a rather neat rule for the standard targets (Section See section Standard targets) that simply invokes `make' recursively in each of the sub-directories.

These recursive invocations are guaranteed to occur in the order in which the list of directories is specified in `SUBDIRS'. This guarantee can be important. For example, when you say `gmake boot' it can be important that the recursive invocation of `make boot' is done in one sub-directory (the include files, say) before another (the source files). Generally, put the most independent sub-directory first, and the most dependent last.


Go to the first, previous, next, last section, table of contents.