bug-make
[Top][All Lists]
Advanced

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

Doubts about .WAIT and .NOTPARALLEL (was: GNU Make 4.4 released!)


From: Alejandro Colomar
Subject: Doubts about .WAIT and .NOTPARALLEL (was: GNU Make 4.4 released!)
Date: Mon, 31 Oct 2022 11:06:52 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0

Hi Paul,

On 10/31/22 08:01, Paul Smith wrote:


* New feature: The .WAIT special target
   If the .WAIT target appears between two prerequisites of a target, then
   GNU Make will wait for all of the targets to the left of .WAIT in the list
   to complete before starting any of the targets to the right of .WAIT.
   This feature is available in some other versions of make, and it will be
   required by an upcoming version of the POSIX standard for make.
   Different patches were made by Alexey Neyman <alex.neyman@auriga.ru> (2005)
   and Steffen Nurpmeso <steffen@sdaoden.eu> (2020) that were useful but the
   result is a different implementation (closer to Alexey's idea).

I'm curious: what is .WAIT made for? Isn't it just a workaround for broken dependencies? I mean, considering the following example:

    all: one two .WAIT three
    one two three: ; @sleep 1; echo $@

It's the same as if it was written as

    all: one two three
    three: one two
    one two three: ; @sleep 1; echo $@

Isn't it?


* New feature: .NOTPARALLEL accepts prerequisites
   If the .NOTPARALLEL special target has prerequisites then all prerequisites
   of those targets will be run serially (as if .WAIT was specified between
   each prerequisite).

But my useful question comes with .NOTPARALLEL, which I think can be useful for something I asked some time ago, and can't be done with pre-4.4 make.

The documentation is a bit unclear on the exact details of this feature, by writing it in terms of .WAIT.

Let's say I have the following:

    all: a b c
    .NOTPARALLEL: b
    a: b c
    a b c: ; @sleep 1; echo $@

Is it guaranteed that b will be run either before or after c but never at the same time? Please clarify the manual regarding this. Maybe this example is good for the docs.

The usefulness of something like this is that b might run a command that asks for a password, and I want literraly _everything_ else on hold while a program is asking for a password.

Of course, all this is without recursive make, I know.

* New feature: The --shuffle command line option
   This option reorders goals and prerequisites to simulate non-determinism
   that may be seen using parallel build.  Shuffle mode allows a form of "fuzz
   testing" of parallel builds to verify that all prerequisites are correctly
   described in the makefile.
   Implementation provided by Sergei Trofimovich <siarheit@google.com>

I guess shuffle doesn't mess with .NOTPARALLEL or .WAIT.  Just to confirm.


* New feature: The --jobserver-style command line option and named pipes
   A new jobserver method is used on systems where mkfifo(3) is supported.
   This solves a number of obscure issues related to using the jobserver
   and recursive invocations of GNU Make.  This change means that sub-makes
   will connect to the jobserver even if they are not marked as recursive.
   It also means that other tools that want to participate in the jobserver
   will need to be enhanced as described in the GNU Make manual.
   You can force GNU Make to use the simple pipe-based jobserver (perhaps if
   you are integrating with other tools or older versions of GNU Make) by
   adding the '--jobserver-style=pipe' option to the command line of the
   top-level invocation of GNU Make, or via MAKEFLAGS or GNUMAKEFLAGS.
   To detect this change search for 'jobserver-fifo' in the .FEATURES variable.

Another curious question: Does this fifo jobserver allow .NOTPARALLEL even with recursive makes? I guess not, but I had to ask.

Cheers,

Alex
--
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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