help-make
[Top][All Lists]
Advanced

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

Re: Exporting variable to $(shell).


From: Paul Smith
Subject: Re: Exporting variable to $(shell).
Date: Wed, 11 Jan 2017 11:38:30 -0500

On Wed, 2017-01-11 at 19:10 +0300, Sergey Organov wrote:
> > Some sort of loop detection on variable expansion needs to be
> > implemented.
> 
> Can't it rather be solved by exporting variables to the $(shell)
> unexpanded?

Well, that would be a major difference in the way make works, and
probably even more off-putting than the current behavior:

 FOO = bar
 export BAR = $(FOO)

 xx := $(shell echo $$BAR)

would give $(FOO), not bar... confusing, and very un-make-like.  I don't
think I want it to work that way.

> > You need to explicitly provide the variables you need in the shell
> > function:
> > 
> >    var := $(shell MY_VAR='$(MY_VAR)'; echo "value = $$MY_VAR")
> 
> Yeah, that obviously works, but I rather hoped to set LC_ALL=C once for
> everythig ever called from given Makefile.

True; but on the other hand there are currently no versions of make
which support exporting to the shell, so even if it were fixed today
you'd still need to use this syntax if your makefiles could be used with
older versions of make.



reply via email to

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