forked from mtravez/Webserv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (38 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
NAME = webserv
INCDIR = include
SRCDIR = src
SUBDIRNAMES = server request response utils config
SUBDIRS = $(foreach name, $(SUBDIRNAMES), $(SRCDIR)/$(name))
BUILDDIR = ./build
CP = c++
CPPFLAGS = -Werror -Wextra -Wall -std=c++98 -MMD -MP -g -fsanitize=address -D ULIMIT_N=$(shell ulimit -n)
INCFLAGS = -I $(INCDIR)
INCS = $(wildcard $(INCDIR)/*.hpp)
SRCS := $(SRCDIR)/main.cpp \
$(foreach dir, $(SUBDIRNAMES), $(wildcard $(SRCDIR)/$(dir)/*.cpp))
OBJS = $(addprefix $(BUILDDIR)/, $(SRCS:.cpp=.o))
DEPS = $(OBJS:.o=.d)
PINK = \033[1;95m
GREEN = \033[1;92m
RED = \033[0;31m
RESET = \033[0m
COMP = compiler
$(NAME): $(OBJS)
@$(CP) $(CPPFLAGS) $(INCFLAGS) $(OBJS) -o $(NAME)
@echo "$(GREEN)Compiled successfully!$(RESET)"
-include $(DEPS)
# $(COMP):
# @printf "$(RED)Compiling."
$(BUILDDIR)/%.o: %.cpp
@$(shell if [ ! -d "$(@D)" ]; then mkdir -p $(@D); fi)
@$(CP) $(CPPFLAGS) $(INCFLAGS) -c $< -o $@
# @printf "."
all: $(NAME)
clean:
@/bin/rm -rf $(BUILDDIR)
@echo "$(PINK)clean successful!$(RESET)"
fclean: clean
@/bin/rm -f $(NAME)
@echo "$(PINK)fclean successful!$(RESET)"
re: fclean all
.PHONY: all clean fclean re