-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·52 lines (38 loc) · 1.62 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: rapdos-s <rapdos-s@student.42sp.org.br> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/08/04 19:37:28 by rapdos-s #+# #+# #
# Updated: 2023/08/04 19:37:28 by rapdos-s ### ########.fr #
# #
# **************************************************************************** #
NAME = webserv
SRC_DIR = ./sources
BLD_DIR = ./build
HDR_DIR = ./headers $(SRC_DIR)/classes
SRC = $(wildcard $(SRC_DIR)/*.cpp)
OBJ = $(patsubst $(SRC_DIR)/%.cpp,$(BLD_DIR)/%.o,$(SRC))
DEP = $(OBJ:.o=.d)
HDR = $(addprefix -I, $(HDR_DIR))
CXX = c++
DEL = rm -rf
MKDIR = mkdir -p
CXXFLAGS = -Wall -Wextra -Werror -std=c++98
DEPFLAGS = -MMD -MF
all: $(NAME)
$(NAME): $(OBJ)
$(CXX) $(CXXFLAGS) $(HDR) $(OBJ) -o $(NAME)
clean:
$(DEL) $(DEP) $(OBJ) $(BLD_DIR)
fclean: clean
$(DEL) $(NAME)
re: fclean all
$(BLD_DIR)/%.o: $(SRC_DIR)/%.cpp | $(BLD_DIR)
$(CXX) $(CXXFLAGS) $(HDR) -c $< -o $@ $(DEPFLAGS) $(@:.o=.d)
$(BLD_DIR):
$(MKDIR) $(BLD_DIR)
-include $(DEP)
.PHONY: all clean fclean re