autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] more details of how to propagate variables to submakes


From: Ben Pfaff
Subject: [PATCH] more details of how to propagate variables to submakes
Date: Mon, 14 Jun 2010 21:10:48 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

On bug-gnulib, archived at
        http://permalink.gmane.org/gmane.comp.lib.gnulib.bugs/22132
Ralf Wildenhues taught me a bit about how Automake propagates
variables to submakes.  I thought that it would good to document
this in the Autoconf manual, which currently has no detail at
all.

I've signed copyright papers for Autoconf, which are in
/gd/gnuorg/copyright.list under my full name "Benjamin Pfaff",
but I don't have commit rights, so someone will have to shepherd
this in for me (or decide that it is not worthwhile).

2010-06-14  Ben Pfaff  <address@hidden>

        * doc/autoconf.texi: Describe technique used by Automake to
        propagate variables to submakes in more detail.

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 42469db..2012fbb 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -18720,8 +18720,8 @@ environment contains some other macros usually defined 
by the
 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
@@ -18732,12 +18732,25 @@ two:
         @@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}).
address@hidden
+foo = foo
+one:
+        @@echo $(foo)
+        $(MAKE) $(SUBMAKEFLAGS) two
+two:
+        @@echo $(foo)
address@hidden 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
address@hidden 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

-- 
Ben Pfaff 
http://benpfaff.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]