help-make
[Top][All Lists]
Advanced

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

Re: stop when error happen during parallel build


From: Paul Smith
Subject: Re: stop when error happen during parallel build
Date: Mon, 13 Sep 2010 09:57:15 -0400

On Thu, 2010-09-09 at 08:44 -0400, Todd Showalter wrote:
> On Thu, Sep 9, 2010 at 4:48 AM, Lynn Lin <address@hidden>
> wrote:
> 
> >   I run make with parallel build,if error happen,it doesn't stop(this
> > is reasonable,correct?),the error seem hidden as we have many module
> > to compile
> >   is there any good solution to resolve this? I use recursive make,is
> > this one reason ?

Make will always stop processing after the first error is reported
(unless you give extra flags etc. to tell it not to).

If you have more than one job running at the same time and one fails,
then make will allow the currently-running jobs to complete, then it
will stop, but it won't start any more jobs.

You didn't give us any details about how your makefiles work so there's
not much else concrete we can say.  However, in 9 times out of 10 when
make doesn't stop, it means that you are not reporting the error back to
make correctly.

Make examines the exit code of your recipe.  If it's 0 then that's a
success and make continues.  Any other value is a failure and make
stops.  If you somehow manage to suppress or change the exit code then
make, of course, can't see it.

For example:

        foo:
                command that fails; echo "foo"

Here, "command that fails" can fail but afterwards you invoke "echo",
which always succeeds, so as far as make is concerned, this command will
never fail.

Another common method with recursive makefiles is something like:

        all:
                for f in $(SUBDIRS); do \
                    $(MAKE) -C $$f all; \
                done

Here you don't quit your loop when the sub-make fails, so even though
one particular make stops, the rest of them keep going.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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