From 7f4ff7cf15f93759e8eae18cf8423035dba36c5e Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Thu, 18 Aug 2022 21:28:07 -0700 Subject: Rebuild on Linker change --- build.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 build.rs (limited to 'build.rs') diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..721d6d6 --- /dev/null +++ b/build.rs @@ -0,0 +1,20 @@ +use std::{env,fs,process}; + +fn main() { + let ld_script_path = match env::var("LD_SCRIPT_PATH") { + Ok(var) => var, + _ => process::exit(0), + }; + + 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())); +} -- cgit v1.2.1