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