help-make
[Top][All Lists]
Advanced

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

Re: make funct in recipe sees shell var ..


From: gnu_make0
Subject: Re: make funct in recipe sees shell var ..
Date: Sun, 01 May 2011 17:23:50 -0500

Thanks Paul:

On Sun 5/1/11 13:47 EDT address@hidden wrote:
> On Sun, 2011-05-01 at 08:57 -0500, address@hidden wrote:
> > Assume I need to use the make foreach function in the recipe, and
> > that this function must somehow use the shell var pip to define
> > it's second arg.
> 
> What you are asking for is not possible, as described.
> 
> foreach runs inside make.  The variable exists in the shell.  Make will
> completely evaluate the recipe then give it to the shell to run.  This
> operation is strictly one way, and serial.  There's no "two-way
> communication" where the shell can give back information to make that it
> can use when it does more evaluation later.

> >   .PHONY : yip
> >
> >   yip :
> >           pip="alpha beta gamma";\
> >           echo "$(foreach foo,word-one $$pip,everyloop $(foo))"

OK, make (and foreach) only sees the literal string $$pip, which is passed
to the shell as $pip.  

My work around is to write pip as a make macro in a temp file,
where this tempfile is itself a target with preqs which
ensure that pip is defined.  This tempfile is pulled in as a
make include - this is working but seems a bit complex..

--
thanks again,
Tom



reply via email to

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