-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (78 loc) · 1.92 KB
/
Copy pathMakefile
File metadata and controls
95 lines (78 loc) · 1.92 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
.SILENT:
# Colors
RESET = \033[0m
GREEN = \033[32m
YELLOW = \033[33m
BLUE = \033[34m
RED = \033[31m
# Variables
NAME = irc
# Flags
CXX = c++
CXXFLAGS = -Wall -Wextra -Werror -Isrcs/server/includes -std=c++98 -g
LDFLAGS =
# Paths
SERVER = srcs/server/
CLIENT = srcs/client/
CHANNEL = srcs/channel/
CMD = srcs/commands/
BUILD_DIR = build/
SRCS = srcs/main.cpp \
$(SERVER)Server.cpp \
$(SERVER)serverToClients.cpp \
$(SERVER)serverToChannels.cpp \
$(SERVER)serverOutput.cpp \
$(SERVER)serverGetters.cpp \
$(SERVER)serverMethods.cpp \
$(SERVER)serverUtils.cpp \
$(CLIENT)Client.cpp \
$(CLIENT)clientSetters.cpp \
$(CLIENT)clientGetters.cpp \
$(CLIENT)clientMethods.cpp \
$(CHANNEL)Channel.cpp \
$(CHANNEL)channelGetters.cpp \
$(CHANNEL)channelSetters.cpp \
$(CHANNEL)channelMethods.cpp \
$(CMD)cmdParser.cpp \
$(CMD)Commands.cpp \
OBJS = $(SRCS:%.cpp=$(BUILD_DIR)%.o)
INCLUDES = -I./includes
# Rules
all: $(NAME)
$(NAME): $(OBJS)
@echo
@echo "$(YELLOW) [Linking ]$(RESET) Creating executable: $(NAME)"
$(CXX) $(CXXFLAGS) $(OBJS) -o $(NAME) $(LDFLAGS)
@echo
@echo "$(GREEN) [Built ] $(NAME)$(RESET) is ready !"
@echo
$(BUILD_DIR)%.o: %.cpp
@mkdir -p $(dir $@)
@echo "$(BLUE) [Compiling]$(RESET) $<"
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@
clean:
clear
@echo
@echo "$(RED) [Cleaning ]$(RESET) Removing object files"
rm -rf $(BUILD_DIR)
fclean: clean
@echo "$(RED) [Cleaning ]$(RESET) Removing executable: $(NAME)"
@echo
rm -f $(NAME)
re: fclean all
run: re
@echo "$(YELLOW) [Running ]$(RESET) Executing $(NAME) on port 6667"
@echo
./$(NAME) 6667
make fclean
pass: re
@echo "$(YELLOW) [Running ]$(RESET) Executing $(NAME) on port 6667"
@echo
./$(NAME) 6667 mdp
make fclean
valgrind: re
@echo "$(YELLOW) [Valgrind]$(RESET) Running memory analysis with Valgrind"
valgrind --leak-check=full ./$(NAME) 6667
make fclean
# Special rules
.PHONY: all clean fclean re run valgrind