makefile – all you wanted to know about variable but were afraid to ask

Sometimes, all you need is a simple solution for checking whether variable you really (really!) need is already defined.

assert = $(if $2,$(if $1,,$(error $2)))

all:
    $(call assert,$(VARIABLE),VARIABLE is not defined)

Stolen from: http://gmsl.sourceforge.net and found here The GNU Make Book