makefile phony target 問題 - Linux

Table of Contents

# 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 $@

請問這樣的理解正確嗎?


謝謝

--

All Comments

Quintina avatarQuintina2021-01-27
小弟的理解,從頭到尾都沒有一個叫做all的檔案
Callum avatarCallum2021-01-30
有錯請指正
Anonymous avatarAnonymous2021-02-03
我記得要宣告 phony 是因為一些舊的 make 執行完目標
後會檢查目標檔案存在,不宣告為 phony 會出錯