[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-make] foreach, recursion, and exit codes
From: |
Sankaranarayanan K V |
Subject: |
[Help-make] foreach, recursion, and exit codes |
Date: |
Tue, 19 Sep 2000 18:01:01 +0530 |
User-agent: |
Mutt/1.2i |
Hi,
I am using GNU make 3.79 on a Solaris 2.5.1.
Consider the following Makefile fragment:
SUBDIRS = ok-dir-1 bad-dir ok-dir-2
all.simple:
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) all;)
The all targets in ok-dir-1 and ok-dir-2 return an exit status of 0.
The bad-dir all target exits with an error.
However, the top level all target returns success.
I would like to prevent it.
If any of the directories return false, I would like the top level make
to return false.
Is the following a good idea?
all:
status=0;\
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) all;\
state=$$?;\
if test $$state -ne 0; then status=$$state; fi;)\
exit $$status
Are there other ways?
Regards
Sankar
--
Sankaranarayanan K. V. | address@hidden
Motorola India Electronics Ltd | http://www.mot.com/miel
- [Help-make] foreach, recursion, and exit codes,
Sankaranarayanan K V <=