GNU使变量范围

时间:2010-10-10 18:52:19

标签: build gnu-make

我有一些makefile:

$(PROGRAM_NAME): index.o
    @echo "linking"
    @echo $(index_o)
    //linking

export index_o:=.
index.o:
    $(MAKE) -C some_dir index.o

在some_dir makefile

export index_o:=$(index_o)/index.o
index.o:
    @echo "compiling"
    @echo $(index_o)
    //compiling

输出:

编译 ./index.o 链接

需要输出:

编译 ./index.o 链接 ./index.o

如何将变量的变化分享给父make线程? 可能是我需要真正的全局变量...... 我看过http://www.gnu.org/software/automake/manual/make/Recursion.html 但未找到

1 个答案:

答案 0 :(得分:2)

无法将变量推送回父进程。

您可能有兴趣阅读Recursive Make Considered Harmful。短 - 短版本:不需要递归来控制大型构建并导致麻烦。

相关问题