Abort early when a required variable is missing.
Section: Defensive recipes
Guard required variables
makefile
makefile
ifndef VERSION
$(error VERSION is required. Usage: make release VERSION=1.2.3)
endifExplanation
An easy way to make release flows safer.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Defensive recipes
Use strict flags inside one-shell recipe
Fail fast in multi-line recipes.
Respect jobserver in recursive make
Propagate parallelism automatically using `$(MAKE)`.
Synchronized parallel output
Keep log lines grouped by target when running with jobs.