[prev] [index] [next]

Generic Rules

Can define generic rules based on suffixes:

.SUFFIXES: .c .o .java .pl .sh

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

i.e. to make a .o file from a .c file, use the command ...

Rules for several common languages are built in to make.

Pattern-based rules generalise what suffix rules do.

E.g. implementation of .c.o

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