Re: Setting environment variables with Make

Ralf Wildenhues <[email protected]> Sat, 7 Mar 2009 20:52:08 +0100
Newsgroups gmane.comp.gnu.utils
Organization Department of Numerical Simulation, University of Bonn
Message-ID <[email protected]>
Hello August,

* August Karlstrom wrote on Sat, Mar 07, 2009 at 02:19:06PM CET:
> I'm trying to store a value between two commands for a production rule  
> in a makefile. The following does not work though.
>
> foo:
> 	bar=`output of some command`
> 	echo $(bar)

Each command line in a rule is executed by a separate shell invocation.
So use e.g.,

foo:
	bar=`output of some command`; \
	echo $(bar)

Cheers,
Ralf