help-make
[Top][All Lists]
Advanced

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

Breaking from a for loop?


From: David Aldrich
Subject: Breaking from a for loop?
Date: Mon, 23 Nov 2009 16:43:30 +0000

Hi

Our top level makefile builds a number of dynamic libraries, each of which has 
its own makefile. Here are parts of the makefile (simplified):

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) : makedynamiclibs

.PHONY : makedynamiclibs
makedynamiclibs :
        @for d in $(DYNAMIC_LIBS); do $(MAKE) --quiet --directory=$$d 
$(MAKECMDGOALS); done

This works fine but, when a library makefile exits with a failure code, the for 
loop continues with the next makefile. This means that this top level makefile 
can exit with status 0 even if a lower level makefile exits with status 1 or 2.

How can I cause the for loop to break, and this makefile to exit with a failure 
status, if a lower level makefile fails, please?

Best regards

David




reply via email to

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