CC = gcc CFLAGS = -std=c11 -Wall -g TARGETS = 01-typedef 02-fnPtr 03-enum 06-maxTyped ALLTARGETS = ${TARGETS} 04-max 05-externalDef all: ${ALLTARGETS} # generic build rule ${TARGETS}: % : %.c -${CC} ${CFLAGS} $@.c -o $@ # a special case so we can generate preprocessor output file 04-max: 04-max.c 04-max.h ${CC} ${CFLAGS} 04-max.c -o 04-max cpp 04-max.c >04-max.preproc echo created preprocessor output file 04-max.preproc 05-externalDef: 05-externalDef.c @echo "\nFirst compile without defining VALUE" -${CC} ${CFLAGS} 05-externalDef.c -o 05-externalDef @echo "\nNow defining VALUE as part of the compile command" ${CC} ${CFLAGS} -DVALUE=25 05-externalDef.c -o 05-externalDef clean: rm -f *~ *.o *.preproc ${ALLTARGETS}