[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: capturing make's exit status
From: |
Paul D. Smith |
Subject: |
Re: capturing make's exit status |
Date: |
Tue, 28 Jan 2003 09:22:15 -0500 |
%% Nolan Ring <address@hidden> writes:
nr> OS is Solaris 5.9
nr> make is 3.8.0
nr> Is there some way for me to capture the exit status from make at the
nr> time that it fails? Or set a flag?
nr> My Makefile is pretty basic:
nr> all: versionfile $(BUILDDIRS)
nr> @(for i in $(MAKEDIRS); do cd $$i; echo "Making in $$i" ;make -f
Makefile.sun; cd ..; done)
This is a bad way to invoke submakes.
Do it this way instead:
all: versionfile $(BUILDDIRS)
.PHONY: $(BUILDDIRS)
$(BUILDDIRS):
@cd $@ && $(MAKE) -f Makefile.sun
Comments:
* NEVER use "make" to invoke submakes. ALWAYS use $(MAKE).
* You really don't need the echo because make will already print a
comment when it invokes itself in a subdirectory.
* If you are using GNU make anyway you can use the -C option to gain a
little efficiency:
$(BUILDDIRS):
@$(MAKE) -C $@ -f Makefile.sun
* In your example you have a prerequisite of $(BUILDDIRS) but then you
loop on $(MAKEDIRS); I assumed that was a typo in my example above.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist