build-process - 指定为对多个规则的依赖时重新执行目标

标签 build-process makefile gnu-make

我有以下 GNU 生成文件:

.PHONY a b c d

a: b c
b: d
c: d
d:
    echo HI

我希望目标“d”运行两次——因为它被 b&c 指定为依赖项。不幸的是,目标 'd' 将只执行一次。运行 make 的输出将只是“HI”,而不是“HI HI”。

我怎样才能解决这个问题?

谢谢!

澄清一下,目标是这样的:
subdirs =  a b c

build: x y

x: target=build
x: $(subdirs)

y: target=prepare
y: $(subdirs)

$(subdirs):
    $(make) -f $@/makefile $(target)

最佳答案

build: x y

x: target=build
y: target=prepare

x y: 
    echo hi $(target) $@
    touch $@

另见 GNU Makefile rule generating a few targets from a single source file因为它是对与此相反的问题的答案。

关于build-process - 指定为对多个规则的依赖时重新执行目标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1218019/

相关文章:

makefile - make,变量取决于目标

makefile - 如何检查 makefile 中目标是否存在

c - 使 C 预处理器忽略某些#include 指令

c# - 源代码管理中的存储过程 - 自动化构建/部署过程

c - 由于 .h 上的 "preprocessor define"重新编译

c - 如何在makefile中扩展嵌套变量

makefile - 无法在 makefile 中打印换行符

cmake - 在 CMake 中,是否可以构建从构建树导入的依赖项?

visual-studio-2010 - 为什么在编辑构建过程模板时Workflow Designer如此之慢?

c++ - 如何使用Makefile使用VTK库编译项目?