help-make
[Top][All Lists]
Advanced

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

Re: Overriding environnement in Make ?


From: John Graham-Cumming
Subject: Re: Overriding environnement in Make ?
Date: Mon, 22 Jan 2007 11:37:23 +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

Christophe LYON wrote:
> Consider this sample makefile:
> export LD_LIBRARY_PATH := /prefix:$(LD_LIBRARY_PATH)
> $(warning $(LD_LIBRARY_PATH))
> $(warning $(shell echo $$LD_LIBRARY_PATH))
> 
> Why does the 1st warning includes "/prefix" and 2nd doesn't ?
> 
> When used as commands for a target, both have the same value.

Basically, that's a GNU Make feature/bug:

1. The environment used by $(shell) is the environment present when GNU
Make started and is not changed by exported variables in the Makefile.

2. LD_LIBRARY_PATH has the value set in the Makefile in the first
$(warning) because you are simply accessing the variable inside the
Makefile and the environment is not involved.

3. The environment used for commands executed to build targets does take
into account exported variables.

See this thread for more:
http://lists.gnu.org/archive/html/help-make/2006-06/msg00030.html

John.





reply via email to

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