[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Breaking from a for loop?
From: |
Paul Smith |
Subject: |
RE: Breaking from a for loop? |
Date: |
Tue, 24 Nov 2009 11:11:55 -0500 |
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 <address@hidden> 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
- make gives exit status of 0 even when compile fails, David Aldrich, 2009/11/23
- Re: make gives exit status of 0 even when compile fails, Paul Smith, 2009/11/23
- RE: make gives exit status of 0 even when compile fails, David Aldrich, 2009/11/23
- Breaking from a for loop?, David Aldrich, 2009/11/23
- Re: Breaking from a for loop?, Philip Guenther, 2009/11/23
- RE: Breaking from a for loop?, David Aldrich, 2009/11/24
- RE: Breaking from a for loop?, Paul Smith, 2009/11/24
- RE: Breaking from a for loop?, David Aldrich, 2009/11/24
- RE: Breaking from a for loop?, Paul Smith, 2009/11/24
- RE: Breaking from a for loop?, David Aldrich, 2009/11/24
- RE: Breaking from a for loop?,
Paul Smith <=
- RE: Breaking from a for loop?, David Aldrich, 2009/11/24