-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
74 lines (55 loc) · 1.4 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
72
73
74
NAME = webserv
UNAME = $(shell uname -s)
CC = c++
CFLAGS = -Wall -Wextra -Werror -std=c++98
RM = rm -f
SRC_NAME = ./src/main.cpp \
./src/network/Server-network.cpp \
./src/server/Server.cpp \
./src/server/RequestHandler.cpp \
./src/server/HttpRequest.cpp \
./src/server/HttpResponse.cpp \
./src/server/ErrorResponse.cpp \
./src/server/Context.cpp \
./src/server/StaticFileHandler.cpp \
./src/util/Config.cpp \
./src/util/Location.cpp \
./src/util/Util.cpp
# SRC_NAME = $(shell find ./src -iname "*.cpp")
OBJ_NAME = $(SRC_NAME:.cpp=.o)
HEADERS = -I ./include
# Colors
GREEN = \033[32m
YELLOW = \033[33m
RESET = \033[0m
# Main commands
all: $(NAME)
clean:
@echo "$(YELLOW)Cleaning up...$(RESET)"
@$(RM) $(OBJ_NAME)
@echo "$(GREEN)Done.$(RESET)"
fclean: clean
@$(RM) $(NAME)
@rm -rf $(NAME).dSYM
re: fclean all
# Sub commands
%.o: %.cpp
@$(CC) $(CFLAGS) -c $< -o $@ $(HEADERS)
dev:
@echo "$(YELLOW)Building $@...$(RESET)"
$(CC) $(CFLAGS) -g3 -o $(NAME) $(SRC_NAME) $(HEADERS)
@echo "$(GREEN)Done.$(RESET)"
$(NAME): $(OBJ_NAME)
@echo "$(YELLOW)Building $@...$(RESET)"
@$(CC) $(CFLAGS) -o $(NAME) $(OBJ_NAME)
@echo "$(GREEN)Done.$(RESET)"
# Custom commands
show:
@printf "UNAME : $(UNAME)\n"
@printf "NAME : $(NAME)\n"
@printf "CC : $(CC)\n"
@printf "CFLAGS : $(CFLAGS)\n"
@printf "SRC : $(SRC_NAME)\n"
@printf "OBJ : $(OBJ_NAME)\n"
# Phony
.PHONY: all clean fclean re