diff --git a/cortex-m-rt/build.rs b/cortex-m-rt/build.rs index 6758d9ef..96a8560d 100644 --- a/cortex-m-rt/build.rs +++ b/cortex-m-rt/build.rs @@ -19,12 +19,10 @@ fn main() { let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); if target.starts_with("thumbv") { - fs::copy( - format!("bin/{}.a", target), - out_dir.join("libcortex-m-rt.a"), - ) - .unwrap(); + let lib_path = format!("bin/{}.a", target); + fs::copy(&lib_path, out_dir.join("libcortex-m-rt.a")).unwrap(); println!("cargo:rustc-link-lib=static=cortex-m-rt"); + println!("cargo:rerun-if-changed={}", lib_path); } // Put the linker script somewhere the linker can find it