我有以下makefile片段,它应该在make clean
中列出的所有目录中调用$(PROJECTS)
。
CLEAN_TARGETS=$(addprefix clean-, $(PROJECTS))
clean-%:
echo "Cleaning $*"
$(MAKE) -C $* veryclean
clean: $(CLEAN_TARGETS)
.PHONY: clean $(CLEAN_TARGETS)
当我make clean
时,我得到以下输出:
me@here:~/test-env/workspace> make --debug=b clean
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-redhat-linux-gnu
Reading makefiles...
Updating goal targets....
File `clean' does not exist.
File `clean-proj-utils' does not exist.
Must remake target `clean-proj-utils'.
Successfully remade target file `clean-proj-utils'.
File `clean-proj-prt' does not exist.
Must remake target `clean-proj-prt'.
Successfully remade target file `clean-proj-prt'.
File `clean-proj-storage' does not exist.
Must remake target `clean-proj-storage'.
Successfully remade target file `clean-proj-storage'.
Must remake target `clean'.
Successfully remade target file `clean'.
make: Nothing to be done for `clean'.
某种程度上make
没有为clean-*
目标做任何事情。
当我从$(CLEAN_TARGETS)
列表中删除.PHONY
时,一切都按预期工作。
这里发生了什么?