-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
81 lines (58 loc) · 1.94 KB
/
Makefile
File metadata and controls
81 lines (58 loc) · 1.94 KB
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
# --- Directories ---
SRCDIR := src/
SRCDIR_HANDLEDATA := HandleData/
SRCDIR_HTTP := HTTP/
SRCDIR_PARSING := Parsing/
OBJDIR := build/
HDRDIR := include/
# --- Sources ---
SRC := Server_main.cpp CGI.cpp
SRC_HANDLEDATA := HandleData.cpp Handle_Delete.cpp Handle_Post.cpp Handle_Get.cpp Handle_Request_Checks.cpp Handle_Receive_Data.cpp
SRC_HTTP := HttpResponse.cpp HttpRequest.cpp
SRC_PARSING := ServerConfig.cpp Server_class.cpp Location_class.cpp
SRCS := $(addprefix $(SRCDIR), $(SRC)) $(addprefix $(SRCDIR), $(addprefix $(SRCDIR_HANDLEDATA), $(SRC_HANDLEDATA))) \
$(addprefix $(SRCDIR), $(addprefix $(SRCDIR_HTTP), $(SRC_HTTP))) \
$(addprefix $(SRCDIR), $(addprefix $(SRCDIR_PARSING), $(SRC_PARSING)))
# --- Objects ---
OBJS := $(patsubst $(SRCDIR)%.cpp, $(OBJDIR)%.o, $(SRCS))
# --- Headers ---
HDR := HttpMessage.hpp Location_class.hpp Server_class.hpp ServerConfig.hpp CGI.hpp HandleData.hpp
HDRS := $(addprefix $(HDRDIR), $(HDR))
# --- Compilers ---
CXX := c++
# --- Flags ---
CXXFLAGS := -g3 -Wall -Wextra -Wpedantic -Werror -O3 -std=c++98
debug: CXXFLAGS += -g3 -Og
# --- Utils ---
RM := rm -fr
MKDIR := mkdir -pm 775
# --- Targets ---
NAME := webserv
# --- Rules ---
all: $(NAME)
$(NAME): $(OBJS)
$(CXX) $(CXXFLAGS) $^ -o $@
$(OBJDIR)%.o: $(SRCDIR)%.cpp $(HDRS) | $(OBJDIR)
$(CXX) $(CXXFLAGS) -I$(HDRDIR) -c $< -o $@
$(OBJDIR)HandleData/%.o: $(SRCDIR)HandleData/%.cpp $(HDRS) | $(OBJDIR)HandleData/
$(CXX) $(CXXFLAGS) -I$(HDRDIR) -c $< -o $@
$(OBJDIR)HandleData/:
@$(MKDIR) $@
$(OBJDIR)HTTP/%.o: $(SRCDIR)HTTP/%.cpp $(HDRS) | $(OBJDIR)HTTP/
$(CXX) $(CXXFLAGS) -I$(HDRDIR) -c $< -o $@
$(OBJDIR)HTTP/:
@$(MKDIR) $@
$(OBJDIR)Parsing/%.o: $(SRCDIR)Parsing/%.cpp $(HDRS) | $(OBJDIR)Parsing/
$(CXX) $(CXXFLAGS) -I$(HDRDIR) -c $< -o $@
$(OBJDIR)Parsing/:
@$(MKDIR) $@
$(OBJDIR):
@$(MKDIR) $@
debug: CXXFLAGS += -ggdb3
debug: all
clean:
$(RM) $(OBJDIR)
fclean: clean
$(RM) $(NAME)
re: fclean all
.PHONY: all clean debug fclean re