Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #10566

Re: make: Multiple targets created by single rule vs parallel make

Path csiph.com!weretis.net!feeder6.news.weretis.net!feeder5.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From Philipp Klaus Krause <pkk@spth.de>
Newsgroups comp.programming
Subject Re: make: Multiple targets created by single rule vs parallel make
Date Wed, 29 Jan 2020 11:02:46 +0100
Organization solani.org
Lines 44
Message-ID <r0rl86$57c$1@solani.org> (permalink)
References <r0c8ue$eui$1@solani.org> <r0cana$etb$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace solani.org 1580292166 5356 127.0.0.43 (29 Jan 2020 10:02:46 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Wed, 29 Jan 2020 10:02:46 +0000 (UTC)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0
Autocrypt addr=pkk@spth.de; keydata= mQGiBD+wIQ0RBAD5IkcgQQIAPO93xBBvviI0htuoaeb++GqG51BImx+rnWIS+1z+r3y5jQU5 IRYS8eDC3eR5PFtde/f7/3zxaJIB0bgXB1eMPot5CaN7mpUySVNh9bzH/UP7rVH0Ut7Bx/CI 7EXxhvYE23F/TAf+gS4flFqQ/GdK+MME+dg8J5nFbwCg92xq6iuAvyz7vSho9qbKHsCD3AkE AMbuLLBvk4mPvs19aRGZvT/pows1uzkeNq8fpmzvryb4UxUbU89qlNzA2Bg8ztVZGX9x5drb C4tFE29ZFAHn2bojx2ADxG85+2as8yfcz6sPG4HMzeTtugzPGCeRAXaSknZHsw6AC6LrtsEU sjEZMElfvu8uU4dthfhXOIDVNRHmA/446GsHRLosDHFuDjHpBQJPJSBnFDyRSCge2Q0gup96 GGhNc7KkYeIB8Dh7dCN3h5RYXflVTspxmgANUa+RFpL4pynsF16rtkfeh0UR8uLdoaGwMChw GyWIdRhX8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2ZGocmyzXYO6qa0Kk3O2YKuvj1NYZ0PALMQIg==
In-Reply-To <r0cana$etb$1@dont-email.me>
Openpgp preference=signencrypt
Content-Language en-US
Cancel-Lock sha1:9mdCp9vlPmdsqGD8I+0ozJaKwTo=
Xref csiph.com comp.programming:10566

Show key headers only | View raw


Am 23.01.20 um 15:31 schrieb David Brown:
> On 23/01/2020 15:00, Philipp Klaus Krause wrote:
>> In a Makefile, I have one rule that creates multiple targets, using the
>> &: feature of GNU make.
>>
>> However, if I use make -j, the rule is still executed as many times as
>> there are targets. How can I avoid that without affecting other rules?
>>
>> Philipp
>>
> 
> I think you will have to post the makefile - or, ideally, a small sample
> makefile that illustrates the effect you are seeing.  It doesn't even
> need to be anything compilable.  For example, you could generate "*.2"
> files from "*.1" files by "cp", generate "*.3" files from multiple "*.2"
> files by "cat".  Once you have a simple sample case like that, post the
> makefile here and people can try to help.
> 
> This particular newsgroup has been ruined years ago by one of the worst
> scourges of Usenet, "Amine Ramdane".  But there are still sane people
> lurking here who would welcome a change from that crackpot - so please
> give us a nice challenge here!
> 

Here is a simple example Makefile to reproduce the issue. When I invoke
it using make -j 4, I see the poutput "sleeping" 4 times. For this
simple example, it is just an inefficientcy, however for my real use
case it results in multiple processes writing appending to the same
file, and messing up the contents.
I use GNU Make 4.2.1.


RESULTS = a b c d

.PHONY: all clean

all: $(RESULTS)

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

clean:
	rm -f $(RESULTS)

Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

make: Multiple targets created by single rule vs parallel make Philipp Klaus Krause <pkk@spth.de> - 2020-01-23 15:00 +0100
  Re: make: Multiple targets created by single rule vs parallel make David Brown <david.brown@hesbynett.no> - 2020-01-23 15:31 +0100
    Re: make: Multiple targets created by single rule vs parallel make Philipp Klaus Krause <pkk@spth.de> - 2020-01-29 11:02 +0100
  Re: make: Multiple targets created by single rule vs parallel make Philipp Klaus Krause <pkk@spth.de> - 2020-01-29 13:43 +0100
    Re: make: Multiple targets created by single rule vs parallel make David Brown <david.brown@hesbynett.no> - 2020-01-29 14:03 +0100
  Re: make: Multiple targets created by single rule vs parallel make Härra Ramob <hrramob@gmail.com> - 2022-01-05 00:27 -0800

csiph-web