-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
95 lines (81 loc) · 3.58 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
NAME = webserv
CXXFLAGS = -Wall -Wextra -Werror -std=c++11 -pedantic
INCLUDE = -I ./include
SRC_DIR = src
BUILD_DIR = obj
SRC = main.cpp \
Webserver.cpp \
request/Request.cpp \
request/RequestOCF.cpp \
request/RequestGetters.cpp \
request/RequestSetters.cpp \
request/utils.cpp \
response/Response.cpp \
response/ResponseOCF.cpp \
response/ResponseGetters.cpp \
response/CGI.cpp \
response/deleteUtils.cpp \
response/locationUtils.cpp \
response/utils.cpp \
response/autoindex.cpp \
Socket.cpp \
Connection.cpp \
Server.cpp \
Location.cpp \
parser/parse.cpp \
parser/utils/utils.cpp \
parser/utils/trimUtils.cpp \
parser/utils/checkExit.cpp \
parser/utils/errorExit.cpp \
parser/utils/print.cpp \
parser/blocks/http.cpp \
parser/blocks/server.cpp \
parser/blocks/location.cpp \
parser/blocks/directive.cpp \
parser/blocks/directives/listen.cpp \
parser/blocks/directives/serverName.cpp \
parser/blocks/directives/root.cpp \
parser/blocks/directives/index.cpp \
parser/blocks/directives/autoindex.cpp \
parser/blocks/directives/maxBodySize.cpp \
parser/blocks/directives/errorPage.cpp \
parser/blocks/directives/allow.cpp \
parser/blocks/directives/deny.cpp \
parser/blocks/directives/return.cpp \
parser/blocks/directives/uploadDir.cpp \
parser/blocks/directives/cgi.cpp
OBJ := $(addprefix $(BUILD_DIR)/, $(SRC:.cpp=.o))
SRC := $(addprefix $(SRC_DIR)/, $(SRC))
# COLORS
RED = \x1b[31m
GREEN = \x1b[32m
YELLOW = \x1b[33m
BLUE = \x1b[34m
PINK = \x1b[35m
CYAN = \x1b[36m
RESET = \x1b[0m
BRIGHT = \x1b[1m
all: $(NAME)
$(NAME): $(OBJ)
$(CXX) $(CXXFLAGS) $(INCLUDE) $^ -o $(NAME)
@echo "$(CYAN)██╗ ██╗$(PINK)███████╗$(BLUE)██████╗ $(YELLOW)███████╗$(GREEN)███████╗$(RED)██████╗ $(CYAN)██╗ ██╗$(RESET)"
@echo "$(CYAN)██║ ██║$(PINK)██╔════╝$(BLUE)██╔══██╗$(YELLOW)██╔════╝$(GREEN)██╔════╝$(RED)██╔══██╗$(CYAN)██║ ██║$(RESET)"
@echo "$(CYAN)██║ █╗ ██║$(PINK)█████╗ $(BLUE)██████╔╝$(YELLOW)███████╗$(GREEN)█████╗ $(RED)██████╔╝$(CYAN)██║ ██║$(RESET)"
@echo "$(CYAN)██║███╗██║$(PINK)██╔══╝ $(BLUE)██╔══██╗$(YELLOW)╚════██║$(GREEN)██╔══╝ $(RED)██╔══██╗$(CYAN)╚██╗ ██╔╝$(RESET)"
@echo "$(CYAN)╚███╔███╔╝$(PINK)███████╗$(BLUE)██████╔╝$(YELLOW)███████║$(GREEN)███████╗$(RED)██║ ██║$(CYAN) ╚████╔╝ $(RESET)"
@echo "$(CYAN) ╚══╝╚══╝ $(PINK)╚══════╝$(BLUE)╚═════╝ $(YELLOW)╚══════╝$(GREEN)╚══════╝$(RED)╚═╝ ╚═╝$(CYAN) ╚═══╝ $(RESET)$(BRIGHT)$(GREEN)COMPILED SUCCESFULLY$(RESET)"
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
mkdir -p $(dir $@)
$(CXX) $(INCLUDE) $(CXXFLAGS) -c $^ -o $@
clean:
rm -rf $(BUILD_DIR)
@echo "$(BRIGHT)$(CYAN)W$(PINK)E$(BLUE)B$(YELLOW)S$(GREEN)E$(RED)R$(CYAN)V$(RESET)$(GREEN) CLEANED SUCCESFULLY$(RESET)"
fclean: clean
rm -rf $(NAME)
@echo "$(BRIGHT)$(CYAN)W$(PINK)E$(BLUE)B$(YELLOW)S$(GREEN)E$(RED)R$(CYAN)V$(RESET)$(GREEN) FULLY CLEANED SUCCESFULLY$(RESET)"
re: fclean all
test: all
@bash ./error_tests/test.sh
debug: CXXFLAGS += -g -fsanitize=address
debug: re
.PHONY: all, clean, fclean, re, debug, test