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:52:18 -0800

Thank you Paul very much, I was just finishing labouriously going through the 
example, using your explanations,  to make sure it behaves as expected, and you 
of course knew that in a millisecond (or so). When people ask me, how do you 
know all this stuff, I say, I don't, but there is this God-like creature on the 
mailing list...


> define VAR
> $(foreach item,foo bar,$(shell echo $(item)>>foobar.txt))
> endef
> 
> foobar:
>       $(VAR)
> 
>I should point out that the evaluation of $(VAR) here does not happen
until make decides to start the "foobar" target.  This loop will never



???  I definitely see the foobar.txt being created, _before_ the recipe for 
foobar starts to run (in this small example, it would be hard to see, but my 
general example takes longer so it's easy to see).  I thought, that was due to 
the $(VAR) variable being multiline, and me being not on the latest GNU Make 
(the previous one), then this would be an immediate expansion (or something 
like that).  

>you can't get rid of the $(shell ...) and just have:

        foobar:
                for v in foo bar; do echo $$v >> foobar.txt; done


Yes the reason is that the shell (Windows) cannot handle a long command line, 
so I workaround that by breaking the command line into smaller pieces and 
feeding them to the shell in order, as shown before.  It worked extremely well 
until today one user saw something, as if these invocations were done at the 
same time (on different processors in his machine).  




reply via email to

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