由于未定义的变量只是简单地用空文本替换(考虑目标目录),因此可能导致意外行为,是否有办法检查变量是否未定义并在这种情况下停止并出现错误?
可以使用条件检测条件,但是如何停止执行?
ifeq ($(strip $(notdefinedforsure_man)),)
out = Undefined variable detected
endif
Run Code Online (Sandbox Code Playgroud)
我正在寻找像requiredef var1,var2这样的东西
或者在上述条件中使用的带有错误陈述的简单回报
使用origin内置函数:
ifeq (undefined,$(origin VARIABLE))
$(error VARIABLE is not defined)
endif
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅文档