Re: Setting environment variables with Make

[email protected] (Paul Jarc) Sat, 07 Mar 2009 15:27:57 -0500
Newsgroups gmane.comp.gnu.utils
Organization What did you have in mind? A short, blunt, human pyramid?
Message-ID <[email protected]>
Ralf Wildenhues <[email protected]> wrote:
> 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)

This shold be expanding a shell variable, not a Makefile variable, so
one more change is needed:

foo:
	bar=`output of some command`; \
	echo $${bar}

Or if you want to check for failure in the first command:

foo:
	bar=`output of some command` && \
	echo $${bar}


paul