get a default value when variable is unset in make

If you want to use the expansion of a GNU make variable if it is non-empty and a default value if it is empty, but not set the variable, you can do something like this:

all:
        echo $(or $(VARNAME),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.

Refer to Syntax of Conditionals in the manual for more.