Tue Jan 12 08:38:55 CET 2010

Recursive make Considered Harmful

The general idea: don't (artificially) break up the dependency graph
in separate components.  If there are _any_ dependencies between
different components of a project, a Makefile best describes these in
a central way.

What I've learned: some key tricks are based on the fact that make is
_string based_, and that := and = have different meaning: the first is
strict expansion - it is evaluated immediately, and the second is
deferred expansion - it saves the string literally, expanding only
when triggered trough strict expansion or evaluation of a rule.

From [2]:

  Basically, what's needed to tackle these issues is a variable that
  tracks the 'current directory' while the source tree is traversed
  and makefile fragments are included. This variable can then be used
  in describing dependency relations in a relative fashion, and in the
  include path for the compiler in build recipes.

As far as I understand: using strict assignment (:=) you create some
mutables state during inclusion of rule files.  Any rules that use
these variables get immediately expanded to strings and stored to
build the dependency graph.

[1] http://miller.emu.id.au/pmiller/books/rmch/
[2] http://www.xs4all.nl/~evbergen/nonrecursive-make.html
[3] http://aegis.sourceforge.net/auug97.pdf