bugmake - Bugs: bug #1370, parallel make runs multiple-target...

 
 

bug #1370: parallel make runs multiple-target rules multiple times

Submitted by:  None
Submitted on:  Tue 08 Oct 2002 04:23:03 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: Not A BugPrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.79.1Operating System: None
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 08 Oct 2002 04:32:03 PM UTC, comment #1:

This is not a bug. The syntax you are using:

t1 t2:
sleep 2 ; touch t1 t2

does not mean, as you appear to think, that one invocation of this rule builds both targets. Rather, it means that that same rule can be invoked each time make wants to build any of those targets; in other words, the above syntax is, to make, identical to this:

t1:
sleep 2 ; touch t1 t2
t2:
sleep 2 ; touch t1 t2

So, make's behavior is correct: it's invoking the command once for each target.

If you want to tell GNU make that one invocation of a rule builds more than one target file, the only way to do that directly is using multiple patterns in the target part of pattern rules (see the GNU make manual). If you can't use pattern rules you'll have to use tricks like making the target a dummy file and having all the other targets depend on the dummy file instead.

Paul D. Smith <psmith>
Project Administrator
Tue 08 Oct 2002 04:23:03 PM UTC, original submission:

With the following Makefile (also attached):

all: t3 t4

t1 t2:
sleep 2 ; touch t1 t2

t3: t1
touch t3

t4: t2
touch t4

make -j2 will run the first target twice in parallel.
This causes problems with multiple jobs writing to the
same file in real-life makefiles.

The output of make -j2:
sleep 2 ; touch t1 t2
sleep 2 ; touch t1 t2
touch t3
touch t4

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #105:  Makefile added by None (79B - application/octet-stream - Same Makefile as in body of message.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 2 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Tue 08 Oct 2002 04:32:03 PM UTCpsmithStatusNone=>(Error - Not Found)
  Open/ClosedOpen=>(Error - Not Found)

Back to the top


Powered by Savane 3.1-cleanup1