aboutsummaryrefslogtreecommitdiff
path: root/build.rs
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-08-18 21:28:07 -0700
committerChristian Cunningham <cc@localhost>2022-08-18 21:28:07 -0700
commit7f4ff7cf15f93759e8eae18cf8423035dba36c5e (patch)
tree36984611aadb1ab824093817010e71c968ec8fc4 /build.rs
parent1c462971fec7efdb7d92424bfce7653ddacb7b9d (diff)
Rebuild on Linker change
Diffstat (limited to 'build.rs')
-rw-r--r--build.rs20
1 files changed, 20 insertions, 0 deletions
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()));
+}