I want to set a variable if it is empty. I tried in this way:
....
TEST := $(something)
...
TEST ?= $(something else)
The first $(something)
may return an empty string, however the conditional assignment ?= works only if the previous variable is not set, not if empty.
Any elegant solution to set the variable if empty?
EDIT I found this solution:
....
TEST := $(something)
...
TEST += $(something else)
TEST := $(word 1, $(TEST))
but I think that there will be one more elegant.
make
programs have conditions, and also functions to test variables. For GNU Make please read the documentation. – Some programmer dude Aug 6 '16 at 7:49something
is, you could useifeq(,$(TEST))
or ifsomething
is a shell command perhapssomething || something else
. – tripleee Aug 6 '16 at 8:52