[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to stop building when sub-make returns error
From: |
Paljas |
Subject: |
Re: How to stop building when sub-make returns error |
Date: |
Tue, 12 Jan 2010 02:48:51 -0800 (PST) |
elight wrote:
>
> I have GNU make V3.81.
>
> The rules for building system is like this:
>
> all: pre_build main_build post_build
>
> pre_build:
> ...
>
> main_build:
> make -C $(BUILD_DIR) -r -f $(MAKEFILE)
>
> post_build
> ...
>
> Althouth the sub-make for the target 'main_build' makes an error, build
> process proceeds to post_build.
> I wish the build process would be stop when the sub-make has an error.
>
>
The default behavior for make is to exit once a command returns an error, so
I'm surprised that it goes wrong at your side. The following makefile:
all : one two three
one :
@echo $@
two :
$(MAKE) error
@echo $@
three :
@echo $@
error :
grep whatever idontexist
Will return:
one
make error
make[1]: Entering directory `/tmp'
grep whatever idontexist
grep: idontexist: No such file or directory
make[1]: *** [error] Error 2
make[1]: Leaving directory `/tmp'
make: *** [two] Error 2
You'll notice that three is never built. That's because grep returns an
error.
PS: Beware! GNU make does NOT guarantee that prerequisites are built in the
order you specify them! The order depends on the depth of the dependency
tree for each prerequisite. If you want to guarantee proper order, you
should force it by dependency hierarchy, e.g.:
post_build : main_build ;
main_build : pre_build ;
pre_build :
Regards,
Paljas.
--
View this message in context:
http://old.nabble.com/How-to-stop-building-when-sub-make-returns-error-tp27122668p27125750.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.
- How to stop building when sub-make returns error, elight, 2010/01/12
- Re: How to stop building when sub-make returns error,
Paljas <=
- Re: How to stop building when sub-make returns error, elight, 2010/01/12
- Re: How to stop building when sub-make returns error, Paljas, 2010/01/12
- Re: How to stop building when sub-make returns error, Harvey Chapman, 2010/01/12
- Re: How to stop building when sub-make returns error, Paul Smith, 2010/01/12
- Re: How to stop building when sub-make returns error, Philip Guenther, 2010/01/12
- Re: How to stop building when sub-make returns error, Maxim Yegorushkin, 2010/01/12
- Re: How to stop building when sub-make returns error, Paul Smith, 2010/01/12
- Re: How to stop building when sub-make returns error, Maxim Yegorushkin, 2010/01/12