[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Exporting variable to $(shell).
From: |
Sergey Organov |
Subject: |
Re: Exporting variable to $(shell). |
Date: |
Wed, 11 Jan 2017 19:10:37 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Paul Smith <address@hidden> 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