gba/Makefile.toml

71 lines
1.8 KiB
Makefile
Raw Normal View History

2018-11-16 18:39:47 +11:00
[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"
'''
]
2018-11-16 18:39:47 +11:00
2018-11-18 11:14:42 +11:00
[tasks.build-examples-debug]
dependencies = ["verify-toolchain"]
2018-11-16 18:39:47 +11:00
command = "cargo"
args = ["build", "--examples", "--target=thumbv4t-none-eabi", "-Zbuild-std=core"]
2018-11-16 18:39:47 +11:00
2018-11-18 11:14:42 +11:00
[tasks.build-examples-release]
dependencies = ["verify-toolchain"]
2018-11-16 18:39:47 +11:00
command = "cargo"
args = ["build", "--examples", "--release", "--target=thumbv4t-none-eabi", "-Zbuild-std=core"]
2018-11-16 18:39:47 +11:00
[tasks.pack-roms]
script_runner = "@duckscript"
2018-11-16 18:39:47 +11:00
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
2018-11-16 18:39:47 +11:00
'''
]
[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"]
2018-11-18 11:14:42 +11:00
[tasks.justrelease]
dependencies = ["pack-roms-release"]
[tasks.build-all]
dependencies = ["pack-roms-debug", "pack-roms-release"]
2018-11-20 19:52:48 +11:00
[tasks.default]
alias = "build-all"