-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (41 loc) · 1.66 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: mnouchet <mnouchet@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/01/06 22:19:57 by mnouchet #+# #+# #
# Updated: 2023/06/19 00:56:12 by mnouchet ### ########.fr #
# #
# **************************************************************************** #
NAME := ircserv
SRC_DIR := src
INC_DIR := include
BUILD_DIR := .build
BONUS_DIR := bot
SRCS := $(shell find $(SRC_DIR) -type f -name '*.cpp')
OBJS := $(SRCS:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o)
CXX := c++
CFLAGS := -g3 -Wall -Wextra -Werror -std=c++98 -I$(INC_DIR)
RM := rm -f
MAKEFLAGS += --silent --no-print-directory
DIR_DUP = mkdir -p $(@D)
all: $(NAME)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
echo "→ Compiling $<"
$(DIR_DUP)
$(CXX) $(CFLAGS) -c $< -o $@
$(NAME): $(OBJS)
$(CXX) $(CFLAGS) $(OBJS) -o $(NAME)
echo "\033[0;32m✓ Compiled $@ successfully\033[0m"
bonus:
$(MAKE) -C $(BONUS_DIR)
clean:
echo "→ Removing objects"
$(RM) -r $(BUILD_DIR)
fclean: clean
echo "→ Removing binaries"
$(RM) $(NAME)
re: clean all
.PHONY: all bonus clean fclean re