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 14:35:19 +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:
l:=$(shell echo $$VAR)
$(warning VAR=$(VAR))
export VAR=10
l:=$(shell echo $$VAR)
$(warning VAR=$(VAR))

make

Makefile:2: VAR=
Makefile:5: VAR=10

Why would VAR be defined for $(shell) just like it is for $(warning) for example? Without export, ok, but with export, why not?

The output you show makes sense to me. The first $(warning) get evaluated before VAR has been set to anything and hence you get the VAR= output; the second $(warning) is after VAR has been set to 10 and hence you get the VAR=10 output.

I'd also assume that l is always empty in this Makefile since VAR will not be exported into the environment of the $(shell).

I think the authors of GNU Make want to avoid the following situation:

    export FOO=$(shell do_something)
    export BAR=$(shell do_something_else)

What should the values of FOO and BAR be in the environment for each of those shell commands? It's hard to answer because in order to run the shell you'd have to figure out the value of FOO and BAR to put into the environment, which requires a $(shell) which requires... a loop.

John.
--
John Graham-Cumming
address@hidden

Home: http://www.jgc.org/
POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/
GNU Make Debugger: http://gmd.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]