[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Gnu Make
From: |
Fergus Henderson |
Subject: |
Re: Gnu Make |
Date: |
Wed, 3 Jan 2001 02:44:30 +1100 |
On 02-Jan-2001, Eric Herring <address@hidden> wrote:
> I have a problem with calling makefiles within a
> makefile. The toplevel makefile is calling these
> makefile using a for loop. The problem is whenever a
> low level makefile has an error and reports an error,
> the top level make continues with the next make in the
> loop. I need the top level makefile to stop inside the
> for loop when a low level make has an error.
Simple solution:
SUBDIRS = a b c d
subdirs:
for $$dir in $(SUBDIRS); do \
cd $$dir && $(MAKE) || exit 1; \
done
Note the "|| exit 1", which terminates the loop.
Now, the problem with the simple solution is that it stops
too early in the case of `make -k'.
So another solution is as follows:
SUBDIRS = a b c d
subdirs: $(SUBDIRS:%=%.subdir)
%.subdir:
cd $* && $(MAKE)
--
Fergus Henderson <address@hidden> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.