-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (48 loc) · 1.07 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
NAME = ircserv
PORT = 6667
PASS = password
CXX = c++
CXXFLAGS = -Wall -Wextra -Werror -std=c++98 -pedantic
RM = rm -rf
SRC_DIR = src
SRCS = $(wildcard $(SRC_DIR)/*.cpp)
INC = include
OBJ_DIR = obj
OBJS = $(SRCS:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
FORMAT = clang-format -i
CNAME = client
CSRC = client.cpp
all: $(NAME)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(@D)
$(FORMAT) $<
@if [ -f $(INC)/$*.hpp ]; then \
$(FORMAT) $(INC)/$*.hpp; \
echo "$(FORMAT) $(INC)/$*.hpp"; \
fi
$(CXX) $(CXXFLAGS) -c $< -o $@ -I $(INC)
$(NAME): $(OBJS)
$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJS)
clean:
$(RM) $(OBJS)
$(RM) $(OBJ_DIR)
fclean: clean cclean
$(RM) $(NAME)
re: fclean all
run: all client
./$(NAME) $(PORT) $(PASS)
client:
$(CXX) $(CXXFLAGS) $(CSRC) -o $(CNAME)
cclean:
$(RM) $(CNAME)
format:
$(FORMAT) $(SRCS) $(wildcard $(INC)/*.hpp)
nc:
nc localhost 6667
up:
sudo docker compose up --build -d && docker compose exec irc-dev bash
down:
sudo docker compose down
exec:
sudo docker compose exec irc-dev bash
.PHONY: all fclean clean re run client cclean format up down exec nc