help-make
[Top][All Lists]
Advanced

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

Re: export does not export to $(shell ...


From: John Graham-Cumming
Subject: Re: export does not export to $(shell ...
Date: Fri, 25 Nov 2005 09:28:03 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

Martin d'Anjou wrote:
How do I convince export to export variables to $(shell ...)?

l:=$(shell echo $$USER)
$(warning $(l))
export VAR=Hi
l:=$(shell echo VAR $$VAR)
$(warning $(l))

all:
        echo $$VAR

Is this a bug? I use 3.81beta3

The code handling $(shell) (func_shell in function.c) uses the parent environment (from environ) for the sub-shell. Hence GNU Make's export directive will not put GNU Make variables into the $(shell) environment.

You could have this like this:

    export FOO=fooey
    ORIGINAL := $(shell echo 1: $$FOO)
    HACKED := $(shell export FOO=$(FOO) ; echo 2: $$FOO)

    all:
        @echo Original: $(ORIGINAL)
        @echo Hacked:   $(HACKED)

John.
--
John Graham-Cumming
address@hidden

Home: http://www.jgc.org/
POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/
Fast, Parallel Builds: http://www.electric-cloud.com/

Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/

PGP key: http://www.jgc.org/pgp/




reply via email to

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