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
精彩评论