-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (57 loc) · 1.68 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jschott <jschott@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/10/09 10:31:55 by jschott #+# #+# #
# Updated: 2024/02/20 16:08:29 by jschott ### ########.fr #
# #
# **************************************************************************** #
NAME = webserv
# SOURCES
SRC_PATH = srcs/
SRC_FILES = ReadConfig.cpp \
ServerConfig.cpp \
LocationConfig.cpp \
Server.cpp Request.cpp \
RequestHandling.cpp \
LocationRequest.cpp \
utils.cpp \
main.cpp
SRCS := $(addprefix $(SRC_PATH), $(SRC_FILES))
# PATHS
OBJ_PATH = obj/
OBJS = $(addprefix $(OBJ_PATH), $(SRC_FILES:.cpp=.o))
# INCLUDES
INCL_PATH = include/
HDRS = ReadConfig.hpp \
ServerConfig.hpp \
LocationConfig.hpp \
Request.hpp \
Server.hpp
INCLDS := $(addprefix $(INCL_PATH), $(HDRS))
# COMPILATION CMNDS
CC = c++
FT_FLAGS = -Wall -Wextra -Werror -std=c++98 -g #-fsanitize=address
INCLUDES = -I $(INCL_PATH)
all: $(NAME)
@echo "\n\nCompilation finished successfully\nHave fun breaking things\n"
$(NAME): $(OBJS)
@echo "\n\nCompiling Executable\n"
$(CC) $(FT_FLAGS) $(INCLUDES) -o $(NAME) $(OBJS)
@echo "\nExecutable compiled\n\n"
${OBJ_PATH}:
@if [ ! -d "${OBJ_PATH}" ]; \
then mkdir -p "${OBJ_PATH}"; \
fi
$(OBJ_PATH)%.o: $(SRC_PATH)%.cpp $(INCLDS)
@mkdir -p $(dir $@)
$(CC) $(FT_FLAGS) $(INCLUDES) -c $< -o $@
clean:
@rm -f $(OBJS)
fclean: clean
rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re