-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
100 lines (73 loc) · 3.76 KB
/
makefile
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Points to the root of Google Test, relative to where this file is.
GTEST_DIR = ./src/tests/googletest/googletest
# All Google Test headers.
GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
$(GTEST_DIR)/include/gtest/internal/*.h
DEBUG =
# Flags passed to the preprocessor.
# Set Google Test's header directory as a system directory, such that
# the compiler doesn't generate warnings in Google Test headers.
CPPFLAGS += -isystem $(GTEST_DIR)/include
# Flags passed to the C++ compiler.
CXXFLAGS += -std=c++11 -g $(DEBUG) -Wall -Wextra -pthread
GTEST_SRCS_ = $(GTEST_DIR)/src/*.cc $(GTEST_DIR)/src/*.h $(GTEST_HEADERS)
#---------------MAIN-------------
./build/cell.o: ./src/lib/cell.cpp ./src/lib/cell.h
cd src/lib; \
$(CXX) -c $(CXXFLAGS) cell.cpp -o ../../build/cell.o;
./build/dice.o: ./src/lib/dice.cpp ./src/lib/dice.h
cd src/lib; \
$(CXX) -c $(CXXFLAGS) dice.cpp -o ../../build/dice.o;
./build/white_dice.o: ./src/lib/white_dice.cpp ./src/lib/white_dice.h
cd src/lib; \
$(CXX) -c $(CXXFLAGS) white_dice.cpp -o ../../build/white_dice.o;
./build/red_dice.o: ./src/lib/red_dice.cpp ./src/lib/red_dice.h
cd src/lib; \
$(CXX) -c $(CXXFLAGS) red_dice.cpp -o ../../build/red_dice.o;
./build/yellow_dice.o: ./src/lib/yellow_dice.cpp ./src/lib/yellow_dice.h
cd src/lib; \
$(CXX) -c $(CXXFLAGS) yellow_dice.cpp -o ../../build/yellow_dice.o;
./build/green_dice.o: ./src/lib/green_dice.cpp ./src/lib/green_dice.h
cd src/lib; \
$(CXX) -c $(CXXFLAGS) green_dice.cpp -o ../../build/green_dice.o;
./build/p2d.o: ./src/lib/p2d.cpp ./src/lib/p2d.h
cd src/lib; \
$(CXX) -c $(CXXFLAGS) p2d.cpp -o ../../build/p2d.o;
./build/alea_game.o: ./src/alea_game.cpp ./src/alea_game.h
cd src; \
$(CXX) -c $(CXXFLAGS) alea_game.cpp -o ../build/alea_game.o;
./build/search_algorithms.o: ./src/search_algorithms.cpp ./src/search_algorithms.h
cd src; \
$(CXX) -c $(CXXFLAGS) search_algorithms.cpp -o ../build/search_algorithms.o;
level_solver: ./build/p2d.o ./build/cell.o ./build/dice.o ./build/white_dice.o ./build/red_dice.o ./build/yellow_dice.o ./build/green_dice.o ./build/alea_game.o ./build/search_algorithms.o
cd src; \
$(CXX) $(CXXFLAGS) level_solver.cpp -o level_solver ../build/p2d.o ../build/cell.o ../build/dice.o ../build/white_dice.o ../build/red_dice.o ../build/yellow_dice.o ../build/green_dice.o ../build/alea_game.o ../build/search_algorithms.o
#---------------TESTS-------------
gtest-all.o : $(GTEST_SRCS_)
$(CXX) -isystem src/tests/googletest/googletest/include -Isrc/tests/googletest/googletest $(CXXFLAGS) -c src/tests/googletest/googletest/src/gtest-all.cc;
gtest_main.o : $(GTEST_SRCS_)
$(CXX) -isystem src/tests/googletest/googletest/include -Isrc/tests/googletest/googletest $(CXXFLAGS) -c src/tests/googletest/googletest/src/gtest_main.cc;
gtest.a : gtest-all.o
$(AR) $(ARFLAGS) $@ $^; \
mv gtest.a ./src/tests;
gtest_main.a : gtest-all.o gtest_main.o
$(AR) $(ARFLAGS) $@ $^;
./src/tests/tests.o : ./src/tests/tests.cpp ./build/p2d.o ./build/cell.o ./build/dice.o ./build/white_dice.o ./build/red_dice.o ./build/yellow_dice.o ./build/green_dice.o $(GTEST_HEADERS)
cd ./src/tests/; \
$(CXX) -isystem ./googletest/googletest/include $(CXXFLAGS) -c tests.cpp
tests: ./src/tests/tests.o gtest_main.a
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@ ./build/p2d.o ./build/cell.o ./build/dice.o ./build/white_dice.o ./build/red_dice.o ./build/yellow_dice.o ./build/green_dice.o; \
mv gtest-all.o ./src/tests; \
mv gtest_main.o ./src/tests; \
mv gtest_main.a ./src/tests; \
mv tests ./src/tests;
#---------------COMMANDS-------------
all: level_solver
run: level_solver ./src/level_solver
./src/level_solver
run_tests:
./src/tests/tests
clean:
rm -f ./build/*.o ./src/level_solver ./src/tests/tests ./src/tests/*.a ./src/tests/*.o
debug: DEBUG = -DDEBUG
debug: run