-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (41 loc) · 1.13 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
NAME = webserv
CXX = c++
CXXFLAGS := -Wall -Wextra -Werror -std=c++17
INCLUDE_DIR = include
LDFLAGS :=
SOURCE_DIR = source
SOURCES := main.cpp Defines.cpp HttpServer.cpp HttpServerParser.cpp ServerConfig.cpp Client.cpp Socket.cpp \
Request.cpp Response.cpp Utils.cpp Location.cpp \
Str.cpp Io.cpp Cgi.cpp Cookies.cpp Logger.cpp
OBJ_DIR := obj
OBJECTS := $(addprefix $(OBJ_DIR)/, $(notdir $(SOURCES:.cpp=.o)))
$(shell mkdir -p $(OBJ_DIR))
#NPROCS := $(shell grep -c ^processor /proc/cpuinfo)
NPROCS := 6
target asan_flags: CXXFLAGS += -fsanitize=address,undefined -g
target debug_flags: CXXFLAGS += -gdwarf-4 -fstandalone-debug
all: $(NAME)
bonus: all
$(NAME): $(OBJECTS)
$(CXX) $(LDFLAGS) $(CXXFLAGS) -o $@ $^
#%.o: %.cpp
$(OBJ_DIR)/%.o: $(SOURCE_DIR)/%.cpp
$(CXX) $(CXXFLAGS) -I$(INCLUDE_DIR) -c $< -o $@
clean:
rm -f $(OBJECTS)
fclean: clean
rm -f $(NAME)
re:
@make fclean
@make all -j$(NPROCS)
asan_flags: all
debug_flags: all
debug:
@make fclean
@make debug_flags -j$(NPROCS)
asan:
@make fclean
@make asan_flags -j$(NPROCS)
run: asan
./webserv
.PHONY: all bonus re clean fclean asan asan_flags debug debug_flags run