-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (58 loc) · 1.24 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
#Name
NAME = ircserv
#Compiler
CC = g++
CFLAGS = -Wall -Werror -Wextra -std=c++98 -ggdb
LIBRARIES =
CFLAG = -c
OFLAG = -o
IFLAG = -I
#Make
MAKE = make -s -C
MAKE_CLEAN = make clean -s -C
MAKE_FCLEAN = make fclean -s -C
#Shell
MKDIR = mkdir -p
CP = cp
RM = rm -rf
#Directories
SOURCES_DIR = ./src
OBJECTS_DIR = ./objs
HEADERS_DIR = ./include
#Files
FILES = main.cpp \
Server.cpp \
Client.cpp \
Channel.cpp \
CommandHandler.cpp \
NickCommand.cpp \
PassCommand.cpp \
UserCommand.cpp \
QuitCommand.cpp \
JoinCommand.cpp \
PrivMsgCommand.cpp \
PartCommand.cpp \
KickCommand.cpp \
PingCommand.cpp \
PongCommand.cpp \
NoticeCommand.cpp \
ModeCommand.cpp
#Srcs
SRCS = $(foreach FILE, $(FILES), $(shell find $(SOURCES_DIR) -name $(FILE)))
#Objs
OBJS = $(patsubst $(SOURCES_DIR)/%, $(OBJECTS_DIR)/%, $(SRCS:.cpp=.o))
$(OBJECTS_DIR)/%.o: $(SOURCES_DIR)/%.cpp
@$(MKDIR) $(@D)
@$(CC) $(CFLAGS) $(IFLAG) $(HEADERS_DIR) $(CFLAG) $(OFLAG) $@ $<
all: $(NAME)
$(NAME): $(OBJS)
@$(CC) $(CFLAGS) $(OBJS) $(LIBRARIES) $(OFLAG) $(NAME)
@echo "Done!"
clean:
@$(RM) $(OBJECTS_DIR)
fclean: clean
@$(RM) $(NAME)
run: re
./$(NAME) 3000 password
re: fclean all clean
.PHONY: all clean fclean re