forked from elonafoobar/elonafoobar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
130 lines (85 loc) · 3.36 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
BIN_DIR := bin
# Utilities
FORMAT := clang-format
FIND := find
XARGS := xargs
MKDIR := mkdir
GREP := grep
AWK := awk
.PHONY: FORCE
all: $(BIN_DIR) FORCE # Build the most recently built target.
cd $(BIN_DIR); \
cmake .. $(CMAKE_ARGS); \
cmake --build .
run: build FORCE # Run Elona foobar (debug).
./$(BIN_DIR)/Elona_foobar
build: $(BIN_DIR) FORCE # Build Elona foobar (debug).
cd $(BIN_DIR); \
cmake .. -DELONA_BUILD_TARGET=GAME -DCMAKE_BUILD_TYPE=Debug $(CMAKE_ARGS); \
cmake --build . --config Debug
run_release: build_release FORCE # Run Elona foobar (release).
./$(BIN_DIR)/Elona_foobar
build_release: $(BIN_DIR) FORCE # Build Elona foobar (release).
cd $(BIN_DIR); \
cmake .. -DELONA_BUILD_TARGET=GAME -DCMAKE_BUILD_TYPE=Release $(CMAKE_ARGS); \
cmake --build . --config Release
@echo "\"You've been a faithful servant of me. Here, use it wisely.\""
@echo "Something is placed at $(BIN_DIR)."
launcher: FORCE # Build Elona foobar Launcher (debug)
cd $(BIN_DIR); \
cmake .. -DELONA_BUILD_TARGET=LAUNCHER -DCMAKE_BUILD_TYPE=Debug $(CMAKE_ARGS); \
cmake --build . --config Debug
launcher_release: FORCE # Build Elona foobar Launcher (release)
cd $(BIN_DIR); \
cmake .. -DELONA_BUILD_TARGET=LAUNCHER -DCMAKE_BUILD_TYPE=Release $(CMAKE_ARGS); \
cmake --build . --config Release
tests: test_runner FORCE # Run all tests.
cd $(BIN_DIR); \
./Elona_foobar --durations=yes
test_runner: $(BIN_DIR) FORCE # Build test runner.
-@$(RM) -rf ./$(BIN_DIR)/tests
cd $(BIN_DIR); \
cmake .. -DELONA_BUILD_TARGET=TESTS -DCMAKE_BUILD_TYPE=Debug $(CMAKE_ARGS); \
cmake --build . --config Debug
bench: bench_runner FORCE # Run benchmark.
cd $(BIN_DIR); \
./Elona_foobar
bench_runner: $(BIN_DIR) FORCE # Build benchmark runner.
cd $(BIN_DIR); \
cmake .. -DELONA_BUILD_TARGET=BENCH -DCMAKE_BUILD_TYPE=Release $(CMAKE_ARGS); \
cmake --build . --config Release
$(BIN_DIR):
$(MKDIR) $(BIN_DIR)
clean: FORCE # Clean up built products.
-@$(RM) -rf $(BIN_DIR)
# Format src/*.{hpp,cpp} except under src/thirdparty.
format: FORCE # Format all C++ source files.
$(FIND) src \( -type d -name "thirdparty" -prune \) -or \( -name "*.cpp" -or -name "*.hpp" \) -print0 | \
$(XARGS) -n 1 -0 -I{} sh -c "$(FORMAT) -i {}; echo {}"
git diff
test -z "$$(git status --short)"
docgen: # Generate ldoc files from C++ sources.
cargo run --release --manifest-path tools/docgen/Cargo.toml -- -f -o doc/api src/elona/lua_env
ldoc: FORCE # Generate LDoc.
-@$(RM) -rf $(BIN_DIR)/doc
-@$(RM) -rf doc/generated
mkdir -p $(BIN_DIR)/doc
cp -r doc/topics $(BIN_DIR)/doc
cp -r doc/examples $(BIN_DIR)/doc
cp doc/static/* $(BIN_DIR)/doc/
cd $(BIN_DIR) && ldoc -c ../doc/config.ld -l ../doc -s ../doc/static ../doc/api/
cp -r $(BIN_DIR)/doc doc/generated
luacheck: FORCE # Run luacheck.
luacheck --version
luacheck runtime/mod/
luacheck src/tests/lua
i18n-check:FORCE # Run i18n-checker.
./tools/i18n_checker/bin/i18n_checker $(CURDIR) en
./tools/i18n_checker/bin/i18n_checker $(CURDIR) jp
i18n-check-err: FORCE # Run i18n-checker with --no-warnings.
./tools/i18n_checker/bin/i18n_checker $(CURDIR) en --no-warnings
./tools/i18n_checker/bin/i18n_checker $(CURDIR) jp --no-warnings
rebuild: clean build FORCE # Clean and build Elona.
help: FORCE # Show this help.
@$(GREP) '^[a-zA-Z_-]*:.* # .*' $(MAKEFILE_LIST) \
| $(AWK) 'BEGIN {FS = ":.* # "}; {printf "%-25s%s\n", $$1, $$2}'