How could I abort a make/makefile execution based on a makefile’s variable not being set/valued?
I came up with this, but works only if caller doesn’t explicitly run a target (i.e. runs make
only).
ifeq ($(MY_FLAG),)
abort: ## This MUST be the first target :( ugly
@echo Variable MY_FLAG not set && false
endif
all:
@echo MY_FLAG=$(MY_FLAG)
I think something like this would be a good idea, but didn’t find anything in make’s manual:
ifndef MY_FLAG
.ABORT
endif