[問題] makefile phony target 問題

作者: anoymouse (沒有暱稱)   2021-01-25 18:06:08
# Subdirectories to build
SUBDIRS = \
radio \
video \
# RULES
.PHONY : $(SUBDIRS) $(MAKEFILE_LIST)
all : $(SUBDIRS) $(MAKEFILE_LIST)
$(SUBDIRS) :
@echo "Building [email protected]"
$(A)$(MAKE) -C [email protected]
請教一下
all 雖然沒有宣告成phony,但這種非真實檔案的target,是不是還是可以算是phony,
前提是沒有檔案叫做all的話?
因為在看GNU make 的手冊:
"When one phony target is a prerequisite of another, it serves as a subroutine
of the other."
然後再根據多目標規則,可以等效成:
radio :
@echo "Building [email protected]"
$(A)$(MAKE) -C [email protected]
video :
@echo "Building [email protected]"
$(A)$(MAKE) -C [email protected]
請問這樣的理解正確嗎?
謝謝
作者: bamchisu (suchi)   2021-01-28 18:17:00
小弟的理解,從頭到尾都沒有一個叫做all的檔案有錯請指正
作者: Gold740716 (項為之強)   2021-01-30 13:00:00
我記得要宣告 phony 是因為一些舊的 make 執行完目標後會檢查目標檔案存在,不宣告為 phony 會出錯

Links booklink

Contact Us: admin [ a t ] ucptt.com