mirror of
https://github.com/panpaul/tiny_os
synced 2024-09-20 09:45:19 +08:00
24 lines
604 B
Rust
24 lines
604 B
Rust
fn main() {
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
|
|
struct TargetConfiguration {
|
|
target: &'static str,
|
|
lds: &'static str,
|
|
}
|
|
|
|
const TARGET_CONFIGURATIONS: &[TargetConfiguration] = &[TargetConfiguration {
|
|
target: "riscv64",
|
|
lds: "src/arch/riscv/boot/linker64.ld",
|
|
}];
|
|
|
|
let target = std::env::var("TARGET").unwrap();
|
|
for cfg in TARGET_CONFIGURATIONS {
|
|
if target.starts_with(cfg.target) {
|
|
println!("cargo:rustc-link-arg=-T{}", cfg.lds);
|
|
return;
|
|
}
|
|
}
|
|
|
|
panic!("Unsupported target: {}", target);
|
|
}
|