我对下面的 GNU makefile 示例有疑问:
.PHONY: $(subdirs) build x y
subdirs = a b c
build: x y
x: target=prepare
x: $(subdirs)
y: target=build
y: $(subdirs)
$(subdirs):
$(make) -f $@/makefile $(target)
当我运行make时,我希望为每个指定目标'prepare'然后是目标'build'的子目录调用make。不幸的是,$(subdirs) 目标执行一次(使“准备”目标),但不会再次为“构建”目标执行。
似乎对于规则 x,make 确定需要运行 $(subdirs) 目标,但对于规则 y,$(subdirs) 目标是最新的。
有没有什么办法解决这一问题?
谢谢!