]>
Commit | Line | Data |
---|---|---|
e86755d7 SW |
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) | |
59e5eb6e | 20 | for t in $(TESTS); do if ! ./$$t; then exit 1; fi ;done |
e86755d7 SW |
21 | |
22 | clean: | |
b778703f | 23 | rm -f *.o $(MAIN) $(TESTS) Makefile.bak |
e86755d7 SW |
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 |