Another option:
MY_FLAG = $(error Please set this flag)
Attempting to use this variable anywhere will cause an error, unless it's overriden from the command line.
To accept environment variables as well, use ?=
:
MY_FLAG ?= $(error Please set this flag)
To be clear:
make MY_FLAG=42
- this is a command line override, accepted by both forms.MY_FLAG=42 make
- this is an environment variable override, accepted by?=
and ignored by=
.