我有一个 Makefile,其中包含来自另一个 Makefile 的变量“verbose”,并且 ifeq 语句使用此变量永远无法工作,既不包含 makefile,也不包含顶级 makefile。
-include foo.mki
$(info Variable:$(verbose))
ifeq ($(verbose),yes)
$(info condition is true)
else
$(info condition is false)
endif
verbose 打印为 yes upper info,但从不打印条件为 true。
Variable:yes
condition is false
您知道为什么会发生这种情况吗?并推荐一种方法,我可以将配置参数带到另一个配置 Makefile 中,并在这里使用它们作为条件。
使用“$strip”函数解决了这个问题。这是一个新的代码块:
ifeq ($strip $(verbose)),yes)
.
.
.