【发布时间】:2011-10-17 04:29:49
【问题描述】:
我需要将a user-defined GNU make function(即a recursively expanded makefile variable)导出到子制作。但是,make 似乎将所有这些变量都扩展为简单的扩展变量,这使得它们毫无用处。
这是一个例子:
“parent.make”的内容:
export myfunc = my arg is $1
$(info parent testing myfunc: $(call myfunc,parent))
all: ; $(MAKE) -f child.make
“child.make”的内容:
$(info child testing myfunc: $(call myfunc,child))
nullrule: ; @true
运行“make -f parent.make”会产生以下输出:
parent testing myfunc: my arg is parent
make -f child.make
child testing myfunc: my arg is
Parent 将 myfunc 作为包含“my arg is”的简单扩展变量导出到子 make,使其无法作为函数使用。
【问题讨论】:
标签: recursion makefile export gnu-make user-defined-functions