diff options
Diffstat (limited to 'build.rs')
-rw-r--r-- | build.rs | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -1,3 +1,19 @@ +use std::env; +use std::fs::File; +use std::io::Write; +use std::path::Path; + fn main() { - println!("cargo:rerun-if-changed=device.lds") + let out_dir = env::var("OUT_DIR").expect("No out dir"); + let dest_path = Path::new(&out_dir); + let mut f = File::create(&dest_path.join("memory.x")) + .expect("Could not create file"); + + f.write_all(include_bytes!("memory.x")) + .expect("Could not write file"); + + println!("cargo:rustc-link-search={}", dest_path.display()); + + println!("cargo:rerun-if-changed=memory.x"); + println!("cargo:rerun-if-changed=build.rs"); } |