diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d0d4e0f..4b7ddad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- There is now a multiboot feature which you can use to easily make multiboot ROMS. + ### Changed -- General improvements to the linker script that you will need to update. +- You no longer need the gba.ld or gba_mb.ld files in your repository. You should delete these when upgrading. ### Fixed diff --git a/agb/build.rs b/agb/build.rs index 4e34db7b..e990222d 100644 --- a/agb/build.rs +++ b/agb/build.rs @@ -3,17 +3,18 @@ use std::{env, error::Error, fs, path::PathBuf}; fn main() -> Result<(), Box> { let out = &PathBuf::from(env::var("OUT_DIR").unwrap()); let linker_script = if env::var("CARGO_FEATURE_MULTIBOOT").is_ok() { - include_bytes!("gba_mb.ld").as_slice() + include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/gba_mb.ld")).as_slice() } else { - include_bytes!("gba.ld").as_slice() + include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/gba.ld")).as_slice() }; fs::write(out.join("gba.ld"), linker_script)?; println!("cargo:rustc-link-search={}", out.display()); - println!("cargo:rerun-if-changed=gba.ld"); - println!("cargo:rerun-if-changed=gba_mb.ld"); + println!("cargo:rerun-if-changed=src/gba.ld"); + println!("cargo:rerun-if-changed=src/gba_mb.ld"); println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=CARGO_FEATURE_MULTIBOOT"); Ok(()) } diff --git a/agb/gba.ld b/agb/src/gba.ld similarity index 100% rename from agb/gba.ld rename to agb/src/gba.ld diff --git a/agb/gba_mb.ld b/agb/src/gba_mb.ld similarity index 100% rename from agb/gba_mb.ld rename to agb/src/gba_mb.ld diff --git a/justfile b/justfile index a922e0a2..ce2d3c50 100644 --- a/justfile +++ b/justfile @@ -146,7 +146,7 @@ _test-debug crate: _test-debug-arm crate: (cd "{{crate}}" && cargo test --target=armv4t-none-eabi) _test-multiboot: - (cd "agb" && AGB_MULTIBOOT=true RUSTFLAGS="-Clink-arg=-Tgba_mb.ld -Ctarget-cpu=arm7tdmi" cargo test --test=test_multiboot) + (cd "agb" && AGB_MULTIBOOT=true cargo test --features=multiboot --test=test_multiboot) _clippy crate: (cd "{{crate}}" && cargo clippy --examples --tests -- {{CLIPPY_ARGUMENTS}}) _clean crate: