GNU Make 4 · Rules and targets

Compile every source file

Build any .o file from the matching .c file. $< is the first prerequisite and $@ is the target.

%.o: %.c
	$(CC) $(CFLAGS) -c $< -o $@

Official GNU Make 4 documentation

More rules and targets commands

All rules and targets commands · GNU Make 4 cheatsheet

Was this page helpful?