-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
138 lines (111 loc) · 5.08 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
136
137
138
#*************************************************************************** #
# #
# ::: :::::::: #
# :+: :+: :+: #
# +:+ +:+ +:+ Makefile v2.1 #
# +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ By: troberts <troberts@student.42.fr> #
# #+# #+# #
# ### ########.fr #
# #
# **************************************************************************** #
# **************************************************************************** #
# VARIABLE REFERENCE #
# **************************************************************************** #
NAME= webserv
CXX= c++
CXXFLAGS= -Wall -Wextra -Werror -g3 -std=c++98 $(DEPFLAGS) $(INCLUDE)
LDFLAGS=
DEPFLAGS= -MMD -MP
INCLUDE = -I$(INCLUDE_DIR)
INCLUDE_DIR= includes/
OBJ_DIR= objs/
SRC_DIR= srcs/
# **************************************************************************** #
# .C & .H FILES #
# **************************************************************************** #
SRC_FILE= Autorization.cpp \
cgi.cpp \
ClientResponse.cpp \
ConfigFile.cpp \
GenerateMethod.cpp \
main.cpp \
processRequest.cpp \
processResponse.cpp \
requestParsing.cpp \
Server.cpp \
StartServers.cpp \
utils.cpp
SRC= $(addprefix $(SRC_DIR), $(SRC_FILE))
OBJ= $(addprefix $(OBJ_DIR), ${SRC_FILE:.cpp=.o})
DEP= $(addprefix $(OBJ_DIR), ${OBJ:.o=.d})
# **************************************************************************** #
# HEADER CONFIG #
# **************************************************************************** #
# # <-- start here | <-- middle # <-- stop here
HEADER_NAME = + Webserv #
COLOR_RED = \033[0;31m
COLOR_GREEN = \033[0;32m
COLOR_YELLOW = \033[0;33m
COLOR_BLUE = \033[0;34m
COLOR_PURPLE = \033[0;35m
COLOR_CYAN = \033[0;36m
COLOR_WHITE = \033[0;37m
COLOR_END = \033[m
HEADER = @echo "${COLOR_CYAN}\
\n/* ************************************************************************** */\
\n/* */\
\n/* ::: :::::::: */\
\n/* :+: :+: :+: */\
\n/* +:+ +:+ +:${HEADER_NAME}*/\
\n/* +\#+ +:+ +\#+ */\
\n/* +\#+\#+\#+\#+\#+ +\#+ <aradice@student.42.fr> */\
\n/* \#+\# \#+\# <rvincent@student.42.fr> */\
\n/* \#\#\# \#\#\#\#\#\#\#\#.fr <troberts@student.42.fr> */\
\n/* */\
\n/* ************************************************************************** */\
\n \
\n${COLOR_END}"
HEADER_VAR = @echo "${COLOR_CYAN}\
\n \
BINARY NAME: $(NAME) \
\n CXX: $(CXX) \
\n CXXFLAGS: $(CXXFLAGS) \
\n LDFLAGS: $(LDFLAGS) \
\n${COLOR_END}"
# **************************************************************************** #
# RULES #
# **************************************************************************** #
all: $(NAME)
$(NAME): FORCE header cgi
$(HEADER_VAR)
@echo -n "${COLOR_YELLOW}Compiling : \n[${COLOR_END}"
@$(MAKE) --no-print-directory --silent $(OBJ)
@echo -n "${COLOR_YELLOW}]\n\n${COLOR_END}"
@echo -n "${COLOR_GREEN}Linking : "
@$(CXX) -o $@ $(OBJ) $(LDFLAGS)
@echo "${COLOR_GREEN}Done. ${COLOR_END}"
FORCE: ;
cgi:
@cc -g3 cgi-bin/test-cgi.c -o cgi-bin/test-cgi
$(OBJ): $(OBJ_DIR)%.o: $(SRC_DIR)%.cpp
@echo -n "${COLOR_YELLOW}#${COLOR_END}"
@mkdir -p $(OBJ_DIR)
@$(CXX) $(CXXFLAGS) -c $< -o $@
header:
$(HEADER)
cleanobj:
@rm -f $(OBJ) $(DEP)
cleanobjdir: cleanobj
@rm -rf $(OBJ_DIR)
clean: header
@echo "${COLOR_RED}Removing objects.${COLOR_END}"
@$(MAKE) --no-print-directory --silent cleanobj
@echo "${COLOR_RED}Removing object directory.${COLOR_END}"
@$(MAKE) --no-print-directory --silent cleanobjdir
fclean: clean
@echo "${COLOR_RED}Removing binary file.${COLOR_END}"
@rm -f $(NAME) $(NAME_BONUS)
re: header fclean all
-include $(OBJ:.o=.d)
.PHONY: all clean fclean re header cleanobj debug FORCE cleanobjdir