Tue 21 Jan 2003 03:12:01 PM UTC, comment #3:
This will not work. Exporting variables is NOT an appropriate method for sharing makefile code between different make processes: you should use a common include file for that and include it in both makefiles. If you don't want to explicitly include it, see also the MAKEFILES variable. Since you don't say why you want to do this, that's all the advice I can offer.
Exporting variables is intended to allow the make process to communicate values (not make code) to programs it invokes, like the shell or a compiler, etc.
All values that are exported are expanded before the subshell is invoked: this is required by POSIX and is a feature, not a bug.
If you really, really want to do this you'll have to escape the value that's exported like this:
MYFUNC = $$(2) $$(1)
export MYFUNC
then you'll have to "un-escape" it before you use it, like this:
_MYFUNC := $(MYFUNC)
all: ; @echo $(call _MYFUNC,one,two)
(note I just wrote this off the top of my head; I didn't test it).
|