Makefile Portable POSIX Patterns/Use shell short-circuit safely

Stop on failure explicitly within one recipe line.

Section: Recipe portability

Use shell short-circuit safely

makefile
makefile
deploy:
	cd infra && terraform apply -auto-approve
Explanation

Since each recipe line runs in its own shell by default, keep dependent shell commands on the same line in portable makefiles.

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 Recipe portability
Escape dollar signs in recipes
Pass `$` through to the shell.
OpenIn sheetmakefilesame section
Use tabs for recipe lines
Indent recipe commands with a tab character.
OpenIn sheetmakefilesame section
Create directory safely
Ensure output directories exist.
OpenIn sheetmakefilesame section
Avoid `.ONESHELL` when targeting POSIX make
Keep recipe-line semantics standard.
OpenIn sheetmakefile2 tag match
POSIX-style portable rule
Write simple, explicit file rules compatible with standard make.
OpenIn sheetmakefile1 tag match
Avoid eval for POSIX portability
Prefer explicit rules over GNU metaprogramming.
OpenIn sheetmakefile1 tag match