Paul Smith <psm...@gnu.org> writes:

> On Wed, 2017-01-11 at 17:49 +0300, Sergey Organov wrote:
>> It looks like exporting variables to $(shell) function
>> doesn't work.
>
> This is https://savannah.gnu.org/bugs/?10593
>
> It should be made to work, but unfortunately it's not completely trivial
> to fix, since you can have infinite loops like:
>
>   export ID = $(shell id -a)
>   var := $(shell echo hi)
>
> 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?

Then, when one actually wants expansion,

  export ID := $(shell id -a)
  var := $(shell echo hi)

should do the trick, no?

>
> 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.

-- Sergey


_______________________________________________
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make

Reply via email to