forked from yamkim/webserv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (49 loc) · 1.36 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
TARGET = webserv
WEBSERV_VERSION = 0.1.4
#FILES = $(shell ls main | grep .cpp)
FILES = CGISession.cpp
FILES += ConnectionSocket.cpp
FILES += ErrorHandler.cpp
FILES += FileController.cpp
FILES += HTMLBody.cpp
FILES += HTTPData.cpp
FILES += HTTPHandler.cpp
FILES += HTTPRequestHandler.cpp
FILES += HTTPResponseHandler.cpp
FILES += KernelQueue.cpp
FILES += ListeningSocket.cpp
FILES += NginxConfig.cpp
FILES += NginxParser.cpp
FILES += Parser.cpp
FILES += Socket.cpp
FILES += Timer.cpp
FILES += Utils.cpp
FILES += main.cpp
SOURCE_PATH = ./main/
OBJ_PATH = ./objs/
HEADER = $(SOURCE_PATH)
CPP_CODES = $(addprefix $(SOURCE_PATH), $(FILES))
OBJS = $(subst $(SOURCE_PATH), $(OBJ_PATH), ${CPP_CODES:%.cpp=%.o})
COMPILER = clang++
CFLAGS = -Wall -Wextra -Werror
CFLAGS += -DWEBSERV_VERSION=\"$(WEBSERV_VERSION)\"
GREEN = \033[0;32m
RED = \033[0;31m
YELLOW = \033[0;33m
END = \033[0m
all: $(TARGET)
clean:
@echo "$(RED)Delete Object files...$(END)"
rm -rf $(OBJ_PATH)
fclean: clean
@echo "$(RED)Delete webserv...$(END)"
rm -f $(TARGET)
$(OBJ_PATH)%.o: $(SOURCE_PATH)%.cpp
@echo "$(YELLOW)generate object files ($< -> $@)$(END)" 1> /dev/null
@mkdir -p $(OBJ_PATH)
@$(COMPILER) $(CFLAGS) -I$(HEADER) -c -o $@ $<
$(TARGET): $(OBJS)
@echo "$(YELLOW)webserv(normal) Build$(END)"
@$(COMPILER) $(CFLAGS) $(OBJS) -I$(HEADER) -o $(TARGET)
@echo "$(GREEN)Build Finish!$(END)"
re: fclean all