-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
89 lines (68 loc) · 2.23 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
# Colors
BOLD_PURPLE = \033[1;35m
BOLD_CYAN = \033[1;36m
BOLD_YELLOW = \033[1;33m
NO_COLOR = \033[0m
DEF_COLOR = \033[0;39m
GRAY = \033[0;90m
RED = \033[0;91m
GREEN = \033[0;92m
YELLOW = \033[0;93m
BLUE = \033[0;94m
MAGENTA = \033[0;95m
CYAN = \033[0;96m
WHITE = \033[0;97m
#Sources
SERVER = server
CLIENT = client
SRCS = src/
CLIENT_SRCS = ${SRCS}client.c
SERVER_SRCS = ${SRCS}server.c
CLIENT_OBJS = ${SRCS}client.o
SERVER_OBJS = ${SRCS}server.o
CC = gcc
RM = /bin/rm -f
CFLAGS = -Wall -Wextra -Werror
CFLAGS_D = -Wall -Wextra -Werror -g
MYLIB_DIR = lib/mylib
MYLIB = $(MYLIB_DIR)/libftprintf.a
# ------------------------------ Messages ------------------------------
COMP_START = echo "\n🚧 $(BOLD_YELLOW)Make: $(NO_COLOR)Starting the compilation...\n"
SERV_READY = echo "📥 Server ready!\n"
CLI_READY = echo "📟 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"
###
all:
@Make libs
@echo "\n🚧 $(YELLOW)Compiling Server..$(NO_COLOR)"
@Make -s $(SERVER)
@$(SERV_READY)
@echo "\n🚧 $(YELLOW)Compiling Client..$(NO_COLOR)"
@Make -s $(CLIENT)
@$(CLI_READY)
libs:
@echo "\n$(GRAY)➖➖➖➖➖ LIBS ➖➖➖➖➖➖$(NO_COLOR)\n"
@$(MAKE) -C $(MYLIB_DIR)
@echo "\n$(GRAY)➖➖➖➖➖ LIBS DONE ➖➖➖➖➖➖➖➖➖$(NO_COLOR)\n"
$(SERVER): $(SERVER_OBJS) $(MYLIB) Makefile
@echo "🍕 $(WHITE)$(CC) $(CFLAGS) $(SERVER_OBJS) $(MYLIB) -o $(CLIENT)$(DEF_COLOR)"
@$(CC) $(CFLAGS) $(SERVER_OBJS) $(MYLIB) -o $(SERVER)
$(CLIENT): $(CLIENT_OBJS) $(MYLIB) Makefile
@echo "🍕 $(WHITE)$(CC) $(CFLAGS) $(CLIENT_OBJS) $(MYLIB) -o $(CLIENT)$(DEF_COLOR)"
@$(CC) $(CFLAGS) $(CLIENT_OBJS) $(MYLIB) -o $(CLIENT)
$(SRCS)%.o:$(SRCS)%.c
@${CC} ${CFLAGS} -c $< -o $@
@echo "🔧 $(GRAY)${CC} ${CFLAGS} -I./ -c $< -o $@$(DEF_COLOR)"
clean:
@$(MAKE) clean -C $(MYLIB_DIR)
@$(RM) $(SERVER_OBJS) $(CLIENT_OBJS)
@echo "$(MAGENTA)🚽 Cleaned $(SERVER) & $(CLIENT)$(DEF_COLOR)"
fclean: clean
@$(MAKE) fclean -C $(MYLIB_DIR)
@$(RM) $(SERVER) $(CLIENT)
@echo "$(MAGENTA)🚽 Fcleaned $(SERVER) & $(CLIENT)$(DEF_COLOR)"
re: fclean all
bonus:
@$(MAKE) all
.PHONY: all clean fclean re bonus