我有以下递归生成文件:当声明图案规则为假,则不会触发
.PHONY: all clean
%.subdir:
$(MAKE) -C src $*
$(MAKE) -C dict $*
all: all.subdir
clean: clean.subdir
,它工作正常:
$ make all
make -C src all
make[1]: Entering directory `/or-1.3.6-fix/src'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/or-1.3.6-fix/src'
make -C dict all
make[1]: Entering directory `/or-1.3.6-fix/dict'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/or-1.3.6-fix/dict'
但它会更合乎逻辑的定义%.subdir
规则欺世盗名:
.PHONY: all clean all.subdir clean.subdir
和现在做停止工作,因为我想:
$ make all
make: Nothing to be done for `all'.
$ make -d all
...
Updating goal targets....
Considering target file `all'.
File `all' does not exist.
Considering target file `all.subdir'.
File `all.subdir' does not exist.
Finished prerequisites of target file `all.subdir'.
Must remake target `all.subdir'.
Successfully remade target file `all.subdir'.
Finished prerequisites of target file `all'.
Must remake target `all'.
Successfully remade target file `all'.
make: Nothing to be done for `all'.
有人可以解释我为什么(或者甚至更好地指出我做文档)?
感谢您的好意!很好。我宁愿多认证一下,说'PHONY_TARGETS:=全部干净',然后是'.PHONY:$(PHONY_TARGETS)$(addsuffix.subdir,$(PHONY_TARGETS))' – 2010-06-25 08:59:36
找到这两个冒号寻找目标/ dep如果有人感兴趣,请联系:https://www.gnu.org/software/make/manual/html_node/Static-Usage.html#Static-Usage – solstice333 2016-02-12 23:57:02