This repository was archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (61 loc) · 2.35 KB
/
Makefile
File metadata and controls
79 lines (61 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
CXX=g++ -std=c++17
LIBs=-lncursesw
INC=-I./include
SRC=./src
OBJ=./obj
OBJs=$(OBJ)/GameManager.o $(OBJ)/graphics.o $(OBJ)/Board.o $(OBJ)/PlayerPane.o $(OBJ)/Player.o
TESTSRC=./src/test
TESTSRCs=$(TESTSRC)/Board.cpp $(TESTSRC)/Game.cpp $(TESTSRC)/GameManager.cpp $(TESTSRC)/Position.cpp
TESTHDR=./include/test
TESTOBJs=testobj/Board.o testobj/Game.o testobj/GameManager.o testobj/Position.o
GTEST_DIR=./googletest/googletest
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
$(GTEST_DIR)/include/gtest/internal/*.h
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
CXXFLAGS += -pthread
CPPFLAGS += -isystem $(GTEST_DIR)/include
all: directory main
test: testdir mktest
directory:
mkdir -p obj
testdir:
mkdir -p testobj
clean:
rm main obj/*.o
cleantest:
rm testobj/* test
$(OBJ)/GameManager.o: $(SRC)/GameManager.cc
$(CXX) $(INC) -c $(SRC)/GameManager.cc -o $(OBJ)/GameManager.o $(LIBs)
$(OBJ)/graphics.o: $(SRC)/graphics.cc
$(CXX) $(INC) -c $(SRC)/graphics.cc -o $(OBJ)/graphics.o $(LIBs)
$(OBJ)/Board.o: $(SRC)/Board.cc
$(CXX) $(INC) -c $(SRC)/Board.cc -o $(OBJ)/Board.o $(LIBs)
$(OBJ)/PlayerPane.o: $(SRC)/PlayerPane.cc
$(CXX) $(INC) -c $(SRC)/PlayerPane.cc -o $(OBJ)/PlayerPane.o $(LIBs)
$(OBJ)/Player.o: $(SRC)/Player.cc
$(CXX) $(INC) -c $(SRC)/Player.cc -o $(OBJ)/Player.o $(LIBs)
main: $(SRC)/main.cc $(OBJs)
$(CXX) $(INC) -o $@ $^ $(LIBs)
testobj/gtest-all.o : $(GTEST_SRCS_)
g++ $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
$(GTEST_DIR)/src/gtest-all.cc -o $@
testobj/gtest_main.o : $(GTEST_SRCS_)
g++ $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
$(GTEST_DIR)/src/gtest_main.cc -o $@
testobj/gtest.a : testobj/gtest-all.o
$(AR) $(ARFLAGS) $@ $^ -o $@
testobj/gtest_main.a : testobj/gtest-all.o testobj/gtest_main.o
$(AR) $(ARFLAGS) $@ $^ -o $@
testobj/test.o: $(TESTSRC)/test.cpp $(GTEST_HEADERS) $(TESTSRCs)
g++ $(CPPFLAGS) $(INC) $(CXXFLAGS) -std=c++17 -c $(TESTSRC)/test.cpp -o $@
testobj/Board.o: $(TESTSRC)/Board.cpp
$(CXX) $(INC) -c $^ -o $@
testobj/Game.o: $(TESTSRC)/Game.cpp
$(CXX) $(INC) -c $^ -o $@
testobj/GameManager.o: $(TESTSRC)/GameManager.cpp
$(CXX) $(INC) -c $^ -o $@
testobj/Position.o: $(TESTSRC)/Position.cpp
$(CXX) $(INC) -c $^ -o $@
mktest: testobj/test.o testobj/gtest_main.a $(TESTOBJs)
g++ $(CPPFLAGS) $(CXXFLAGS) -std=c++17 $^ -o test
.PHONY: all directory testdir clean cleantest