-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (59 loc) · 1.98 KB
/
Copy pathMakefile
File metadata and controls
71 lines (59 loc) · 1.98 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
##
## EPITECH PROJECT, 2024
## Zappy
## File description:
## Makefile
##
include Makefile_colors.mk
SERVER = zappy_server
SERVER_DIR = Server
GUI = zappy_gui
GUI_DIR = Client
AI = zappy_ai
AI_DIR = IA
LIBS = libmyprotocol.a
LIBS_DIR = libs/protocol
OUTS = $(SERVER) $(GUI) $(AI) $(LIBS)
DEPS = $(SERVER_DIR) $(GUI_DIR) $(AI_DIR) $(LIBS_DIR)
DIE = exit 1
ECHO = echo -e
define MAKE_DEPS
@for dep in $^; do \
if [ -f $$dep/Makefile ]; then \
$(ECHO) "${_B_YELLOW}[INFO]${_END} Making $@ in $$dep..."; \
$(MAKE) -sC $$dep $@; \
if [ -f $$dep/$@ ]; then \
mv $$dep/$@ $$dep/../; \
fi \
else \
$(ECHO) "${_B_YELLOW}[WARNING]${_END}" \
"$$dep/Makefile not found, skipping..."; \
fi \
done
endef
all: $(LIBS) $(SERVER) $(GUI) $(AI)
@$(ECHO) "${_B_GREEN}[SUCCESS]${_END} project compiled successfully !"
$(SERVER): $(SERVER_DIR) ; $(MAKE_DEPS)
$(GUI): $(GUI_DIR) ; $(MAKE_DEPS)
$(AI): $(AI_DIR) ; $(MAKE_DEPS)
$(LIBS): $(LIBS_DIR) ; $(MAKE_DEPS)
debug: $(DEPS) ; $(MAKE_DEPS)
@$(ECHO) "${_B_GREEN}[SUCCESS]${_END}" \
"project compiled successfully in debug mode !"
clean: $(DEPS) ; $(MAKE_DEPS)
@$(ECHO) "${_B_GREEN}[SUCCESS]${_END} project cleaned successfully !"
fclean: $(DEPS) ; $(MAKE_DEPS)
rm -f zappy_ai # Remove the symlink during fclean, if necessary
@for out in $(realpath $(join $(addsuffix /../, $(DEPS)), $(OUTS))); do \
if [ -f $$out ]; then \
if [ "$${out##*/}" != "Main.py" ]; then \
$(ECHO) "${_B_YELLOW}[INFO]${_END} Removing $${out##*/}..."; \
rm -f $$out; \
fi; \
fi \
done
tests_run: $(LIBS)
@$(MAKE) -sC $(LIBS_DIR) tests_run
@$(MAKE) -sC $(SERVER_DIR) tests_run
re: fclean all
.PHONY: all $(SERVER) $(GUI) $(AI) $(LIBS) debug clean fclean re