help-make
[Top][All Lists]
Advanced

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

RE: please clarify the manual on foreach function?


From: Mark Galeck (CW)
Subject: RE: please clarify the manual on foreach function?
Date: Fri, 18 Feb 2011 15:17:48 -0800

Without being too clever, here's an SSCCE:

define VAR
$(foreach item, foo bar,        $(shell echo $(item)>>foobar.txt))
endef

foobar:
        $(VAR)


You see that VAR is expanded during the "first pass" of make, and it's value is 
nothing, but, I am relying on it's side effects to echo things to a file.  So I 
care, that the invocations of echo, are in order, and wait for each other to 
finish.  

I guess what you are saying is, the (first pass of) make is serial.  And in the 
manual it says, that make waits for the end of the shell function to collect 
the output of the shell.  

So that would mean, the above example should behave as expected.  

The reason why I was asking, is I see in one of my users, a rather bizarre 
effects, which would be consistent with the above shell invocations executed 
"in parallel" and/or not "in order".  So I think I should look for another 
explanation?

Mark



reply via email to

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