-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (68 loc) · 2.56 KB
/
Copy pathMakefile
File metadata and controls
84 lines (68 loc) · 2.56 KB
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
# ======================================================================
# Root Makefile: Builds all three subprojects in the correct order.
# Usage:
# make build everything
# make init runs bear -- make on every subfolder to prepare intellisense
# make tetris build corestack + tetris only
# make bomberman build corestack + bomberman only
# make test run all tests across all projects
# make clean wipe all build artifacts
# make distclean wipe everything including dependencies downloaded
# make run-server [tetris|bomberman] launch that project's server
# make run-client [tetris|bomberman] launch that project's client
# ======================================================================
.PHONY: all corestack tetris bomberman test clean distclean lint gen-auth run-server run-client
all: corestack tetris bomberman
# Generates auth/private_key.pem + auth/server_signed.crt (self-signed, local
# dev only) if they don't already exist. bombd won't start without these.
gen-auth:
./scripts/generate_auth.sh
init:
$(MAKE) -C corestack init
$(MAKE) -C tetris init
$(MAKE) -C bomberman init
# `tetris`/`bomberman` double as the game name passed to run-server/run-client
# (eg `make run-server bomberman`) - when used that way, don't also run their
# normal build recipe (which forces a full clean+rebuild via corestack)
ifeq (,$(filter run-server run-client,$(MAKECMDGOALS)))
corestack: clean
$(MAKE) -C corestack
tetris: corestack
$(MAKE) -C tetris
bomberman: corestack
$(MAKE) -C bomberman
else
tetris bomberman: ;
endif
GAME := $(filter tetris bomberman,$(MAKECMDGOALS))
run-server:
@if [ -z "$(GAME)" ]; then echo "Usage: make run-server [tetris|bomberman]"; exit 1; fi
$(MAKE) -C $(GAME) run-server
run-client:
@if [ -z "$(GAME)" ]; then echo "Usage: make run-client [tetris|bomberman]"; exit 1; fi
$(MAKE) -C $(GAME) run-client
# Runs all tests across all 3 projects
test: all
$(MAKE) -C corestack test
$(MAKE) -C tetris test
$(MAKE) -C bomberman test
# Remove all compiled output
clean:
$(MAKE) -C corestack clean
$(MAKE) -C tetris clean
$(MAKE) -C bomberman clean
# Also remove dependencies (eg: raylib build)
distclean: clean
$(MAKE) -C bomberman distclean
# Run clang-format (spacing & brackets) on all source files
format:
${MAKE} -C corestack format
${MAKE} -C tetris format
${MAKE} -C bomberman format
# Fix variable naming via clang-tidy,
# then running clang-format to fix layout (spacing & brackets)
# tidy > format as renames can change line lengths
lint:
${MAKE} -C corestack lint
${MAKE} -C tetris lint
${MAKE} -C bomberman lint