-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (39 loc) · 1.5 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
## HEADER
HEADER_FILES = Connection.hpp Socket.hpp HTTPReader.hpp IOException.hpp HTTPRequest.hpp CGIResponse.hpp \
CGIResponseGet.hpp CGIResponsePost.hpp CGIResponseDelete.hpp CGIResponseRedirect.hpp HTTPHeader.hpp HTTPException.hpp \
Configuration.hpp URI.hpp URISyntaxException.hpp Tool.hpp CGICall.hpp CGICallBuiltin.hpp \
CGIResponseError.hpp Cookie.hpp Runnable.hpp
HDR = $(addprefix include/, $(HEADER_FILES))
## SOURCES
SRC_DIR = src/
MAIN_SRC = main.cpp Socket.cpp Connection.cpp HTTPReader.cpp IOException.cpp HTTPRequest.cpp CGIResponse.cpp \
CGIResponseGet.cpp CGIResponsePost.cpp CGIResponseDelete.cpp CGIResponseRedirect.cpp HTTPException.cpp HTTPHeader.cpp URI.cpp \
URISyntaxException.cpp Tool.cpp CGICall.cpp CGIResponseError.cpp CGICallBuiltin.cpp Cookie.cpp
CONF_SRC= Configuration.cpp
SRC = $(addprefix src/, $(MAIN)) $(addprefix src/config/, $(CONF_SRC))
## OBJECTS
OBJ_DIR = obj/
CONF_OBJ= $(addprefix obj/config/, $(CONF_SRC))
MAIN_OBJ= $(addprefix obj/, $(MAIN_SRC))
OBJ = $(MAIN_OBJ:.cpp=.o) $(CONF_OBJ:.cpp=.o)
## COMPILER
NAME = webserv
FLAGS = -Wall -Wextra -Werror -pedantic -std=c++98 -Ofast
INC = -Iinclude
## RULES
all : obj/ $(NAME)
obj/ :
mkdir obj/ obj/config
$(NAME) : $(OBJ)
c++ $(FLAGS) $(OBJ) -o $(NAME)
$(OBJ_DIR)%.o: $(SRC_DIR)%.cpp $(HDR)
c++ $(FLAGS) $(INC) -c $< -o $@
run : $(NAME)
./$(NAME) server.conf
re : fclean all
clean :
rm -f $(OBJ)
fclean : clean
rm -f $(NAME)
rm -rf obj/
.PHONY : all clean fclean re run