~ruther/avr-device

ref: e0d031a3913eb292b21d270f6a9351d34074f590 avr-device/Makefile -rw-r--r-- 831 bytes
e0d031a3 — Rahix svdpatch: Fix field modifications 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
all: chips

CHIPS := atmega8 atmega328p atmega32u4 attiny85

.PHONY: chips
chips: $(foreach chip, $(CHIPS), src/devices/$(chip)/mod.rs)

svd/%.bare.svd: vendor/%.atdf
	mkdir -p svd
	atdf2svd $< $@

svd/%.patched.svd: svd/%.bare.svd
	if [ -f patch/$*.yaml ] ; then \
		python3 patch/svdpatch.py patch/$*.yaml $< $@; \
	else \
		echo "No patches found for $*"; \
		cp $< $@; \
	fi

src/devices/%/mod.full.rs: svd/%.patched.svd
	mkdir -p $(@D)
	cd $(@D); svd2rust --target none -i $(realpath $<)
	mv $(@D)/lib.rs $@

src/devices/%/mod.rs: src/devices/%/mod.full.rs
	form -i $< -o $(@D)
	rm $<
	mv $(@D)/lib.rs $@
	rustfmt $@
	@# Remove the `extern crate` lines
	sed -i "1,7d" $@
	@# Make DEVICE_PERIPHERALS visible crate-wide
	sed -i 's/\(static mut DEVICE_PERIPHERALS\)/pub(crate) \0/' $@

clean:
	rm -rf svd
	rm -rf src/devices/at*
Do not follow this link