-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
47 lines (37 loc) · 974 Bytes
/
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
NAME = webserv
RM = rm -rf
CXX = g++
CXXFLAGS = -Wall -Wextra -Werror -std=c++98 -pedantic-errors -g
INC_DIR = ./includes
SRC_DIR = ./src
OBJ_DIR = ./obj
SRCS = $(addprefix $(SRC_DIR)/, \
main.cpp WebServer.cpp \
0-config/ParserConfig.cpp \
0-config/Utils.cpp \
0-config/Request.cpp \
0-config/Response.cpp \
0-config/Poll.cpp \
1-models/Autoindex.cpp \
1-models/Server.cpp \
1-models/ServerLocation.cpp \
1-models/Socket.cpp \
1-models/CgiHandler.cpp \
1-models/TypeHelper.cpp \
)
OBJS = $(SRCS:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
DEPS = $(OBJS:.o=.d)
INC_DIRS = $(shell find $(INC_DIR) -type d)
INC_FLAGS = $(addprefix -I,$(INC_DIRS))
all: $(NAME)
$(NAME): $(OBJS)
$(CXX) $(CXXFLAGS) $(INC_FLAGS) $^ -o $@
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) $(INC_FLAGS) -c $< -o $@
clean:
$(RM) $(OBJ_DIR)
fclean: clean
$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re