-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
79 lines (64 loc) · 1.74 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
75
76
77
78
79
# ************************************************************************** #
# __ __ __ #
# WebServ / // / /__ \ #
# By: skoulen, bphilago, znichola / // /_ __/ / #
# /__ __// __/ #
# Created: 2023/06/01 23:16:37 /_/ /____/ lausanne.ch #
# #
# ************************************************************************** #
NAME = webserv
CC = c++
CFLAGS = -Wall -Wextra
CFLAGS += -Werror
CFLAGS += -std=c++98 -pedantic
ifdef DEBUG
CFLAGS += -g3 -fsanitize=address
else
ifdef DEBUGL
CFLAGS += -g3
endif
endif
ifdef __linux__
LEAKS_CHECK = valgrind
else
LEAKS_CHECK = leaks -atExit --
endif
FILES = main \
utils \
Data \
Server \
Location \
methods \
requestWorker \
handler \
BufferManager \
launchServers \
launchServersUtils \
launchServersCGI \
HTTPRequest HTTPHeaders HTTPResponse \
mimeTypes \
HTTPResponse_reason SuperServer \
cgi \
ClientQueue ClientEvent \
staticPostHandler
OBJS_PATH = objs/
SRCS_PATH = src/
INCS_PATH = $(SRCS_PATH)headers/
SRCS = $(addprefix $(SRCS_PATH), $(addsuffix .cpp, $(FILES)))
OBJS = $(addprefix $(OBJS_PATH), $(addsuffix .o, $(FILES)))
all : $(NAME)
$(OBJS_PATH)%.o: $(SRCS_PATH)%.cpp
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -I$(INCS_PATH) -o $@ $<
$(NAME) : $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $@
clean :
$(RM) $(OBJS)
fclean : clean
$(RM) $(NAME)
re : fclean all
run : all
./$(NAME) $(ARGS)
leaks : re
$(LEAKS_CHECK) ./$(NAME) $(ARGS)
.PHONY: all clean fclean re