【发布时间】:2015-02-03 12:49:24
【问题描述】:
这是一个使用 DEFAULT_GOAL 变量的例子:
ifeq ($(.DEFAULT_GOAL),)
$(warning no default goal is set)
endif
.PHONY: foo
foo: ; @echo $@
$(warning default goal is $(.DEFAULT_GOAL))
# Reset the default goal.
.DEFAULT_GOAL :=
.PHONY: bar
bar: ; @echo $@
$(warning default goal is $(.DEFAULT_GOAL))
# Set our own.
.DEFAULT_GOAL := foo
The output is:
no default goal is set
default goal is foo
default goal is bar
foo
我坚持理解 echo 和 $(warning ) 函数的流程是什么,即当 $(warning ) 函数被称为 echo $ @ 输出被抑制并显示 echo $@ 的最后输出。因为有 2 echo statement 和 3 $(warning) 函数调用,但 echo 最后一个 foo 只打印了一个目标 id。为什么其他的不打印,为什么最后一个值打印为 foo 为什么不打印 bar?
【问题讨论】: