为什么Gnu不会为PHONY提到的目标做任何事情?

时间:2018-06-14 08:57:52

标签: makefile

我有以下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时,一切都按预期工作。

这里发生了什么?

0 个答案:

没有答案