Alex Carney

Writing Makefiles

Pattern Rules A pattern rule can be used to define a generic recipe for turning a file of type X into a file a type Y for example, compiling program.c into program.o. A pattern rule can be defined as follows %.o: %.c $(CC) -c $(CFLAGS) $< -o $@ %.o/%.c Will match files of the form *.o and *.c respectively $< can be used to reference all the dependencies of the target, in this case the *. More...