-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
40 lines (33 loc) · 1.01 KB
/
Makefile
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
38
39
40
DEVICES := tm4c123x tm4c129x
SVD2RUST ?= svd2rust
FORM ?= form
CARGO_FMT ?= cargo fmt
.SECONDARY:
.PHONY: all
all: $(patsubst %,crates/%/src/lib.rs,$(DEVICES))
.PHONY: purge
purge:
rm -f $(patsubst %,svd/%-vendor.xml,$(DEVICES))
rm -f $(patsubst %,svd/%.xml,$(DEVICES))
touch -t 198001010000 $(patsubst %,crates/%/src/lib.rs,$(DEVICES))
.PHONY: rebuild
rebuild: purge all
svd/%-vendor.xml: data/%.xml overlay/%-interrupts.xml dslite2svd.rb
ruby dslite2svd.rb $(filter %.xml,$^) $@
svd/%.xml: overlay/%.patch svd/%-vendor.xml
cp svd/$*-vendor.xml $@
patch --backup -p1 -i $<
@if [ -e [email protected] ]; then \
diff -U6 --label a/svd/$*.xml [email protected] --label b/svd/$*.xml $@ >$<.new; \
if ! diff -q $< $<.new; then \
mv $<.new $<; \
else \
rm $<.new; \
fi; \
rm [email protected]; \
fi
@if which xmllint >/dev/null; then \
xmllint --schema CMSIS-SVD.xsd --noout $@; \
fi
crates/%/src/lib.rs: svd/%.xml
cd crates/$* && $(SVD2RUST) -i ../../$< >lib.rs && rm -rf src && $(FORM) -i lib.rs -o src/ && rm lib.rs && $(CARGO_FMT)