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.



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to