+2010-06-22 Ben Pfaff <blp@cs.stanford.edu>
+
+ Document how to propogate variables to submakes.
+ * doc/autoconf.texi: Describe technique used by Automake to
+ propagate variables to submakes in more detail.
+
2010-06-22 Peter Johansson <trojkan@gmail.com> (tiny change)
Be consistent in doc example.
makefile. (See also the note about @code{make -e} and @code{SHELL}
below.)
-Another way to propagate overrides to submakes is to do it
-manually, from your makefile:
+If you can foresee all macros that a user might want to override, then
+you can propagate them to submakes manually, from your makefile:
@example
foo = foo
@@echo $(foo)
@end example
-You need to foresee all macros that a user might want to override if
-you do that.
+Another way to propagate a variable to submakes in a portable way is to
+expand an extra variable in every invocation of @samp{$(MAKE)} within
+your makefile:
-Makefiles generated by @command{automake} expand @code{$(AM_MAKEFLAGS)}
-on the command line of submakes, which can be used for propagated overrides
-(@pxref{Subdirectories, , Automake, automake, GNU Automake}).
+@example
+foo = foo
+one:
+ @@echo $(foo)
+ $(MAKE) $(SUBMAKEFLAGS) two
+two:
+ @@echo $(foo)
+@end example
+
+Users must be aware that this technique is in use to take advantage of
+it, e.g.@: with @code{make foo=bar SUBMAKEFLAGS='foo=bar'}, but it
+allows any macro to be overridden. Makefiles generated by
+@command{automake} use this technique, expanding @code{$(AM_MAKEFLAGS)}
+on the command lines of submakes (@pxref{Subdirectories, , Automake,
+automake, GNU Automake}).
@node The Make Macro MAKEFLAGS
@section The Make Macro MAKEFLAGS