The best practice is to:
add each phony target as a prerequisite of .PHONY immediately before the target declaration, rather than listing all the phony targets in a single place.
However, if I put a remake task description in front of it, remake --tasks won't show it because .PHONY is a target of its own.
Example:
#: This is the main target
.PHONY: all
all:
echo "Executing all ..."
Workarounds:
- Leave out the
.PHONY declaration as in your example and risk hard to debug behavior when a file with the name of the target exists.
- Put the
.PHONY declaration below the target or elsewhere and risk name mismatches or forgetting to declare phony targets. I've seen that happening even with .PHONY directly above the target.