Makefile set if variable is empty

前端 未结 6 476
暖寄归人
暖寄归人 2021-01-31 01:37

I want to set a variable if it is empty. I tried in this way:

....
TEST := $(something)
...
TEST ?= $(something else)

The first $(somethi

6条回答
  •  悲哀的现实
    2021-01-31 01:57

    Here's another alternative that I personally find quite elegant, because it's a one-liner and doesn't need the redundant else-branch:

    TEST := $(or $(TEST),$(something else))

提交回复
热议问题