-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
55 lines (40 loc) · 1.44 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
CURRENT_DIR := $(shell pwd)/
CXX = c++
CXXFLAGS = -Wall -Wextra -Werror -std=c++98 -Iinclude -D PROJECT_PATH=\"$(CURRENT_DIR)\" -D CGI_TIME_LIMIT=10
SRC_DIR = src
BUILD_DIR = build
NAME = webserv
CONDIRS = config/cgi_comm config/sockets config/html_default_error_files config/html_generated_files
APP = www/cgi_scripts/py_login_app/database www/cgi_scripts/py_login_app/sessions www/cgi_scripts/py_login_app/uploads
DEBUG ?= 0
ifeq ($(DEBUG), 1)
CXXFLAGS += -D DEBUG=1
else
CXXFLAGS += -D DEBUG=0
endif
SRCS = src/config/ConfigValidator.cpp src/http/Request.cpp src/network/Sockets.cpp \
src/config/Parser.cpp src/http/Response.cpp src/utils/TrieTree.cpp \
src/config/Tokenizer.cpp src/network/KQueue.cpp src/utils/util.cpp \
src/main.cpp
INC = include/ConfigStructures.hpp include/Parser.hpp include/Sockets.hpp \
include/ConfigValidator.hpp include/Request.hpp include/Tokenizer.hpp \
include/KQueue.hpp include/Response.hpp include/TrieTree.hpp \
OBJS = $(patsubst $(SRC_DIR)/%.cpp, $(BUILD_DIR)/%.o, $(SRCS))
all: mkdir $(NAME)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -c $< -o $@
$(NAME): $(OBJS) $(INC)
$(CXX) $(OBJS) -o $(NAME)
rmdi:
@rm -rf $(CONDIRS)
@rm -rf $(APP)
mkdir:
@mkdir -p $(CONDIRS)
bonus: all
clean:
rm -rf $(BUILD_DIR)
fclean: rmdi clean
rm -rf $(NAME)
re: fclean all
.PHONY: all clean fclean re mkdir