]> git.scottworley.com Git - slidingtile/blob - Makefile
Switch from Go to C++
[slidingtile] / Makefile
1 CXX = g++
2 CXXFLAGS = -std=gnu++11 -Wall -Wextra -pedantic -O2
3 LFLAGS =
4
5 SRCS = sliding_tile.cc sliding_tile_lib.cc
6 MAIN = sliding_tile
7 LIBS =
8 TESTLIBS = -lgtest_main -lgtest -lgmock
9
10 OBJS = $(SRCS:.cc=.o)
11 TEST_SRCS=$(wildcard *_test.cc)
12 TESTS=$(subst .cc,,$(TEST_SRCS))
13
14 .PHONY: depend clean test
15 .INTERMEDIATE: $(OBJS)
16
17 all: $(MAIN) $(TESTS)
18
19 test: $(TESTS)
20 for t in ./*_test; do if ! $$t; then exit 1; fi ;done
21
22 clean:
23 rm -f *.o $(MAIN) $(TESTS)
24
25 $(MAIN): $(OBJS)
26 $(CXX) $(CXXFLAGS) -o $@ $^ $(LFLAGS) $(LIBS)
27
28 %_test: %_test.o %.o
29 $(CXX) $(CXXFLAGS) -o $@ $^ $(LFLAGS) $(LIBS) $(TESTLIBS)
30
31 depend: $(SRCS)
32 makedepend $^
33
34 # DO NOT DELETE THIS LINE -- make depend depends on it.
35
36 sliding_tile.o: sliding_tile_lib.h