CC=g++ CFLAGS=-g -Wall EOBJS=testExpand.o matrixio.o ROBJS=testReshape.o matrixio.o default: testExpand all: testExpand testReshape testExpand: $(EOBJS) $(CC) -o testExpand $(EOBJS) testReshape: $(ROBJS) $(CC) -o testReshape $(ROBJS) # list of file dependencies matrixio.o: matrix.h matrixio.cpp testExpand.o: matrix.h testExpand.cpp testReshape.o: matrix.h testReshape.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 testExpand testReshape