help-make
[Top][All Lists]
Advanced

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

Re: Improvement on parallel make


From: Paul Smith
Subject: Re: Improvement on parallel make
Date: Tue, 12 Dec 2006 09:44:20 -0500

On Tue, 2006-12-12 at 14:03 +0000, Brendan Heading wrote:

> > Sure, it's not difficult to replace
> > all: all-subdir all-local
> > by
> > all:
> >    $(MAKE) all-subdir
> >    $(MAKE) all-local 

> BTW your example won't build those two targets in parallel, even if parallel 
> compilation is possible.

Right; that's the entire point: he's trying to AVOID having those
targets built in parallel.  He wants all the subdirs built before any of
the local files.

> I'd consider the way you've done this to be bad practice. Instead I'd
> have 
> 
> all: all-subdir all-local 
> 
> .PHONY all-subdir all-local 
> 
> all-subdir:
>    $(MAKE) <whatever> 
> 
> all-local:
>    $(MAKE) <whatever2> 
> 
> If I wanted to make it clear that these had to be serialized, I'd just add 
> 
> all-local: all-subdir 
> 
> I find that prettier than the .WAIT syntax.

Yes, but as we've been pointing out this is not sufficient.  If you read
the threads from last spring mentioned previously they go into this.
Remember that these are not just single targets: all-subdir and
all-local have prerequisites as well:

        all-local: foo.o bar.o baz biz boz

etc.  In that case your simple declaration:

        all-local: all-subdir

is NOT ENOUGH.  It just says the all-local target itself has to wait for
all-subdir, but it does NOT say anything about all-local's
prerequisites.  So that means that foo.o, bar.o, etc. can still be built
in parallel to all-subdirs, which is clearly wrong.  The only way to fix
this is to have ALL prerequisites of all-local (and all their
prerequisites, and all their prerequisites, etc.) also depend on
all-subdirs.  Bleah.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]