~ruther/avr-device

169804d17a756d847904e712d189faf51dbfbdac — Rahix 5 years ago 4d281f5
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 <rahix@rahix.de>
2 files changed, 6 insertions(+), 1 deletions(-)

M Makefile
A patch/modrs.patch
M Makefile => Makefile +1 -1
@@ 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


A patch/modrs.patch => patch/modrs.patch +5 -0
@@ 0,0 1,5 @@
1337,1338c1337
< #[no_mangle]
< static mut DEVICE_PERIPHERALS: bool = false;
---
> use crate::devices::DEVICE_PERIPHERALS;

Do not follow this link