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: Lynn Lin
Subject: Re: stop when error happen during parallel build
Date: Tue, 14 Sep 2010 09:06:21 +0800

On Mon, Sep 13, 2010 at 9:57 PM, Paul Smith <address@hidden> wrote:
> 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.

my project structure:

Makefile
subsystem1
                makefile
                module1
                            makefile
                   ...
                module20
                            makefile
subsystem2
               makefile
                         module1
                                 makefile
                   ...
                module20
                            makefile
subsystem3
               makefile
                         module1
                                 makefile
                   ...
                module20
                            makefile
subsystem4
               makefile
                         module1
                                 makefile
                   ...
                module20
                            makefile


my makefile

1 submodule makefile

target: $(OBJS) $(SUBDIRS)

compile current obj and go into sub dirs recursively to compile
obj,then link them to a static library

top makefile:
link subsystem static library to a application

demo : $(OBJS) $(STATIC_LIB)

$(STATIC_LIB):force_look
        $(MAKE) -C $(dir $@)

> 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]