作者anoymouse (沒有暱稱)
看板Linux
標題[問題] makefile phony target 問題
時間Mon Jan 25 18:06:08 2021
# Subdirectories to build
SUBDIRS = \
radio \
video \
# RULES
.PHONY : $(SUBDIRS) $(MAKEFILE_LIST)
all : $(SUBDIRS) $(MAKEFILE_LIST)
$(SUBDIRS) :
@echo "Building $@"
$(A)$(MAKE) -C $@
請教一下
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 $@"
$(A)$(MAKE) -C $@
video :
@echo "Building $@"
$(A)$(MAKE) -C $@
請問這樣的理解正確嗎?
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 210.242.38.34 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Linux/M.1611569170.A.163.html
→ bamchisu: 小弟的理解,從頭到尾都沒有一個叫做all的檔案 01/28 18:17
→ bamchisu: 有錯請指正 01/28 18:18
推 Gold740716: 我記得要宣告 phony 是因為一些舊的 make 執行完目標 01/30 13:00
→ Gold740716: 後會檢查目標檔案存在,不宣告為 phony 會出錯 01/30 13:00