Makefile Portable POSIX Patterns/Portable clean target

Provide common non-file maintenance targets.

Section: Portable make basics

Portable clean target

makefile
makefile
clean:
	rm -f app *.o
Explanation

`.PHONY` is common in modern makes, but some historical portability guidance prefers not to depend on it unless you know the implementation supports it.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Portable make basics
POSIX-style portable rule
Write simple, explicit file rules compatible with standard make.
OpenIn sheetmakefilesame section
Use standard macros
Honor user-overridable standard compiler variables.
OpenIn sheetmakefilesame section
Suffix rule
Use classic suffix rules when targeting very portable make implementations.
OpenIn sheetmakefilesame section
Override variables from CLI
Allow users to customize toolchain choices.
OpenIn sheetbashsame section
Use shell short-circuit safely
Stop on failure explicitly within one recipe line.
OpenIn sheetmakefile1 tag match
Avoid eval for POSIX portability
Prefer explicit rules over GNU metaprogramming.
OpenIn sheetmakefile1 tag match