-
Notifications
You must be signed in to change notification settings - Fork 2
/
Justfile
72 lines (59 loc) · 2.78 KB
/
Justfile
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
name := 'z80emu'
shuffle_args := env_var_or_default('SHUFFLE_TESTS','nmos cmos bm1 anynmos anycmos anybm1 debug steps limit')
llvm_profdata_exe := replace(clean(`rustc --print target-libdir` / ".." / "bin" / "llvm-profdata"),'\','/')
target := replace_regex(trim_end_match(`rustup default`, ' (default)'), '^[^-]+-', '')
optimizations := '-Zno-parallel-llvm -Ccodegen-units=1'
mir_opts := '-Zmir-opt-level=4 -Zprint-fuel=z80emu'
mir_extra := '-Zinline-mir=yes -Zinline-mir-threshold=500 -Zinline-mir-hint-threshold=1000'
iter_default := '10'
# run RAL1243 example
example:
cargo run --example terminal --release --no-default-features -- examples/ral1243/exroms -m 48 -c 8000
# run shuffle example
shuffle iters=iter_default:
cargo run --example shuffle --release -- {{shuffle_args}} {{iters}}
# run shuffle example with full mir optimizations
shuffle-mir iters=iter_default:
RUSTFLAGS="{{optimizations}} {{mir_opts}}" cargo +nightly-{{target}} run --example shuffle --release -- {{shuffle_args}} {{iters}}
# run shuffle example with full mir optimizations and mir inline
shuffle-mir-extra iters=iter_default:
RUSTFLAGS="{{optimizations}} {{mir_opts}} {{mir_extra}}" cargo +nightly-{{target}} run --example shuffle --release -- {{shuffle_args}} {{iters}}
# profile run shuffle
shuffle-profgen iters=iter_default:
@echo "TARGET: [{{target}}]"
@echo "using {{llvm_profdata_exe}}"
set -eux
rm -rf tmp/pgo-data
RUSTFLAGS="-Cprofile-generate=tmp/pgo-data" cargo +nightly-{{target}} run --example shuffle --target="{{target}}" --release -- {{shuffle_args}} {{iters}}
{{llvm_profdata_exe}} merge -o tmp/pgo-data/merged.profdata tmp/pgo-data
# run shuffle profiled
shuffle-prof iters=iter_default:
RUSTFLAGS="-Cllvm-args=-pgo-warn-missing-function -Cprofile-use={{justfile_directory()}}/tmp/pgo-data/merged.profdata" cargo +nightly-{{target}} run --example shuffle --target="{{target}}" --release -- {{shuffle_args}} {{iters}}
# build all docs
doc:
cargo +nightly doc -p z80emu --all-features
# run all tests
test:
cargo test --no-default-features
cargo test
cargo build -p ral1243 --no-default-features
cargo build -p ral1243 --features=std
cargo build -p ral1243 --target thumbv7em-none-eabihf
cargo build -p z80emu-embedded-example --target thumbv7em-none-eabihf
# run all tests with no capture
test-nocapt:
cargo test --no-default-features -- --nocapture
cargo test -- --nocapture
# run clippy tests
clippy: clippy-ral
touch src/lib.rs
cargo clippy -- -D warnings
cargo clippy --no-default-features -- -D warnings
# run clippy tests for ral1243
clippy-ral:
touch examples/ral1243/src/lib.rs
cargo clippy -p ral1243 -- -D warnings
cargo clippy -p ral1243 --features=std -- -D warnings
clean:
cargo clean
rm -rf tmp/pgo-data