[bug #57692] Parallel make doesn't work well with grouped targets

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[bug #57692] Parallel make doesn't work well with grouped targets

Bogdan Barbu
URL:
  <https://savannah.gnu.org/bugs/?57692>

                 Summary: Parallel make doesn't work well with grouped targets
                 Project: make
            Submitted by: spth
            Submitted on: Wed 29 Jan 2020 10:42:26 AM UTC
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: None
        Operating System: None
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

I use GNU make 4.2.1 (as part of Debian GNU/Linux testing); I have not checked
if other versions of GNU make are affected.

I noticed that parallel make results in the rules for grouped targets being
executed multiple times (for me it corrupted files by multiple processes
appending to the same file simultaneously). Which is unlikely to be what users
want, as it easily results in corrupted files, and is inefficient.

The following Makefile, when invoked using make -j 4 reproduces the issue (I
see the text "Sleeping" four times):

RESULTS = a b c d

.PHONY: all clean

all: $(RESULTS)

$(RESULTS) &:
        echo "Sleeping"; sleep 1;
        touch $(RESULTS)

clean:
        rm -f $(RESULTS)




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57692>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


Reply | Threaded
Open this post in threaded view
|

[bug #57692] Parallel make doesn't work well with grouped targets

Bogdan Barbu
Update of bug #57692 (project make):

                  Status:                    None => Not A Bug              
             Open/Closed:                    Open => Closed                

    _______________________________________________________

Follow-up Comment #1:

The entire point of grouped targets is to support parallel make properly: if
you only use serial make then you don't really need them.

However, grouped targets were introduced in GNU make 4.3.  If you're using an
older version, they don't exist.

In 4.2.1 and before, your makefile simply defines normal (non-grouped)
targets, plus an extra target which is named, literally, "&".

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57692>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/