Makefile Pattern Rules & Dependency Generation/Link binary from generated object list

Assemble final executable from all objects.

Section: Implicit and pattern rules

Link binary from generated object list

makefile
makefile
app: $(OBJ)
	cc $(OBJ) -o $@
Explanation

Combine generated variables with simple final targets.

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 Implicit and pattern rules
Basic pattern rule
Compile any `.c` file into a matching `.o` file.
OpenIn sheetmakefilesame section
Pattern rule with directories
Build objects into a separate output directory.
OpenIn sheetmakefilesame section
Static pattern rule
Apply a pattern to a known target list.
OpenIn sheetmakefilesame section
Match and transform filenames
Create object names from source names.
OpenIn sheetmakefilesame section
Clear built-in suffix rules
Reduce surprises by disabling legacy suffix rules.
OpenIn sheetmakefilesame section
$* stem in pattern rules
Use the matched stem from the target pattern.
OpenIn sheetmakefile1 tag match