tup icon indicating copy to clipboard operation
tup copied to clipboard

add a conditional assignment operator ?=

Open svark opened this issue 6 years ago • 1 comments

Make provides a conditional operator ?=

var ?= value

which sets a value for var provided var is empty. Please provide such an operator in tupfiles too. This would allow less special case treatment when porting makefiles to tupfiles.

svark avatar Oct 30 '19 07:10 svark

Happened to need it too. It's not obvious to me at first, but

ifeq ($(FOO), "")
FOO = yes
endif 

can do it. I thought that was ifndef, but ifndef is for @-variable only.

typeless avatar Jun 30 '23 03:06 typeless