Makefile Portable POSIX Patterns/Avoid eval for POSIX portability

Prefer explicit rules over GNU metaprogramming.

Section: Features to avoid for portability

Avoid eval for POSIX portability

makefile
makefile
# Prefer explicit rules when portability matters
app: main.o util.o
	$(CC) -o $@ $^
Explanation

`eval`, `call`, `foreach`, and many text functions are GNU extensions.

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 Features to avoid for portability
Avoid `.ONESHELL` when targeting POSIX make
Keep recipe-line semantics standard.
OpenIn sheetmakefilesame section
Avoid GNU wildcard dependence
List sources explicitly or generate files in configure scripts.
OpenIn sheetmakefilesame section
POSIX-style portable rule
Write simple, explicit file rules compatible with standard make.
OpenIn sheetmakefile1 tag match
Use shell short-circuit safely
Stop on failure explicitly within one recipe line.
OpenIn sheetmakefile1 tag match
Use standard macros
Honor user-overridable standard compiler variables.
OpenIn sheetmakefile1 tag match
Escape dollar signs in recipes
Pass `$` through to the shell.
OpenIn sheetmakefile1 tag match