CC=g++ CFLAGS=-g -Wall GOBJS=matrix.o affine.o default: affine affine: $(GOBJS) $(CC) -o affine $(GOBJS) # list of file dependencies affine.o: matrix.h affine.cpp # the following rule is used to compile .cpp files to .o .cpp.o: $(CC) $(CFLAGS) -c $< # the following removes all .o files, but leaves the executable clean: rm -f affine.o affine