-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
40 lines (30 loc) · 865 Bytes
/
Makefile
File metadata and controls
40 lines (30 loc) · 865 Bytes
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
# Variables
CPPC = g++
CFLAGS = -Wall
DFLAGS = -Wall -g3
VFLAGS = --tool=memcheck --leak-check=full --track-origins=yes --gen-suppressions=yes
# Server variables
SERVER_SRC = $(shell find src/server/ -name '*.cpp')
SERVER_BIN = server
# Client variables
CLIENT_SRC = $(shell find src/client/ -name '*.cpp')
CLIENT_BIN = client
# General rules
all: build_server build_client
build_server: $(SERVER_SRC)
$(CPPC) -o $(SERVER_BIN) $(CFLAGS) $^
build_client: $(CLIENT_SRC)
$(CPPC) -o $(CLIENT_BIN) $(CFLAGS) $^
run_server: build_server
./$(SERVER_BIN)
run_client: build_client
./$(CLIENT_BIN)
clean:
rm -rf $(SERVER_BIN) $(CLIENT_BIN)
# Custom rules
debug_server: $(SERVER_SRC)
$(CPPC) -o $(SERVER_BIN) $(DFLAGS) $^
valgrind $(VFLAGS) ./$(SERVER_BIN)
debug_client: $(CLIENT_SRC)
$(CPPC) -o $(CLIENT_BIN) $(DFLAGS) $^
valgrind $(VFLAGS) ./$(CLIENT_BIN)