]> git.scottworley.com Git - slidingtile/blobdiff - Makefile
Switch from Go to C++
[slidingtile] / Makefile
diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..333a641
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+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)
+
+$(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