From 169804d17a756d847904e712d189faf51dbfbdac Mon Sep 17 00:00:00 2001 From: Rahix Date: Wed, 18 Mar 2020 21:45:41 +0100 Subject: [PATCH] make: Use a patchfile instead of weird sed expr As reported in issue #24 the sed(1) expression used to patch the generated `mod.rs` does not work on MacOS (BSD sed). Instead, use patch(1) and a small patchfile to accomplish the same task. Signed-off-by: Rahix --- Makefile | 2 +- patch/modrs.patch | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 patch/modrs.patch diff --git a/Makefile b/Makefile index 6c9a5ad..3f91e3a 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ src/devices/%/mod.rs: src/devices/%/mod.full.rs @sed -i'' -e "1,7d" $@ @# Remove DEVICE_PERIPHERALS declaration and replace it with a reference @# to the global version - @sed -i'' -e '/^\#\[no_mangle\]/,+1cuse crate::devices::DEVICE_PERIPHERALS;' $@ + @patch --no-backup-if-mismatch --quiet $@ patch/modrs.patch @echo -e "\tGEN-VECTOR\t>macros/src/vector.rs" @./gen-intr-lut.sh src/devices/*/interrupt.rs >macros/src/vector.rs diff --git a/patch/modrs.patch b/patch/modrs.patch new file mode 100644 index 0000000..e165b70 --- /dev/null +++ b/patch/modrs.patch @@ -0,0 +1,5 @@ +1337,1338c1337 +< #[no_mangle] +< static mut DEVICE_PERIPHERALS: bool = false; +--- +> use crate::devices::DEVICE_PERIPHERALS; -- 2.48.1