forked from rust-console/gba
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.toml
70 lines (58 loc) · 1.84 KB
/
Makefile.toml
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
[config]
skip_core_tasks = true
[tasks.verify-toolchain]
script_runner = "@duckscript"
script = [
'''
channel = get_env CARGO_MAKE_RUST_CHANNEL
assert_eq ${channel} nightly "Rust toolchain must be set to nightly"
'''
]
[tasks.build-examples-debug]
dependencies = ["verify-toolchain"]
command = "cargo"
args = ["build", "--examples", "--target=thumbv4t-none-eabi", "-Zbuild-std=core"]
[tasks.build-examples-release]
dependencies = ["verify-toolchain"]
command = "cargo"
args = ["build", "--examples", "--release", "--target=thumbv4t-none-eabi", "-Zbuild-std=core"]
[tasks.pack-roms]
script_runner = "@duckscript"
script = [
'''
release_target = get_env RELEASE_TARGET
examples_path = set ./target/thumbv4t-none-eabi/${release_target}/examples
examples = glob_array ./examples/*.rs
for example in ${examples}
example = substring ${example} -3
example = basename ${example}
binary_exists = is_path_exists ${examples_path}/${example}
if ${binary_exists}
echo "Packing: ${examples_path}/${example} to ${examples_path}/${example}.gba"
exec arm-none-eabi-objcopy -O binary ${examples_path}/${example} ${examples_path}/${example}.gba
echo "Fixing headers: ${examples_path}/${example}.gba"
exec gbafix ${examples_path}/${example}.gba
else
echo "Binary does not exist: ${examples_path}/${example}"
end
end
'''
]
[tasks.pack-roms-release]
dependencies = ["build-examples-release"]
env = { RELEASE_TARGET = "release" }
run_task = "pack-roms"
[tasks.pack-roms-debug]
dependencies = ["build-examples-debug"]
env = { RELEASE_TARGET = "debug" }
run_task = "pack-roms"
[tasks.test]
dependencies = ["verify-toolchain"]
command = "cargo"
args = ["test", "--lib"]
[tasks.justrelease]
dependencies = ["pack-roms-release"]
[tasks.build-all]
dependencies = ["pack-roms-debug", "pack-roms-release"]
[tasks.default]
alias = "build-all"