-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
62 lines (47 loc) · 1.47 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
#Variables
NAME = ircserv
INCLUDE = include/
SRC_DIR = src/
OBJ_DIR = obj/
CC = c++
CFLAGS = -Wall -Werror -Wextra -std=c++98 -g
AR = ar rcs
# Colors
DEF_COLOR = $(shell tput sgr0)
GRAY = $(shell tput setaf 0)
RED = $(shell tput setaf 1)
GREEN = $(shell tput setaf 2)
YELLOW = $(shell tput setaf 3)
BLUE = $(shell tput setaf 4)
MAGENTA = $(shell tput setaf 5)
CYAN = $(shell tput setaf 6)
WHITE = $(shell tput setaf 7)
#Sources
SRC_FILES = main _aux Server Client Channel bot File fileTransfer \
commands/cap commands/user commands/nick commands/pass commands/join commands/invite commands/kick commands/quit commands/mode commands/topic commands/privmsg commands/part
SRC = $(addprefix $(SRC_DIR), $(addsuffix .cpp, $(SRC_FILES)))
OBJ = $(addprefix $(OBJ_DIR), $(addsuffix .o, $(SRC_FILES)))
OBJF = .cache_exists
###
all: $(NAME)
$(NAME): $(OBJ)
@$(CC) -I./$(INCLUDE) $(CFLAGS) $(OBJ) -o $(NAME)
@echo "$(GREEN)$(NAME) compiled!$(DEF_COLOR)"
$(OBJ_DIR)%.o: $(SRC_DIR)%.cpp | $(OBJF)
@echo "$(YELLOW)Compiling: $< $(DEF_COLOR)"
@$(CC) -I./$(INCLUDE) $(CFLAGS) -c $< -o $@
$(OBJF):
@mkdir -p $(OBJ_DIR) $(OBJ_DIR)/commands
@touch $(OBJF)
clean:
@rm $(OBJF)
@rm -rf $(OBJ_DIR)
@echo "$(BLUE)$(NAME) object files cleaned!$(DEF_COLOR)"
fclean:
@rm $(OBJF)
@rm -rf $(OBJ_DIR)
@rm -f $(NAME)
@echo "$(BLUE)$(NAME) executable cleaned!$(DEF_COLOR)"
re: fclean all
@echo "$(MAGENTA)$(NAME) recompiled!$(DEF_COLOR)"
.PHONY: all clean fclean re