5 build-process makefile gnu-make
我有以下GNU makefile:
.PHONY a b c d
a: b c
b: d
c: d
d:
echo HI
Run Code Online (Sandbox Code Playgroud)
我希望目标'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)
Run Code Online (Sandbox Code Playgroud)
你是否正在尝试做这样的事情:
.PHONY: a b c
define print-hi
@echo HI
endef
a: b c
b:
$(print-hi)
c:
$(print-hi)
Run Code Online (Sandbox Code Playgroud)