GNU Make 条件 ifneq 检查至少一个变量 not is not empty

GNU Make condition ifneq check at least one variable not is not empty

我想检查在多个列表中是否至少有一个变量不为空。

例如我喜欢将以下工作条件组合成一个语句:

ifneq (${VAR1},)
    ...command true for all ...
else ifneq (${V2},)
    ... same command as above...
else ifneq (${VAR3},)
    ... same command as first...
else ifneq (${V4},)
   ... same command as first...
else
    ...other command....
endif

我喜欢

这样的 MAKE(不是 shell)条件
ifneq (${VAR1},) || (${V2},) ||  (${VAR3},) || (${VAR3},)
   ...command true for all ...
else
   ...other command....
endif
ifneq ($(VAR1)$(VAR2)$(VAR3),)

类似于@HolyBlackCat 的回答:

ifneq ($(or $(VAR1),$(VAR2),$(VAR3)),)

两者都会做同样的事情,@HolyBlackCat 的回答更短,但如果您想做一些稍微复杂的事情,那么了解这种方法是很好的。