make --trace testGNU make trace mode is very useful for dependency debugging.
Debug make behavior, inspect variables, run parallel builds safely, and build reliable CI targets.
Inspect why make did or did not rebuild something.
make --trace testGNU make trace mode is very useful for dependency debugging.
make --debug=aNoisy but invaluable for deep investigations.
$(info OBJ=$(OBJ))Simple and effective for generated lists.
See where a value came from and how it expands.
$(info CFLAGS origin=$(origin CFLAGS) flavor=$(flavor CFLAGS) value=$(value CFLAGS))Great for untangling overrides.
make -rR --warn-undefined-variables`-rR` disables built-in rules and variables in GNU make.
Concurrency controls, reproducibility, and fail-fast targets.
Propagate parallelism automatically using `$(MAKE)`.
subdirs:
$(MAKE) -C api
$(MAKE) -C webUse `$(MAKE)` rather than plain `make` so flags like `-j` propagate correctly.
Keep log lines grouped by target when running with jobs.
make -j8 --output-sync=targetMuch easier to read in CI logs.
Create a single target for consistent pipeline execution.
.PHONY: ci
ci: lint test buildA clean top-level target improves discoverability and consistency.
Load machine-specific settings without hardcoding them in shared files.
-include .env.mkCombines well with CI-provided environment variables.
Use lockfile-based install inside a phony or stamp target.
.PHONY: deps
deps:
npm ciReplace with the appropriate package manager for your stack.
Safer shell behavior and clearer failures.
SHELL := /usr/bin/env bash
.SHELLFLAGS := -eu -o pipefail -cGNU make allows explicit shell configuration.
Fail fast in multi-line recipes.
.ONESHELL:
release:
set -euo pipefail
pnpm build
aws s3 sync dist/ s3://my-bucketWithout `.ONESHELL`, shell flags reset on each line.
Abort early when a required variable is missing.
ifndef VERSION
$(error VERSION is required. Usage: make release VERSION=1.2.3)
endifAn easy way to make release flows safer.