-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
167 lines (136 loc) · 5.65 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
##
## EPITECH PROJECT, 2019
## PSU_zappy_2018
## File description:
## Makefile
##
SRC_SERV = ./server/src/sockets/client.c \
./server/src/sockets/list_event.c \
./server/src/sockets/write.c \
./server/src/sockets/list_utils.c \
./server/src/sockets/server.c \
./server/src/game/link_map.c \
./server/src/game/random.c \
./server/src/game/win.c \
./server/src/game/map.c \
./server/src/game/incantation.c \
./server/src/events.c \
./server/src/execution.c \
./server/src/utils/array.c \
./server/src/utils/ioutils.c \
./server/src/utils/read.c \
./server/src/utils/strings.c \
./server/src/fct_cli.c \
./server/src/parsing/checking.c \
./server/src/parsing/team_name.c \
./server/src/parsing/arguments.c \
./server/src/parsing/environment.c \
./server/src/parsing/types.c \
./server/src/commands/buffer_cmd/list_fct.c \
./server/src/commands/graphic/list.c \
./server/src/commands/graphic/get_player_by_id.c \
./server/src/commands/graphic/msz.c \
./server/src/commands/graphic/bct.c \
./server/src/commands/graphic/pin.c \
./server/src/commands/graphic/mct.c \
./server/src/commands/graphic/tna.c \
./server/src/commands/graphic/ppo.c \
./server/src/commands/graphic/plv.c \
./server/src/commands/graphic/sgt.c \
./server/src/commands/graphic/sst.c \
./server/src/commands/graphic/send_all.c \
./server/src/commands/ai/list.c \
./server/src/commands/ai/fork.c \
./server/src/commands/ai/forward.c \
./server/src/commands/ai/broadcast.c \
./server/src/commands/ai/eject.c \
./server/src/commands/ai/inventory.c \
./server/src/commands/ai/left.c \
./server/src/commands/ai/right.c \
./server/src/commands/ai/settake_parser.c \
./server/src/commands/ai/incant.c \
./server/src/commands/ai/set.c \
./server/src/commands/ai/take.c \
./server/src/commands/ai/geter.c \
./server/src/commands/ai/connect_nbr.c \
./server/src/commands/ai/look.c \
./server/src/teams/check_team_names.c \
./server/src/game/const_dest_game.c \
./server/src/game/direction.c \
./server/src/time_manage.c
SRC_MAIN = ./server/src/main.c \
./server/src/loop.c
SRC_TESTS = ./tests/parsing.c \
./tests/utils.c \
./tests/socket.c \
./tests/events.c \
./tests/broadcast.c \
./tests/game.c \
./tests/refresh.c \
./tests/graphics.c \
./tests/ia.c
SRC_AI = ./ai/src/Main.cpp \
./ai/src/Server.cpp \
./ai/src/Client.cpp \
./ai/src/Application.cpp \
./ai/src/Parser.cpp \
./ai/src/Utils.cpp \
./ai/src/Inventory.cpp \
./ai/src/Tile.cpp \
./ai/src/Message.cpp \
./ai/src/Ia.cpp
INC_DIR = -I ./server/include \
-I ./ai/include
OBJ_SERV = $(SRC_SERV:.c=.o)
OBJ_MAIN = $(SRC_MAIN:.c=.o)
OBJ_AI = $(SRC_AI:.cpp=.o)
CFLAGS += $(INC_DIR) -W -Wall -Wextra
RM = @rm -rf
ECHO = /bin/echo -e
DEFAULT = "\033[00m"
GREEN = "\033[1;32m"
TEAL = "\033[1;37m"
RED = "\033[1;33m"
SANG = "\033[1;31m"
all: zappy_server zappy_ai
titre_server:
@$(ECHO) $(RED)¶ Building server$(TEAL):$(DEFAULT)
titre_ai:
@$(ECHO) $(RED)¶ Building ai$(TEAL):$(DEFAULT)
titre_tests: clean
zappy_server: titre_server $(OBJ_SERV) $(OBJ_MAIN)
@gcc -o zappy_server $(OBJ_SERV) $(OBJ_MAIN) -lm --coverage && $(ECHO) $(GREEN)✓$(TEAL)" BUILD SUCCESS !"$(TEAL) $(DEFAULT) || $(ECHO) $(SANG)✗$(TEAL)" BUILD FAILED !"$(TEAL) $(DEFAULT)
zappy_ai: titre_ai $(OBJ_AI)
@g++ -o zappy_ai $(OBJ_AI) && $(ECHO) $(GREEN)✓$(TEAL)" BUILD SUCCESS !"$(TEAL) $(DEFAULT) || $(ECHO) $(SANG)✗$(TEAL)" BUILD FAILED !"$(TEAL) $(DEFAULT)
clean:
@$(ECHO) $(RED)¶ Cleaning$(TEAL):$(DEFAULT)
@$(ECHO) $(GREEN) " [OK]" $(TEAL)"Clean obj"$(TEAL)
$(RM) $(OBJ_SERV) $(OBJ_AI) $(OBJ_MAIN) tests/Coverage
@($(ECHO) $(GREEN)✓$(TEAL)" CLEAN SUCCESS !"$(TEAL))
@find . -name "*.gcno" -delete > /dev/null
@find . -name "*.gcda" -delete > /dev/null
$(RM) tests/html
$(RM) doc_ia
$(RM) doc_server
fclean: clean
$(RM) zappy_ai zappy_server unit_tests
re: fclean all
tests_run: titre_tests $(OBJ_SERV)
@gcc -o unit_tests $(OBJ_SERV) $(SRC_TESTS) $(CFLAGS) -lm --coverage -lcriterion && $(ECHO) $(GREEN)✓$(TEAL)" BUILD SUCCESS !"$(TEAL) $(DEFAULT) || $(ECHO) $(SANG)✗$(TEAL)" BUILD FAILED !"$(TEAL) $(DEFAULT)
@(./unit_tests)
@(lcov -c -d server --output-file tests/Coverage) > /dev/null
@(mkdir -p tests/html) > /dev/null 2>&1
@(genhtml tests/Coverage --output-directory tests/html/) > /dev/null
@(gcovr --exclude tests/)
@$(ECHO) Open $(GREEN)file://`realpath tests/html/index.html`$(TEAL)$(DEFAULT) to see the whole coverage
documentation:
@$(ECHO) $(RED)¶ Generating documentation$(TEAL):$(DEFAULT)
@(doxygen doxyfile_ia)
@(doxygen doxyfile_server)
@$(ECHO) Open $(GREEN)file://`realpath doc_ia/html/index.html`$(TEAL)$(DEFAULT) to see the ia documentation
@$(ECHO) Open $(GREEN)file://`realpath doc_server/html/index.html`$(TEAL)$(DEFAULT) to see the server documentation
%.o : %.c
@gcc -c -o $@ $^ $(CFLAGS) --coverage && $(ECHO) -n $(GREEN)" [OK] "$(TEAL) || $(ECHO) -n $(SANG)" [NO] "$(TEAL) && $(ECHO) $< | rev | cut -d'/' -f 1 | rev
%.o : %.cpp
@g++ -c -o $@ $^ $(CFLAGS) && $(ECHO) -n $(GREEN)" [OK] "$(TEAL) || $(ECHO) -n $(SANG)" [NO] "$(TEAL) && $(ECHO) $< | rev | cut -d'/' -f 1 | rev
.PHONY: all fclean re clean zappy_ai zappy_server tests_run