-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
105 lines (66 loc) · 2.67 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: ysoroko <ysoroko@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/07/09 11:40:59 by ysoroko #+# #+# #
# Updated: 2021/07/09 14:37:04 by ysoroko ### ########.fr #
# #
# **************************************************************************** #
# ------------------------------ Sources ------------------------------
# Files
SERVER = ft_server/ft_server.c
CLIENT = ft_client/ft_client.c
LIBFT = cd libft && make
LIB = libft/libft.a
# Sources and objects
SERVER_SRC = $(SERVER)
SERVER_OBJS = $(SERVER_SRC:.c=.o)
CLIENT_SRC = $(CLIENT)
CLIENT_OBJS = $(CLIENT_SRC:.c=.o)
OBJS = $(CLIENT_OBJS) \
$(SERVER_OBJS)
# ------------------------------ Constant strings ------------------------------
GCC = gcc
FLAGS = -Wall -Wextra -Werror
INCLUDE = -I include
SERVER_NAME = server
CLIENT_NAME = client
NAME = server
# ------------------------------ Colors ------------------------------
BOLD_PURPLE = \033[1;35m
BOLD_CYAN = \033[1;36m
BOLD_YELLOW = \033[1;33m
NO_COLOR = \033[0m
# ------------------------------ Messages ------------------------------
COMP_START = echo "\n🚧 $(BOLD_YELLOW)Make: $(NO_COLOR)Starting the compilation...\n"
SERV_READY = echo "\n📥 Server ready!\n"
CLI_READY = echo "\n📟 Client ready!\n"
CLEANED = echo "\n💧 $(BOLD_YELLOW)Clean: $(NO_COLOR)Removed all the \".o\" files \n"
FCLEANED = echo "\n🧼 $(BOLD_YELLOW)Fclean: $(NO_COLOR)Removed the executables \n"
# ------------------------------ Rules ------------------------------
all: $(NAME)
$(NAME): comp_start ft_server ft_client
comp_start:
@$(COMP_START)
@$(LIBFT)
ft_server: $(SERVER_OBJS)
@$(GCC) $(FLAGS) $(SERVER_OBJS) $(LIB) -o $(SERVER_NAME)
@$(SERV_READY)
ft_client: $(CLIENT_OBJS)
@$(GCC) $(FLAGS) $(CLIENT_OBJS) $(LIB) -o $(CLIENT_NAME)
@$(CLI_READY)
clean:
@rm -rf $(OBJS)
@cd libft && make clean
@$(CLEANED)
fclean: clean
@rm -rf $(SERVER_NAME) $(CLIENT_NAME)
@cd libft && make fclean
@$(FCLEANED)
.c.o:
@${GCC} ${FLAGS} $(INCLUDE) -c $< -o ${<:.c=.o}
re: fclean all
.PHONY: all minitalk server client clean fclean re libft