CXX = g++ CXXFLAGS = -std=gnu++11 -Wall -Wextra -pedantic -O2 LFLAGS = SRCS = sliding_tile.cc sliding_tile_lib.cc MAIN = sliding_tile LIBS = TESTLIBS = -lgtest_main -lgtest -lgmock OBJS = $(SRCS:.cc=.o) TEST_SRCS=$(wildcard *_test.cc) TESTS=$(subst .cc,,$(TEST_SRCS)) .PHONY: depend clean test .INTERMEDIATE: $(OBJS) all: $(MAIN) $(TESTS) test: $(TESTS) for t in ./*_test; do if ! $$t; then exit 1; fi ;done clean: rm -f *.o $(MAIN) $(TESTS) Makefile.bak $(MAIN): $(OBJS) $(CXX) $(CXXFLAGS) -o $@ $^ $(LFLAGS) $(LIBS) %_test: %_test.o %.o $(CXX) $(CXXFLAGS) -o $@ $^ $(LFLAGS) $(LIBS) $(TESTLIBS) depend: $(SRCS) makedepend $^ # DO NOT DELETE THIS LINE -- make depend depends on it. sliding_tile.o: sliding_tile_lib.h