CMDS = hello hello_debug hello_opt CC = gcc # Always use -Wall when compiling. Usually, any warning generated by # this option is likely caused by a bug or a bug waiting to happen. # To really enforce this, use the -Werror option, which causes # warnings to be treated like errors, and makes the compile fail. CFLAGS = -Wall all: ${CMDS} # We use the built-in implicit rule for .c files - the "hello" target # is made automatically, using the CFLAGS and CC variables we defined # above. # Turn on some debugging information for use with gdb. hello_debug: hello.c ${CC} ${CFLAGS} -g -o $@ $< # Optimize the program. hello_opt: hello.c ${CC} ${CFLAGS} -O3 -o $@ $< clean: rm -f ${CMDS}