On Tue, 2009-11-24 at 14:44 +0000, David Aldrich wrote:
> 1) Pass the top-level command line arguments to the lower-level
> makefile
>
> 2) Not break if --keep-going was specified.
>
> I guess I can do (1) as follows:
>
> $(MAKE) $(MAKEFLAGS) --quiet --directory=$$d
> $(MAKECMDGOALS); \
>
> Am I correct?
No. Using the variable $(MAKE) in your command is enough to pass all
command line options and variable settings to sub-makes. The MAKEFLAGS
variable is intended to be used internally by make to communicate
between parent and sub-makes, and shouldn't be specified directly on the
command line. If you do, it will break.
If you really want to pass the command goals to the sub-make then you
will need to keep $(MAKECMDGOALS).
> For (2), how would I determine whether --keep-going was specified in
> MAKEFLAGS?
This is the second excellent reason why you should be using make
constructs to do this rather than shell constructs: if you use make
constructs then all handling of -k etc. works correctly (the first
reason was already mentioned by Philip: to get better support for
parallelism).
For example, something like:
DYNAMIC_LIBS = $(TRUNKDIR)/MyLibs/Lib1/lib1
DYNAMIC_LIBS += $(TRUNKDIR)/MyLibs/Lib2/lib2
DYNAMIC_LIBS += $(TRUNKDIR)/MyLibs/Lib3/lib3
DYNAMIC_LIBS += $(TRUNKDIR)/MyLibs/Lib4/lib4
$(ARCHIVES_R) $(ARCHIVES_D) : $(DYNAMIC_LIBS)
.PHONY : $(DYNAMIC_LIBS)
$(DYNAMIC_LIBS) :
@$(MAKE) --quiet --directory=$@ $(MAKECMDGOALS)
--
-------------------------------------------------------------------------------
Paul D. Smith <[email protected]> Find some GNU make tips at:
http://www.gnu.org http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make