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.
$(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.
subdirs:
$(MAKE) -C api
$(MAKE) -C webUse `$(MAKE)` rather than plain `make` so flags like `-j` propagate correctly.
make -j8 --output-sync=targetMuch easier to read in CI logs.
.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.
.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.
.ONESHELL:
release:
set -euo pipefail
pnpm build
aws s3 sync dist/ s3://my-bucketWithout `.ONESHELL`, shell flags reset on each line.
ifndef VERSION
$(error VERSION is required. Usage: make release VERSION=1.2.3)
endifAn easy way to make release flows safer.