【问题标题】:GNU make scope of variableGNU 使变量范围
【发布时间】:2010-10-10 18:52:19
【问题描述】:

我有一些makefile:

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

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

在 some_dir 生成文件

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 但没有找到

【问题讨论】:

    标签: build gnu-make


    【解决方案1】:

    不能将变量推回父进程。

    您可能有兴趣阅读Recursive Make Considered Harmful。 Short-short 版本:递归对于控制大型构建不是必需的,但会导致麻烦。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-10
      • 2014-01-31
      • 2011-02-10
      • 2020-02-07
      • 2012-12-23
      相关资源
      最近更新 更多