help-make
[Top][All Lists]
Advanced

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

Re: About .NOTPARALLEL


From: Paul Smith
Subject: Re: About .NOTPARALLEL
Date: Sun, 17 Apr 2011 20:06:36 -0400

On Sun, 2011-04-17 at 16:44 -0500, Peng Yu wrote:
> However, I think the syntax of .NOTPARALLEL can be improved a little.
> For example, I'd like the a.txt and b.txt are not generated in
> parallel with anything other .txt files, but c.txt and d.txt be
> generated in parallel, when '-j' option is used. Currently the
> following Makefile is essentially the same as the above one. May I
> suggest to add this syntax to make?
> .PHONY: all clean
> 
> all: a.txt b.txt c.txt d.txt
> 
> .NOTPARALLEL: a.txt b.txt
> 
> %.txt:
>       sleep 2; touch $@
> 
> clean:
>       $(RM) *.txt

There are two issues here.  First, deciding on the syntax is one thing;
implementing it inside of GNU make is decidedly another thing entirely.
Currently make has a concept of parallelism, or no parallelism.  There's
no concept of "per-target parallelism".  Getting make's internal
algorithms to understand that some targets should not be built in
parallel, skipped, and come back to later when there's nothing else
running is not a trivial change.

Second, your syntax is not very clear.  Does it mean that a.txt and
b.txt should never be built in parallel with anything else at all?  So
before we build a.txt we must wait for all other running jobs to
complete and not start any new ones, then we run a.txt, then the same
for b.txt after a.txt completes?  Or does it mean that a.txt and b.txt
cannot be run in parallel with each other but they could be run at the
same time as any other targets?  Or...?

Normally the way make controls parallelism is via dependency rules: if
a.txt depends on b.txt then they will never be built in parallel.  If
there is no natural dependency you can also use "order-only" dependency
declarations to define order, without creating out-of-date definitions.

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