rust-raspberrypi-OS-tutorials/02_runtime_init/build.rs
Andre Richter cb4ae40ac2
Linker: Provide LD script folder via cmdline
This enables shorter relative paths for ld-internal INCLUDE, which adds more
flexibility wrt to directory structure.
2022-04-11 22:24:18 +02:00

18 lines
456 B
Rust

use std::{env, fs};
fn main() {
let ld_script_path = env::var("LD_SCRIPT_PATH").unwrap_or_default();
let files = fs::read_dir(ld_script_path).unwrap();
files
.filter_map(Result::ok)
.filter(|d| {
if let Some(e) = d.path().extension() {
e == "ld"
} else {
false
}
})
.for_each(|f| println!("cargo:rerun-if-changed={}", f.path().display()));
}