-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (53 loc) · 2.42 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jsebasti <jsebasti@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/03/27 18:19:03 by rjobert #+# #+# #
# Updated: 2024/05/31 12:55:41 by jsebasti ### ########.fr #
# #
# **************************************************************************** #
CC = c++
FLAGS = -MMD -std=c++98 -g -fsanitize=address,undefined -g -Wall -Wextra -Werror
NAME = webserv
RM = rm -rf
NPD = --no-print-directory
SRC_DIR = ./srcs/
INC_DIR = ./include/ ./include/Config/
OBJS_PATH = ./OBJS/
SRC_NAME = main.cpp server/Server.cpp http/Request.cpp http/Response.cpp \
server/Location.cpp http/DirectoryListing.cpp Config/LocationConfig.cpp \
Config/serverConfig.cpp Config/Parser.cpp Config/Utils.cpp Config/ParseInit.cpp Config/ParseContent.cpp \
server/Cluster.cpp http/CGI.cpp Signal.cpp
INC_NAME = Server.hpp Location.hpp Requst.hpp Response.hpp colors.h \
LocationConfig.hpp ServerConfig.hpp DirectoryListing.hpp Config/Directives.hpp Config/Parser.hpp \
Config/Utils.hpp Config/ParseContent.hpp Config/Defines.hpp Config/Utils.ipp Config/ParseDirectives.ipp \
Cluster.hpp Signal.hpp
SRC = $(addprefix $(SRC_DIR), $(SRC_NAME))
INCS = $(addprefix $(INC_DIR), $(INC_NAME))
ALL_INC = $(addprefix -I, $(INC_DIR))
OBJS = $(SRC:$(SRC_DIR)%.cpp=$(OBJS_PATH)%.o)
DEPS = $(addprefix $(SRC_DIR), $(SRC_NAME:.cpp=.d))
all: $(OBJS_PATH) $(NAME)
-include $(DEPS)
$(NAME): $(OBJS)
$(CC) $(FLAGS) $(OBJS) $(ALL_INC) -o $(NAME)
$(OBJS_PATH):
mkdir -p $(OBJS_PATH)
# mkdir -p $(OBJS_PATH)/networking
$(OBJS_PATH)%.o: $(SRC_DIR)%.cpp Makefile
@mkdir -p $(dir $@)
$(CC) $(FLAGS) $(ALL_INC) -c $< -o $@
clean:
@$(RM) $(OBJS_PATH)
@echo "$(OBJS_PATH) and company leave 42 🗑"
fclean: clean
@$(RM) $(NAME)
@echo "$(NAME) has been black holed 🕳"
re:
@$(MAKE) fclean $(NPD)
@$(MAKE) $(NPD)
-include $(DEP)
.PHONY: all clean fclean re