我有以下遞歸生成文件:當聲明圖案規則爲假,則不會觸發
.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