Use bash with strict flags for recipes.

Section: Defensive recipes

Set shell and flags

makefile
makefile
SHELL := /usr/bin/env bash
.SHELLFLAGS := -eu -o pipefail -c
Explanation

GNU make allows explicit shell configuration.

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.
OpenIn sheetmakefilesame section
Guard required variables
Abort early when a required variable is missing.
OpenIn sheetmakefilesame section
Trace target execution
Show when each target is considered and updated.
Respect jobserver in recursive make
Propagate parallelism automatically using `$(MAKE)`.
OpenIn sheetmakefile
Full debug output
Print broad internal diagnostics.
Synchronized parallel output
Keep log lines grouped by target when running with jobs.