Instructions in the makefile are interpreted as single lines. If
an instruction must span more than one input line, use a backslash
\) at the end of the line so that
the next line is considered a continuation. The makefile may contain
any of the following types of lines:
Blank lines are ignored.
A number sign (
be used at the beginning of a line or anywhere in the middle.
make ignores everything after
One or more target names, a single- or double-colon separator, and zero or more prerequisites:
In the first form, subsequent commands are executed if the prerequisites are newer than the target. The second form is a variant that lets you specify the same targets on more than one dependency line. (This second form is useful when the way you rebuild the target depends upon which prerequisite is newer.) In both forms, if no prerequisites are supplied, subsequent commands are always executed (whenever any of the targets are specified). For example, the following is invalid, since single-colon rules do not allow targets to repeated:
# PROBLEM: Single colon rules disallow repeating targets whizprog.o: foo.h $(CC) -c $(CFLAGS) whizprog.o @echo built for foo.h whizprog.o: bar.h $(CC) -c $(CFLAGS) whizprog.o @echo built for bar.h
In such a case, the last set of rules is used and make issues a diagnostic. However, double-colon rules treat the dependencies separately, running each ...