-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
116 lines (89 loc) · 2.46 KB
/
Makefile
File metadata and controls
116 lines (89 loc) · 2.46 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
##
## EPITECH PROJECT, 2024
## Gomoku
## File description:
## Makefile of the project
##
# Flags
NAME = pbrain-gomoku-ai
MAIN = src/main.cpp
SRC = src/Parser/Parser.cpp \
src/Map/Map.cpp \
src/Map/canAlign.cpp \
src/Map/winPatterns.cpp \
src/Map/winLineFour.cpp \
src/Map/winSquare.cpp \
src/Map/winMultipleLineThree.cpp \
src/GameRules/GamesRules.cpp \
src/Algorithms/Algorithm.cpp \
src/Algorithms/miniMax.cpp \
src/Algorithms/evaluation.cpp \
TEST_FILES = complexPattern/test_multipleLineThree.cpp \
easy_win/test_easy_win.cpp \
avoid_lose/test_avoid_loose.cpp \
complexPattern/test_complexPattern.cpp \
complexPattern/test_lineFour.cpp \
complexPattern/test_squarePatern.cpp \
createComplexPattern/test_createComplexPattern.cpp \
# Tests
TEST_NAME = unit_tests
TEST_DIR = ./tests/
TEST = $(addprefix $(TEST_DIR), $(TEST_FILES))
TEST_OBJ = $(TEST:.cpp=.o)
TEST_GCNO = $(SRC:.cpp=.gcno)
TEST_GCDA = $(SRC:.cpp=.gcda)
TEST_FLAGS = -Wall -Wextra -Werror --coverage -lcriterion
# Flags
OBJ = $(SRC:.cpp=.o)
MAIN_OBJ = $(MAIN:.cpp=.o)
INCLUDE = -I./src
CXXFLAGS = -std=c++20 -Wall -Wextra $(INCLUDE) -O3
# Colors
YELLOW = /bin/echo -e "\x1b[33m $1\x1b[0m"
GREEN = /bin/echo -e "\x1b[32m $1\x1b[0m"
CC = g++
%.o: %.cpp
@$(CC) -c $< -o $@ $(CXXFLAGS) && \
$(call YELLOW,"🆗 $<") || \
$(call YELLOW,"❌ $<")
all: $(NAME)
$(NAME): $(OBJ) $(MAIN_OBJ)
@$(CC) $(MAIN_OBJ) $(OBJ) -o $(NAME) $(CXXFLAGS) && \
$(call YELLOW,"✅ $@") || \
$(call YELLOW,"❌ $@")
clean:
rm -f $(MAIN_OBJ) $(OBJ)
@$(call GREEN,"✅ [$@] done !")
- rm output.log
- rm board.log
obj: $(OBJ)
test_obj: $(TEST_OBJ)
fclean: clean tests_clean
@rm -f $(NAME)
@$(call GREEN,"✅ [$@] done !")
tests_clean:
- rm ${TEST_NAME}
- rm -f $(OBJ) $(TEST_OBJ) $(TEST_GCNO) $(TEST_GCDA)
@$(call GREEN,"✅ [$@] done !")
tests_run: fclean
$(MAKE) obj CXXFLAGS+="--coverage $(INCLUDE)"
$(MAKE) test_obj CXXFLAGS="-Wall -Wextra -Werror $(INCLUDE)"
@$(CC) -o $(TEST_NAME) $(OBJ) $(TEST_OBJ) $(TEST_FLAGS) $(INCLUDE)
./$(TEST_NAME)
gcovr --exclude tests/
re: fclean all
IMAGE = epitechcontent/epitest-docker
docker:
sudo docker run -it -v $(shell pwd):/app --workdir /app $(IMAGE)
run: $(NAME)
cp tests/liskvork-bin ./
cp tests/config.ini ./
./liskvork-bin
rm -f liskvork-bin
rm -f config.ini
run-test-against-v1: $(NAME)
cp tests/liskvork-bin ./
cp tests/config-aiv1-run.ini ./config.ini
./liskvork-bin
rm -f liskvork-bin
rm -f config.ini