I’m trying to use the if function (as opposed to one of the conditional statements) in GNU make in order to add a word to a list if a specific variable isn’t defined. The way I’ve ended up doing this is to leave the second argument blank while providing the third argument, like so:
FOO := baz $(if $(BAR),,quux)
This sees to work OK, but strikes me as a little silly. Is there any sort of simple, built-in way to do what I want? I could define my own not function, but
FOO := baz $(if $(call not,$BAR),quux)
isn’t much of an improvement in my opinion.
I would go this way:
or if empty string has meaning “not defined”, then: