[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #27714] expansion of $(shell) in target forces serialization of tar
From: |
Paul D. Smith |
Subject: |
[bug #27714] expansion of $(shell) in target forces serialization of targets |
Date: |
Fri, 16 Oct 2009 11:34:21 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.14) Gecko/2009090216 Ubuntu/8.04 (hardy) Firefox/3.0.14 |
Follow-up Comment #3, bug #27714 (project make):
Hi Mike; no, sorry, I should have given an explicit example. Your new test
case is not correct and doesn't prove anything. I explicitly said do NOT put
the sleep inside the $(shell). It's important to understand that make itself
is single threaded (it doesn't use pthread() etc.). Its parallelism is gained
by having the recipes it invokes be run in parallel. But before it can invoke
the recipe it has to expand all the variables and functions. That includes
$(shell ...) functions. Variables and functions (including $(shell ...)
functions) are NOT expanded "in parallel"; they are expanded one at a time as
they are seen in the recipe.
After the entire recipe is expanded, THEN make invokes the command, then it
leaves the command running in the background while it locates the next
possible recipe to start, evaluates it, then runs it in the background, etc.
So, causing the recipe expansion to take a long time (which is what you're
doing by adding the sleep to the $(shell ...) function) actually _decreases_
the amount of parallelism. Hopefully that's clear.
What you need to do to show the make is working correctly is increase the
time it takes the recipe itself to run: that is, add the sleep OUTSIDE the
$(shell ...). Something like:
$(t): ; @printf $@ $(shell :); sleep 5; printf $@
You should see the recipes all run in parallel (the first printf's all run,
then a pause, then the second printfs all run).
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?27714>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #27714] expansion of $(shell) in target forces serialization of targets, Mike Frysinger, 2009/10/16
- [bug #27714] expansion of $(shell) in target forces serialization of targets, Paul D. Smith, 2009/10/16
- [bug #27714] expansion of $(shell) in target forces serialization of targets, Mike Frysinger, 2009/10/16
- [bug #27714] expansion of $(shell) in target forces serialization of targets,
Paul D. Smith <=
- Re: [bug #27714] expansion of $(shell) in target forces serialization of targets, Philip Guenther, 2009/10/16
- [bug #27714] expansion of $(shell) in target forces serialization of targets, Mike Frysinger, 2009/10/18
- [bug #27714] expansion of $(shell) in target forces serialization of targets, Paul D. Smith, 2009/10/19
- [bug #27714] expansion of $(shell) in target forces serialization of targets, Mike Frysinger, 2009/10/19
- [bug #27714] expansion of $(shell) in target forces serialization of targets, Paul D. Smith, 2009/10/19