当指定为多个规则的依赖项时重新执行目标
我有以下 GNU makefile:
.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)
I have the following GNU makefile:
.PHONY a b c d
a: b c
b: d
c: d
d:
echo HI
I would like the target 'd' to be run twice -- since it is specified as a dependency by both b & c. Unfortunately, the target 'd' will be executed only once. The output of running make will simply be 'HI', instead of 'HI HI'.
How can I fix this?
Thanks!
To Clarify, the goal is something like this:
subdirs = a b c
build: x y
x: target=build
x: $(subdirs)
y: target=prepare
y: $(subdirs)
$(subdirs):
$(make) -f $@/makefile $(target)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另请参见GNU Makefile规则从单个源文件生成一些目标,因为它是与此相反的问题的答案。
See also GNU Makefile rule generating a few targets from a single source file as it is an answer to a problem that is the opposite of this one.
你是否正在尝试做这样的事情:
Are you trying to do something like this: