-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
135 lines (95 loc) · 3.99 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: twang <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/09/12 12:52:33 by hgeffroy #+# #+# #
# Updated: 2024/01/12 10:19:26 by twang ### ########.fr #
# #
# **************************************************************************** #
include config/print.mk
include config/sources.mk
include config/includes.mk
.SILENT:
#--variables-------------------------------------------------------------------#
NAME = ircserv
DEBUG = no
VALGRIND = no
HGEFFROY = \e]8;;https://profile.intra.42.fr/users/hgeffroy\a\e[34mhgeffroy\e[34m\e]8;;\a
AASCEDU = \e]8;;https://profile.intra.42.fr/users/aascedu\a\e[34maascedu\e[34m\e]8;;\a
TWANG = \e]8;;https://profile.intra.42.fr/users/twang\a\e[34mtwang\e[34m\e]8;;\a
#--includes & libraries--------------------------------------------------------#
INC_DIR = includes/
SRC_DIR = sources/
BOT_DIR = bot/
#--sources & objects-----------------------------------------------------------#
OBJ_DIR = .objs/
#--flags-----------------------------------------------------------------------#
CFLAGS = -Wall -Wextra -g3 -std=c++98 -I $(INC_DIR) -MMD -MP #-Werror
CPP = c++
#--debug flags-----------------------------------------------------------------#
DFLAGS = -fsanitize=address -g3
ifeq ($(DEBUG), yes)
CFLAGS += $(DFLAGS)
endif
#--leaks flags-----------------------------------------------------------------#
LEAKS = valgrind --leak-check=full --show-leak-kinds=all --quiet
#--objects---------------------------------------------------------------------#
OBJECTS = $(addprefix $(OBJ_DIR), $(SOURCES:.cpp=.o))
DEPS = $(addprefix $(OBJ_DIR), $(SOURCES:.cpp=.d))
#--global rules----------------------------------------------------------------#
.DEFAULT_GOAL = all
#--header dependancies check---------------------------------------------------#
-include $(DEPS)
#--compilation rules-----------------------------------------------------------#
all:
$(MAKE) header
$(MAKE) $(NAME) -j
./ircserv 2000 popopo
$(NAME): $(OBJECTS)
$(CPP) $(CFLAGS) $^ -o $@
$(PRINT_CREATING)
$(OBJ_DIR)%.o: %.cpp
mkdir -p $(dir $@)
$(CPP) $(CFLAGS) -c $< -o $@
$(PRINT_COMPILING)
#--libs, debugs & bonus--------------------------------------------------------#
debug:
$(MAKE) re -j DEBUG=yes
leaks:
clear
$(MAKE) -j VALGRIND=yes
$(LEAKS) ./ircserv 2000 popopo
bonus:
$(MAKE) -C $(BOT_DIR)
./bot/bot 2000 popopo $$KEY
#--print header----------------------------------------------------------------#
header:
printf "\n${PURPLE}project:\t${END}${BLUE}ft_irc${END}\n"
printf "${PURPLE}author:\t\t${END}${BLUE}${HGEFFROY}, ${AASCEDU} & ${TWANG}${END}\n"
printf "${PURPLE}leaks mode:\t${END}${BLUE}${VALGRIND}${END}\n"
printf "${PURPLE}debug mode:\t${END}${BLUE}${DEBUG}${END}\n"
printf "${PURPLE}compiler:\t${END}${BLUE}${CPP}${END}\n"
printf "${PURPLE}flags:\t\t${END}${BLUE}${CFLAGS}${END}\n"
printf "${PURPLE}date:\t\t${END}${BLUE}2023/11/25${END}\n"
$(LINE)
#--re, clean & fclean----------------------------------------------------------#
re:
#clear
$(MAKE) fclean
$(MAKE) -j all
clean:
$(MAKE) -C $(BOT_DIR) clean
$(LINE)
$(RM) -rf $(OBJ_DIR)
$(PRINT_CLEAN)
fclean:
#clear
$(MAKE) -C $(BOT_DIR) fclean
$(MAKE) clean
$(RM) $(NAME)
$(PRINT_FCLEAN)
#--PHONY-----------------------------------------------------------------------#
.PHONY: all debug leaks bonus header re clean fclean