-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
115 lines (88 loc) · 3.04 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
# # # # # # #
# variables
#
rust_log_debug := RUST_LOG=warn,bevy=debug,bevy_pixels_web_game_poc=debug
rust_flags_release := RUSTFLAGS="-D warnings -A dead_code -A unused-imports -A unused_mut -A unused-variables"
# # # # # # # # # # #
# initial commands
#
setup:
rustup default stable
cargo install --locked wasm-bindgen-cli # required by `trunk`
cargo install --locked trunk # https://trunkrs.dev/
# # # # # # # # #
# main commands
#
format:
cargo fmt
check: test clippy
run: run_debug_host
web: run_debug_web
dist: dist_itch_io
# # # # # # # # # # # # #
# specialized commands
#
update_rust_toolchain:
rustup update stable
clean_up:
rm -rf ./_generated_dir_with_bundle_assets_/
trunk clean
trunk --config ./Trunk.release.toml clean
trunk --config ./Trunk.itch_io.toml clean
rm -rf ./dist/
cargo clean
test:
cargo test
cargo test --features visualize_schedule_main
cargo test --features visualize_schedule_fixed_update
cargo test --release
clippy:
cargo clippy
cargo clippy --features visualize_schedule_main
cargo clippy --features visualize_schedule_fixed_update
cargo clippy --release
cargo clippy --target wasm32-unknown-unknown
cargo clippy --target wasm32-unknown-unknown --release
cargo clippy --profile test
visualize_schedule_main:
cargo run --quiet --features visualize_schedule_main | pbcopy
echo "Graph data is in your clipboard now. Visit https://edotor.net/ and paste it there 🙂"
visualize_schedule_fixed_update:
cargo run --quiet --features visualize_schedule_fixed_update | pbcopy
echo "Graph data is in your clipboard now. Visit https://edotor.net/ and paste it there 🙂"
# # # # # # # # # #
# build commands
#
generate_dir_with_bundle_assets:
rm -rf ./_generated_dir_with_bundle_assets_/
mkdir -p ./_generated_dir_with_bundle_assets_/
cp ./assets/*.ogg ./_generated_dir_with_bundle_assets_/
build_release_host: generate_dir_with_bundle_assets
$(rust_flags_release) cargo build --release
rm -rf ./target/release/assets/
mkdir -p ./target/release/assets/
cp -R ./_generated_dir_with_bundle_assets_/ ./target/release/assets/
# # # # # # # # #
# run commands
#
run_debug_host:
$(rust_log_debug) cargo run --features bevy/dynamic_linking
# For a debug web build we do not call `generate_dir_with_bundle_assets` step,
# because it is run by `trunk` itself on every detected asset change.
run_debug_web:
mkdir -p ./dist/web_debug/
$(rust_log_debug) trunk serve
run_release_host: build_release_host
./target/release/bevy_pixels_web_game_poc
run_release_web: generate_dir_with_bundle_assets
$(rust_flags_release) trunk --config ./Trunk.release.toml serve
# # # # # # # # #
# dist commands
#
dist_itch_io: generate_dir_with_bundle_assets
trunk --config ./Trunk.itch_io.toml clean
$(rust_flags_release) trunk --config ./Trunk.itch_io.toml build
rm -f ./dist/bevy_pixels_web_game_poc__itch_io.zip
rm -rf ./dist/bevy_pixels_web_game_poc__itch_io/ # in case ZIP was extracted there
cd ./dist/itch_io/ && zip -r ../bevy_pixels_web_game_poc__itch_io.zip ./
echo "✅ Dist package is ready: ./dist/bevy_pixels_web_game_poc__itch_io.zip"