开发者

Conditional assignment of SHELL variable in Makefile

I have a Makefile variables VAR_1 and VAR_2.

I need to assign the value of $($VAR1)_VAR2) to FINAL_VAR, ONLY if $($VAR1)_VAR2) is NOT EQUAL TO /dev/null. If $($VAR1)_VAR2) is EQUAL TO /dev/null then FINAL_VAR should be assigned some default value say "/usr/tmp"开发者_运维问答


In GNU make, you can use the ifneq directive:

ifneq ("$($(VAR1)_VAR2)","/dev/null")
    FINAL_VAR=$($(VAR1)_VAR2)
else
    FINAL_VAR=/usr/tmp
endif
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜