考虑到 PHONY 目标的 GNU make 手册的摘录:
完成后,
make clean' will run the commands regardless of whether there is a file named
清洁'。
为什么我没有看到我的配方被执行,尽管在调试输出中 make 说它必须重新制作这些目标?这是一个演示该问题的示例生成文件:
all:
@echo Rule to build 'all'
.PHONY: clean a.clean b.clean
clean: a.clean b.clean
@echo Cleaning toplevel
%.clean:
@echo Cleaning $*
这是输出 - 注意没有提到Cleaning $*
make: Entering directory `/tmp'
Cleaning toplevel
make: Leaving directory `/tmp'
这是来自的输出-d
:
Considering target file `clean'.
File `clean' does not exist.
Considering target file `a.clean'.
File `a.clean' does not exist.
Finished prerequisites of target file `a.clean'.
Must remake target `a.clean'.
Successfully remade target file `a.clean'.
Considering target file `b.clean'.
File `b.clean' does not exist.
Finished prerequisites of target file `b.clean'.
Must remake target `b.clean'.
Successfully remade target file `b.clean'.
Finished prerequisites of target file `clean'.
Must remake target `clean'.