(edit: question more accurate based on @Michael feedback)
In bash, I often use parameter expansion: the following commands print \"default value\" when
default value
If you want to test if a variable has a non-empty value, you can use:
ifeq ($(VARNAME),) VARNAME="default value" else do_something_else endif
For checking if a variable has been defined or not, use ifdef.
ifdef
Refer to Syntax of Conditionals in the manual for more.