-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
71 lines (58 loc) · 1.6 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
################################################################################
# Webserv
SERVER = server
# Compilation parameters
CXX = clang++
CXXFLAGS = -Wall -Werror -Wextra -std=c++98
INC = -Iinclude/
# Source files
SRCDIR = src/
MAIN = main.cpp
SRC = Webserv_connection.cpp \
Webserv_request.cpp \
Webserv_poll.cpp \
Webserv_file.cpp \
socket/Socket.cpp \
socket/Server.cpp \
config/Config.cpp \
config/Location.cpp \
config/parsing_config.cpp \
modules/CGIHandler.cpp \
modules/FileHandler.cpp \
modules/ClientHandler.cpp \
utilities/utilities.cpp \
utilities/generate.cpp \
request/Request.cpp \
request/parsing_mimetypes.cpp \
request/Chunk.cpp \
methods/upload.cpp \
methods/delete.cpp \
methods/post.cpp \
# *.o files
OBJDIR = obj/
OBJ = $(addprefix $(OBJDIR),$(SRC:.cpp=.o))
MAIN_OBJ = $(addprefix $(OBJDIR),$(MAIN:.cpp=.o))
################################################################################
all: $(SERVER)
# Create main executable `server`
$(SERVER): $(OBJDIR) $(OBJ) $(MAIN_OBJ)
$(CXX) $(CXXFLAGS) $(INC) $(MAIN_OBJ) $(OBJ) -o $(SERVER)
# Create an obj/ directory with all the *.o files
$(OBJDIR):
mkdir -p $@
mkdir -p $@config
mkdir -p $@methods
mkdir -p $@modules
mkdir -p $@request
mkdir -p $@socket
mkdir -p $@utilities
# Compile the *.o
$(OBJDIR)%.o: $(SRCDIR)%.cpp
$(CXX) $(CXXFLAGS) $(INC) -c $< -o $@
clean:
rm -rf $(OBJDIR) vgcore*
fclean: clean
rm -rf $(SERVER) a.out*
re: clean fclean all
.PHONY : all clean re
################################################################################