-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
84 lines (67 loc) · 2.49 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
NAME := ircserv
BOT_NAME := ircbot.out
CC := c++
FLAGS := -Wall -Wextra -Werror -std=c++98
RM := rm -rf
OBJDIR := ./objects
SRCSDIR := ./src
HEADDIR := ./include
FILES := main network/Server network/Client \
network/Channel \
commands/Server.connection \
commands/Server.command \
commands/Message \
commands/Server.privmsg \
commands/Server.join \
commands/Server.queries \
commands/Server.mode \
commands/Server.channel \
commands/Server.invite \
commands/Server.kick \
commands/Server.topic \
commands/Server.part \
commands/Server.who \
commands/Server.away
BOT_FILE := ./srcbot/bot.cpp
SRC := $(FILES:%=$(SRCSDIR)/%.cpp)
OBJ := $(addprefix $(OBJDIR)/, $(FILES:%=%.o))
DEPS := $(wildcard $(HEADDIR)/*.hpp)
# Colors
YELLOW := \e[1;33m
GREEN := \e[1;32m
BLUE := \e[1;34m
PURPLE := \e[1;35m
UNDER_WHITE:= \e[4;37m
BOLD_WHITE := \e[1;37m
BACK_WHITE := \e[0m
all: $(NAME)
$(NAME): $(OBJ) Makefile
@$(CC) $(OBJ) -o $(NAME) #-fsanitize=address -g
@printf "\nI created the executable. Now you can enter $(YELLOW)./ircserv <port> <password> $(BACK_WHITE)to launch it and have fun.\n"
@printf "\n\n$(BOLD_WHITE)<<<<<<<<<<<<<<<<< Not clear? Follow these steps >>>>>>>>>>>>>>>>$(BACK_WHITE)\n"
@printf "\n$(UNDER_WHITE)Replace <port> with the desired port number on which the IRC server will listen for incoming connections.$(BACK_WHITE)\n"
@printf "\n$(UNDER_WHITE)Replace <password> with the connection password that will be required for clients to connect to your server.$(BACK_WHITE)\n"
@printf "\n$(BLUE)Creating and Joining Channels$(BACK_WHITE)\n"
@printf ".To create a channel, use the command: $(PURPLE)/join #channel_name$(BACK_WHITE)\n"
@printf ".To join an existing channel, use the command: $(PURPLE)/join #channel_name$(BACK_WHITE)\n"
$(OBJDIR)/%.o: $(SRCSDIR)/%.cpp
@mkdir -p $(dir $@)
@$(CC) $(FLAGS) -I $(HEADDIR) -c $< -o $@
$(OBJ): | $(OBJDIR)
$(OBJDIR):
@mkdir -p $(OBJDIR)
$(OBJ): $(DEPS)
bot: $(BOT_NAME)
ircbot.out: $(BOT_FILE)
@printf "Compile bot\n"
@$(CC) $(FLAGS) $(BOT_FILE) -o $(BOT_NAME)
@printf "bot is ready\n"
clean:
@$(RM) $(OBJDIR)
@printf "\nI removed all the object files as you asked\n\n"
fclean: clean
@$(RM) $(NAME)
@$(RM) ircbot.out
@printf "I removed the executable as you asked\n\n"
re: fclean all
.PHONY: all clean fclean re