forked from trsctr/ft_irc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (47 loc) · 1.92 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: atoof <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/04/15 12:27:52 by atoof #+# #+# #
# Updated: 2024/04/15 12:27:52 by atoof ### ########.fr #
# #
# **************************************************************************** #
NAME = ircserv
BOT_NAME = bot_v1
SRC_DIR = src
OBJ_DIR = obj/
BOT_OBJ_DIR = obj/bot/
BOT_DIR = bot_src
CC = c++
CFLAGS = -Wall -Wextra -Werror -std=c++17 #-g -fsanitize=address
RM = rm -rf
HEADERS := $(shell find $(SRC_DIR) -type f -name "*.h")
SRCS := $(shell find $(SRC_DIR) -type f -name "*.cpp")
OBJS := $(SRCS:$(SRC_DIR)/%.cpp=$(OBJ_DIR)%.o)
BOT_HEADERS := $(shell find $(BOT_DIR) -type f -name "*.h")
BOT_SRCS := $(shell find $(BOT_DIR) -type f -name "*.cpp")
BOT_OBJS = $(BOT_SRCS:$(BOT_DIR)/%.cpp=$(BOT_OBJ_DIR)%.o)
ifdef DEBUG
CFLAGS += -g -DDEBUG_MODE
endif
all: $(NAME)
$(NAME): $(OBJS)
$(CC) $(CFLAGS) $^ -o $@
$(OBJ_DIR)%.o: $(SRC_DIR)/%.cpp $(HEADERS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
bot: $(BOT_NAME)
$(BOT_NAME): $(BOT_OBJS)
$(CC) $(CFLAGS) $^ -o $@
$(BOT_OBJ_DIR)%.o: $(BOT_DIR)/%.cpp $(BOT_HEADERS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $< -o $@
clean:
$(RM) $(OBJ_DIR) $(BOT_OBJ_DIR)
fclean: clean
$(RM) $(NAME) $(BOT_NAME)
re: fclean all
.PHONY: all clean fclean re