# Rule for building a .o file from a .cpp source file -------
.SUFFIXES: .cpp
.cpp.o:
	c++ -c $(CXXFLAGS) $<

# Compile with debug option and all warnings on. ------------
CXXFLAGS = -g -Wall 

# Need library librt for clock_gettime()
LDFLAGS = -lrt

# Object modules comprising this application ----------------
OBJ = main.o hrtime.o tester.o tools.o

timetest: $(OBJ)
	c++  -o $@ $(CXXFLAGS) $(OBJ) $(LDFLAGS)

# Delete .o and exe files and force recompilation. ----------
clean:
	rm -f $(OBJ) timetest

# Dependencies ----------------------------------------------
hrtime.o: hrtime.cpp tools.hpp hrtime.hpp
main.o: main.cpp tools.hpp tester.hpp stopwatch.hpp hrtime.hpp
tester.o: tester.cpp tester.hpp stopwatch.hpp tools.hpp hrtime.hpp
tools.o: tools.cpp tools.hpp