-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (68 loc) · 3.2 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: aherbin <aherbin@student.42berlin.de> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/02/16 14:26:54 by aherbin #+# #+# #
# Updated: 2024/02/20 16:43:31 by aherbin ### ########.fr #
# #
# **************************************************************************** #
# **************************************************************************** #
# variables #
# **************************************************************************** #
NAME = Minitalk
CC = cc
CCFLAGS = -Wall -Wextra -Werror -g
INCLUDES = -I include/
RM = rm -f
CYAN = \033[0;1;3;36m
GREEN = \033[0;1;32m
RED = \033[0;1;31m
BLUE = \033[0;34m
ECEND = \033[0m
SRC_SRV = src/server.c
SRC_CLIENT = src/client.c
CLIENT = client
SERVER = server
SRC_COMMON = src/common.c
COMMON = common.o
SRC_SRV_BONUS = src_bonus/server_bonus.c
SRC_CLIENT_BONUS = src_bonus/client_bonus.c
SRC_COMMON_BONUS = src_bonus/common_bonus.c
COMMON_BONUS = common_bonus.o
CLIENT_BONUS = client_bonus
SERVER_BONUS = server_bonus
# **************************************************************************** #
# RULES #
# **************************************************************************** #
all: $(NAME)
$(NAME): $(CLIENT) $(SERVER)
$(COMMON): $(SRC_COMMON)
@$(CC) $(CCFLAGS) $(INCLUDES) -o $@ -c $<
@echo "$(GREEN)$@ $(BLUE)successfully compiled"
$(CLIENT): $(SRC_CLIENT) $(COMMON)
@$(CC) $(CCFLAGS) $(INCLUDES) $(SRC_CLIENT) $(COMMON) -o $(CLIENT)
@echo "$(CYAN)$(CLIENT) $(BLUE)successfully created!$(ECEND)"
$(SERVER): $(SRC_SRV) $(COMMON)
@$(CC) $(CCFLAGS) $(INCLUDES) $(SRC_SRV) $(COMMON) -o $(SERVER)
@echo "$(CYAN)$(SERVER) $(BLUE)successfully created!$(ECEND)"
bonus: all $(SERVER_BONUS) $(CLIENT_BONUS)
$(COMMON_BONUS): $(SRC_COMMON_BONUS)
@$(CC) $(CCFLAGS) $(INCLUDES) -o $@ -c $<
@echo "$(GREEN)$@ $(BLUE)successfully compiled"
$(CLIENT_BONUS) : $(SRC_CLIENT_BONUS) $(COMMON_BONUS)
@$(CC) $(CCFLAGS) $(INCLUDES) $(SRC_CLIENT_BONUS) $(COMMON_BONUS) -o $(CLIENT_BONUS)
@echo "$(CYAN)$(CLIENT_BONUS) $(BLUE)successfully created!$(ECEND)"
$(SERVER_BONUS) : $(SRC_SRV_BONUS) $(COMMON_BONUS)
@$(CC) $(CCFLAGS) $(INCLUDES) $(SRC_SRV_BONUS) $(COMMON_BONUS) -o $(SERVER_BONUS)
@echo "$(CYAN)$(SERVER_BONUS) $(BLUE)successfully created!$(ECEND)"
clean:
@$(RM) $(COMMON) $(COMMON_BONUS)
@echo "$(RED)common objs deleted $(ECEND)"
fclean: clean
@$(RM) $(CLIENT) $(SERVER) $(CLIENT_BONUS) $(SERVER_BONUS)
@echo "$(RED)$(NAME) $(BLUE)successfully deleted$(ECEND)"
re: fclean all
.PHONY: all bonus clean fclean re