]> git.scottworley.com Git - slidingtile/blame - Makefile
Use the existing list of tests rather than making a new list with a glob.
[slidingtile] / Makefile
CommitLineData
e86755d7
SW
1CXX = g++
2CXXFLAGS = -std=gnu++11 -Wall -Wextra -pedantic -O2
3LFLAGS =
4
5SRCS = sliding_tile.cc sliding_tile_lib.cc
6MAIN = sliding_tile
7LIBS =
8TESTLIBS = -lgtest_main -lgtest -lgmock
9
10OBJS = $(SRCS:.cc=.o)
11TEST_SRCS=$(wildcard *_test.cc)
12TESTS=$(subst .cc,,$(TEST_SRCS))
13
14.PHONY: depend clean test
15.INTERMEDIATE: $(OBJS)
16
17all: $(MAIN) $(TESTS)
18
19test: $(TESTS)
59e5eb6e 20 for t in $(TESTS); do if ! ./$$t; then exit 1; fi ;done
e86755d7
SW
21
22clean:
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
31depend: $(SRCS)
32 makedepend $^
33
34# DO NOT DELETE THIS LINE -- make depend depends on it.
35
36sliding_tile.o: sliding_tile_lib.h