CC=g++ CFLAGS=-g -Wall TOBJS=test.o matrixio.o range.o default: test all: test test: $(TOBJS) $(CC) -o test $(TOBJS) # list of file dependencies range.o: matrix.h range.h range.cpp matrixio.o: matrix.h matrixio.cpp test.o: matrix.h test.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 *.o test