-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
62 lines (46 loc) · 1.5 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
ROOT:=$(shell pwd)
PROJECTS_DIR:=projects
THREADS:=$(shell nproc || echo 4)
BUILD_DIR:=build
GAMES_DIR:=games
D:=.done
.SILENT:
.PHONY: deps configure engine build run clean clean_game copy_test_game include_graph
start: engine
./engine games/game0
test: engine_test
./engine_test
deps: deps$(D)
deps$(D):
./scripts/deps.sh
touch deps$(D)
build: engine
configure: deps$(D)
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) && cmake ..
# cmake -S . -B $(BUILD_DIR)
# Cache for configure, if $(BUILD_DIR)$(D) is used as dependency then it won't run if $(BUILD_DIR)$(D) has been made
$(BUILD_DIR)$(D): configure
touch $(BUILD_DIR)$(D)
engine: $(BUILD_DIR)$(D)
echo "Building using ${THREADS} parallel jobs";
cd build && make engine -j$(THREADS)
# cmake -B $(BUILD_DIR) --target engine -- -j$(THREADS)
engine_test: $(BUILD_DIR)$(D)
echo "Building using ${THREADS} parallel jobs";
cd build && make engine_test -j$(THREADS)
clean:
rm -rf $(BUILD_DIR) built $(wildcard *$(D)) lib
rm -f engine engine_test CMakeCache.txt
clean_game:
# find . \( -type f -name '&*' -or -type f -name '$*$' \) -exec rm -v {} \;
# find games -iname "*.meta" -o -iname "*.scene" -o -iname "*.prgm" -o -iname "*.json" -delete
find ${GAMES_DIR} -iname "*.meta" -delete
find ${GAMES_DIR} -iname "*.scene" -delete
find ${GAMES_DIR} -iname "*.prgm" -delete
find ${GAMES_DIR} -iname "*.json" -delete
copy_test_game:
rm -rf ${PROJECTS_DIR}/game1
cp -r ${PROJECTS_DIR}/game0 ${PROJECTS_DIR}/game1
include_graph:
./scripts/include_graph.sh