recursion - 将递归 makefile 变量导出到子 make

标签 recursion makefile export gnu-make user-defined-functions

我需要导出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 -fparent.make”会产生以下输出:

parent testing myfunc: my arg is parent
make -f child.make
child testing myfunc: my arg is 

Parent 将 myfunc 作为包含“my arg is”的简单扩展变量导出到子 make,使其作为函数无用。

最佳答案

是否有原因导致公共(public)变量和函数无法放入父 makefile 和子 makefile 都包含的单独 makefile 中?

关于recursion - 将递归 makefile 变量导出到子 make,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7789389/

相关文章:

c++ - 数字在数组中出现的次数

c# - 递归失败

由于递归导致的 java.lang.StackOverflowError

c++ - 编译目标文件时出现 g++ 错误

c - 通过 "make"合并 C 程序和 VHDL 比特流(即使用 Makefile)

excel - 将电子邮件数据导出到 CSV 文件(或 XLS 文件)中的特定字段

deployment - PhpStorm:如何将部署设置从一个项目导出到另一个项目?

java - 有人可以解释一下这段代码吗?排列码

c++ - nginx rtmp compile for windows error U1052 & rtmp-module-master/config not found

export - 如何将 .dm3 文件(带注释和比例尺)转换为 .jpg/jpeg 图像?