get a default value when variable is unset in make

后端 未结 4 1887
面向向阳花
面向向阳花 2020-12-31 09:10

(edit: question more accurate based on @Michael feedback)

In bash, I often use parameter expansion: the following commands print \"default value\" when

4条回答
  •  轮回少年
    2020-12-31 09:40

    If you want to use the expansion of a GNU make variable if it is non-empty and a default value if it is empty, but not set the variable, you can do something like this:

    all:
            echo $(or $(VARNAME),default value)
    

提交回复
热议问题