-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (65 loc) · 2.12 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: btenzlin <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2022/09/13 12:21:11 by btenzlin #+# #+# #
# Updated: 2022/11/28 19:17:00 by btenzlin ### ########.fr #
# #
# **************************************************************************** #
VPATH = src .
CXXFLAGS = -Wall -Wextra -Werror -std=c++98
# COLORS
Y = "\033[33m"
R = "\033[31m"
G = "\033[32m"
B = "\033[34m"
X = "\033[0m"
UP = "\033[A"
CUT = "\033[K"
# EXECUTABLE
NAME = ./ircserv
# PATHS
OBJ_PATH = ./.obj/
# SOURCES
SRC = main.cpp init_server.cpp utils.cpp loop_requests.cpp handle_cmds.cpp \
user.cpp debug.cpp commands.cpp
# OBJECTS
OBJ :=$(addprefix $(OBJ_PATH), $(SRC:.cpp=.o))
# INCLUDES
INC = -I ./include
# RULES
all: $(NAME)
$(NAME): $(OBJ)
@echo $(Y)Compiling [$(OBJ)]
@echo into [$(NAME)]...$(X)
@$(CXX) $(CXXFLAGS) $^ $(INC) -o $(NAME)
@printf $(UP)$(CUT)
@printf $(UP)$(CUT)
@printf $(UP)$(CUT)
@echo $(G)Finished [$(NAME)]$(X)
$(OBJ_PATH)%.o: %.cpp
@echo $(Y)Compiling [$@]...$(X)
@mkdir -p .obj
@$(CXX) $(CXXFLAGS) -MMD -MP -c $< $(INC) -o $@
@echo $(G)Finished [$@]$(X)
@printf $(UP)$(CUT)
@printf $(UP)$(CUT)
clean:
@if [ -d "$(OBJ_PATH)" ]; then \
rm -f -r $(OBJ_PATH); \
echo $(R)Cleaning" "[$(OBJ) $(OBJ_PATH)]...$(X); else \
echo "No objects to remove."; \
fi;
fclean: clean
@if [ -f "$(NAME)" ]; then \
rm -f $(NAME); \
echo $(R)Cleaning" "[$(NAME)]...$(X);else \
echo "No executable to remove."; \
fi;
re: fclean all
# ADDITIONAL RULES
.PHONY: all clean fclean re
-include $(OBJ:.o=.d)