(make.info)Recursion


Next: Sequences Prev: Interrupts Up: Commands

Recursive Use of `make'
=======================

   Recursive use of `make' means using `make' as a command in a
makefile.  This technique is useful when you want separate makefiles for
various subsystems that compose a larger system.  For example, suppose
you have a subdirectory `subdir' which has its own makefile, and you
would like the containing directory's makefile to run `make' on the
subdirectory.  You can do it by writing this:

     subsystem:
             cd subdir; $(MAKE)

or, equivalently, this (Note: Summary of Options.):

     subsystem:
             $(MAKE) -C subdir

   You can write recursive `make' commands just by copying this example,
but there are many things to know about how they work and why, and about
how the sub-`make' relates to the top-level `make'.

* MAKE Variable
The special effects of using `$(MAKE)'.
* Variables/Recursion
How to communicate variables to a sub-`make'.
* Options/Recursion
How to communicate options to a sub-`make'.
* -w Option
How the `-w' or `--print-directory' option helps debug use of recursive `make' commands.

automatically generated by info2www