What this thread does
Do first: add .PHONY: clean for a command-only clean target, then use make -n clean to inspect whether its recipe is selected despite a same-named file.
Short answer
As of November 2026, 4.4.1, released February 26, 2023 is a release listed in the GNU archive. Declare action targets individually as phony; retain timestamp tracking for real outputs or stamps. Phoniness does not propagate to prerequisites (release manual, Phony Targets).
Choose / don't choose
- Phony action: choose for explicitly requested cleanup or another command without a same-named output; don't mark actual build outputs phony.
- Real stamp: choose when an expensive action's freshness is captured by its inputs and last successful completion. Keep the stamp out of
.PHONY, list every relevant input, and puttouchafter the successful action. Don't use a stamp when timestamps cannot represent freshness (Empty Target Files). - Phony aggregate: choose
allto collect build goals; phoniness is not inherited; express ordering as dependency edges (Phony Targets).
Not for: selecting a JavaScript monorepo task runner; see turborepo-nx-or-plain-pnpm-workspaces-for-a-ts-monorepo-2026.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
.PHONY | .PHONY: clean lists literal target names; the clean recipe is eligible regardless of a same-named file; implicit-rule search is skipped | GNU Make 4.4.1 | Phony Targets |
.DEFAULT_GOAL | Set .DEFAULT_GOAL := all to preserve the intended aggregate; exactly one target. Unset: first eligible target; empty assignment restarts selection | GNU Make 4.4.1 | Other Special Variables; Goals |
-n / --dry-run | make -n clean prints selected recipes without ordinary execution; it prints the recipes needed to make targets up to date | GNU Make 4.4.1 | Instead of Executing Recipes |
-j | -j followed by an integer sets the number of recipes to execute at once; default one job, bare -j has no job-count limit. Dependency edges still govern readiness | GNU Make 4.4.1 | Parallel Execution; Options Summary |
Order of operations
1. Classify the target: actual output, completion stamp, or command-only action. Declare every action by its own name in .PHONY; a % entry is literal, not a pattern (Phony Targets). 2. Pin .DEFAULT_GOAL := all before adding utility rules. A first utility target can change the default; the special .PHONY declaration itself does not become the ordinary default goal (Goals; Other Special Variables). 3. For a leaf action with a same-named file and no newer prerequisites, inspect make -n clean: an up-to-date diagnostic and no recipe can reveal the collision. Check the file and declaration too; no output alone does not prove the cause. After adding .PHONY: clean, the same preview should list its recipe (Phony Targets; Instead of Executing Recipes). 4. Express order as edges. The manual uses subdirs: $(SUBDIRS) with SUBDIRS = foo bar baz; adding foo: baz requires baz to finish before foo. List both as phony actions. Reordering names in subdirs is not an ordering dependency (Phony Targets). 5. For an expensive timestamp-tracked action, use a real stamp with real input prerequisites and update it only after success. Avoid a phony normal prerequisite that invalidates a real output on every invocation; an order-only prerequisite after | can enforce setup order without contributing to freshness (Empty Targets; Types of Prerequisites).
-n is not a universal execution barrier: recipe lines prefixed with + or containing $(MAKE) can execute, as can recipes needed to update included makefiles (Instead of Executing Recipes).
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
is up to date. | An existing clean file without prerequisites is considered up to date | Declare the action in .PHONY; retain real-file semantics for actual outputs | diagnostic source, Phony Targets |
.DEFAULT_GOAL contains more than one target | Multiple target names assigned as the default | Set one aggregate target, such as all, and put the other targets in its prerequisite list | diagnostic source, Other Special Variables |
Missing
- The linked source does not confirm: Public incident: Kyle, February 15, 2016, describes encountering this collision with a script named
installbeside a Makefile. The current release manual supplies the behavior and remedy; the historical report supplies the concrete collision, not a release-specific regression. (The Stack Exchange question/answer API does not show the attributed Kyle incident or its date). - The appropriate stamp inputs depend on the action; unlisted inputs or external state cannot be inferred from timestamps.
Checked
2026-11-12; GNU Make 4.4.1 NEWS, release-tagged manual sections and diagnostic source files, and Kyle's dated report read. GNU archive listing reopened and 4.4.1/date confirmed. No Make recipes executed.
Started from a post by @GNU Make maintainers, packaged by the editor. Original post