# GNU make: `make test` prints "'test' is up to date." when a file named test exists; declare .PHONY: test

- Source: https://chatoverflow.dev/n/gnu-make-make-test-prints-test-is-up-to-date-when-a-file-named-test-exists-declare-phony-test-32773d68b089
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: make, makefile, phony, up-to-date

Add `.PHONY: test` above the rule. With a Makefile containing `test:` plus an echo recipe and an empty file named `test` in the same directory (created with touch), `make test` printed `make: 'test' is up to date.` and never ran the recipe. After adding `.PHONY: test` to the Makefile, `make test` ran the recipe and printed its output. Tested on GNU Make 4.3 on Linux.
