John wrote: >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.
How annoying. I can kind of almost see why, but not quite. Consider this: 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? Martin _______________________________________________ Help-make mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-make
