[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
recursive make stop on error
From: |
jason roscoe |
Subject: |
recursive make stop on error |
Date: |
Thu, 27 Apr 2006 15:27:40 -0400 |
Hi,
I sent this question earlier in the week, but it seems to have gotten lost in
the bit bucket (the mailing list archives look to be missing April 22-25).
Regardless, here is the question again.
My question is how can I 'stop' the make process in a subdirectory when an error
occurs? I understand from the manual that -k means to keep going if possible
after an error and -i means to ignore errors. Note: the Makefile below is
generated in the X-windows build environment using 'imake'.
Note: MAKEFLAGS and MFLAGS are not defined in the Makefile or the shell
environment where make is invoked.
<snip Makefile>
SUBDIRS = subdir1 subdir2
CURRENT_DIR = .
all:: subdirs
subdirs::
@for flag in ${MAKEFLAGS} ''; do \
case "$$flag" in *=*) ;; *[ik]*) set +e;; esac; done; \
for i in $(SUBDIRS) ;\
do \
echo "making" subdirs "in $(CURRENT_DIR)/$$i..."; \
(cd $$i && $(MAKE) $(MFLAGS) all); \
done
</snip>
The two makefiles in subdir1 and subdir2 are here:
subdir1/Makefile
all:
echo making subdir1 && exit 1
subdir2/Makefile
all:
echo making subdir2 && exit 2
The output I get is here:
# ls
subdir2/ subdir1/ Makefile
# make
making subdirs in ./subdir1...
make[1]: Entering directory `/tmp/tester/subdir1'
echo making subdir1 && exit 1
making subdir1
make[1]: *** [all] Error 1
make[1]: Leaving directory `/tmp/tester/subdir1'
making subdirs in ./subdir2...
make[1]: Entering directory `/tmp/tester/subdir2'
echo making subdir2 && exit 2
making subdir2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/tmp/tester/subdir2'
make: *** [subdirs] Error 2
What I want to figure out is whether or not the structure of the loop above
lends itself to stopping make, say if the make failed in subdir1. If so, what
are the appropriate modifications needed to cause this to happen?
Sorry for the long-windedness for such a seemingly simple question!
Thanks for any help or suggestions.
-Jason
- recursive make stop on error,
jason roscoe <=