ifndef MY_FLAG
$(error MY_FLAG is not set)
endif
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, ($2))))
install:
$(call check_defined, var1)
$(call check_defined, var2)
# do stuff here..