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)))

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

Stolen from: and found here The GNU Make Book

Leave a comment

Your comment