-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
145 lines (90 loc) · 5.76 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# https://pypi.python.org/pypi/xml2rfc
xml2rfc ?= xml2rfc
# https://github.com/cabo/kramdown-rfc2629
kramdown-rfc2629 ?= kramdown-rfc2629
DRAFT = draft-ietf-core-senml
VERSION = 15
.PHONY: draft txt html pdf clean check check2
draft: txt html
diff: $(DRAFT).diff.html
gen: check check2 check3 ex1.gen.exi.hex ex1.gen.xml ex1.json ex10.json ex11.json ex2.gen.exi.hex ex2.gen.xml ex2.json ex3.json ex4.gen.json-trim ex5.json ex6.json senml.gen.xsd senml.rnc ex8.json ex3.gen.xml ex3.gen.cbor.hex ex3.gen.cbor.diag size.md ex3.gen.cbor.txt ex3.gen.cbor ex8.gen.xml ex1.gen.json ex10.gen.json ex11.gen.json ex2.gen.json ex3.gen.json ex5.gen.json ex6.gen.json ex8.gen.json ex3.gen.wrap.json ex6.gen.wrap.json ex8.gen.wrap.json ex7.gen.json ex5.gen.resolved.json ex9.gen.json ex12.gen.json ex13.gen.json ex5.gen.wrap.json ex5.gen.resolved.wrap.json ex10.gen.wrap.json ex11.gen.wrap.json ex4.gen.wrap.json ex1.gen.json ex5.gen.exi.hex
check: ex11.gen.chk ex10.gen.chk ex6.gen.chk ex5.gen.chk ex4.gen.chk ex3.gen.chk ex2.gen.chk ex1.gen.chk ex9.gen.chk ex12.gen.chk ex13.gen.chk
check2: ex11.chk ex10.chk ex8.chk ex6.chk ex5.chk ex4.chk ex3.chk ex2.chk ex1.chk ex3.gen.cbor.chk ex3.gen.cbor.txt ex9.chk ex12.chk ex13.chk
check3: ex1.gen.resolved.json ex2.gen.resolved.json ex3.gen.resolved.json ex4.gen.resolved.json ex5.gen.resolved.json ex6.gen.resolved.json ex7.gen.resolved.json ex8.gen.resolved.json ex9.gen.resolved.json ex10.gen.resolved.json ex11.gen.resolved.json ex12.gen.resolved.json
all: gen draft
$(DRAFT).diff.html: $(DRAFT)-$(VERSION).txt $(DRAFT)-old.txt
htmlwdiff $(DRAFT)-old.txt $(DRAFT)-$(VERSION).txt > $(DRAFT).diff.html
txt: $(DRAFT)-$(VERSION).txt
html: $(DRAFT)-$(VERSION).html
pdf: $(DRAFT)-$(VERSION).pdf
clean:
-rm -f $(DRAFT)-$(VERSION).{txt,html,xml,pdf} ex*.gen* ex*.chk axs senml.gen.xsd size.md draft-ietf-core-senml-??.*
size: ex5.json ex5.gen.xml ex5.gen.exi ex5.gen.cbor ex5.json.Z ex5.gen.xml.Z ex5.gen.exi.Z ex5.gen.cbor.Z
.INTERMEDIATE: $(draft).xml
%.Z: %
gzip -n -c -9 < $< > $@
$(DRAFT)-$(VERSION).xml: $(DRAFT).md
$(kramdown-rfc2629) $< > $@
#$(DRAFT)-$(VERSION).xml: $(DRAFT).md ex1.gen.exi.hex ex1.gen.xml ex1.json ex10.json ex11.json ex2.gen.exi.hex ex2.gen.xml ex2.json ex3.json ex4.gen.json-trim ex5.json ex6.json senml.gen.xsd senml.rnc ex8.json ex3.gen.xml ex3.gen.cbor.hex size.md ex3.gen.cbor.txt
# $(kramdown-rfc2629) $< > $@
%.txt: %.xml
$(xml2rfc) $< -o $@ --text
%.html: %.xml
$(xml2rfc) $< -o $@ --html
%.gen.xml: %.json
senmlCat -xml -ijson -i -print $< | tidy -xml -i -wrap 68 -q -o $@
%.gen.json: %.json
senmlCat -json -ijson -i -print $< > $@
%.gen.resolved.json: %.json
senmlCat -json -ijson -resolve -i -print $< | sed -e 's/"bver"\:.,//' > $@
%.gen.cbor: %.json senml-json2cbor.rb
ruby senml-json2cbor.rb $< > $@
%.gen.cbor.diag: %.gen.cbor
cbor2diag.rb $< > $@
%.gen.cbor.txt: %.gen.cbor
cbor2pretty.rb $< | sed -e "s/6465763a6f773a3130653230373361303130383/ ... /" > $@
%.chk: %.xml senml.rnc
java -jar bin/jing.jar -c senml.rnc $< > $@
%.chk: %.json senml.cddl senml-json.cddl
cat senml.cddl senml-json.cddl | cddl - validate $< > $@
%.gen.cbor.chk: %.gen.cbor senml.cddl senml-cbor.cddl
cat senml.cddl senml-cbor.cddl | cddl - validate $< > $@
%.tmp.xsd: %.rnc
java -jar bin/trang.jar $< $@
%.gen.xsd: %.tmp.xsd
cat $< | tidy -xml -q -i -wrap 68 -o $@
ex4.gen.json-trim: ex4.gen.wrap.json
head -11 < $< > $@
ex3.gen.wrap.json: ex3.gen.json
cat ex3.gen.json | sed -e 's/,"bu"/,# "bu"/' | sed -e 's/,"n"/,# "n"/' | tr "#" "\n" > ex3.gen.wrap.json
ex10.gen.wrap.json: ex10.gen.json
cat ex10.gen.json | sed -e 's/,"v"/,# "v"/' | tr "#" "\n" > ex10.gen.wrap.json
ex11.gen.wrap.json: ex11.gen.json
cat ex11.gen.json | sed -e 's/,"v"/,# "v"/' | tr "#" "\n" > ex11.gen.wrap.json
ex4.gen.wrap.json: ex4.gen.json
cat ex4.gen.json | sed -e 's/,"bu"/,# "bu"/' | tr "#" "\n" > ex4.gen.wrap.json
ex5.gen.wrap.json: ex5.gen.json
cat ex5.gen.json | sed -e 's/,"bu"/,# "bu"/' | tr "#" "\n" > ex5.gen.wrap.json
ex5.gen.resolved.wrap.json: ex5.gen.resolved.json
cat ex5.gen.resolved.json | sed -e 's/,"v"/,# "v"/' | tr "#" "\n" > ex5.gen.resolved.wrap.json
ex6.gen.wrap.json: ex6.gen.json
cat ex6.gen.json | sed -e 's/\+09,/\+09,# /' | sed -e 's/\:1",/\:1",# /' | tr "#" "\n" > ex6.gen.wrap.json
ex8.gen.wrap.json: ex8.gen.json
cat ex8.gen.json | sed -e 's/,"l"/,# "l"/' | sed -e 's/,"n"/,# "n"/' | tr "#" "\n" > ex8.gen.wrap.json
%.hex: %
hexdump -C $< | sed -e "s/0000//" | sed -e "s/ |/ |/" | sed -e "s/ / /" | sed -e "s/ / /" > $@
ex5.gen.exi: ex5.gen.xml senml.gen.xsd
cp senml.gen.xsd a
java -cp "bin/xercesImpl.jar:bin/exificient.jar" com.siemens.ct.exi.cmd.EXIficientCMD -encode -i ex5.gen.xml -o ex5.gen.exi -schema a -strict -includeOptions -includeSchemaId
ex2.gen.exi: ex2.gen.xml senml.gen.xsd
cp senml.gen.xsd a
java -cp "bin/xercesImpl.jar:bin/exificient.jar" com.siemens.ct.exi.cmd.EXIficientCMD -encode -i ex2.gen.xml -o ex2.gen.exi -schema a -strict -includeOptions -includeSchemaId
ex1.gen.exi: ex1.gen.xml senml.gen.xsd
cp senml.gen.xsd a
java -cp "bin/xercesImpl.jar:bin/exificient.jar" com.siemens.ct.exi.cmd.EXIficientCMD -encode -i ex1.gen.xml -o ex1.gen.exi -schema a -strict -includeOptions -includeSchemaId -bytePacked
size.md: ex5.gen.cbor ex5.gen.cbor.Z ex5.gen.exi ex5.gen.exi.Z ex5.gen.xml ex5.gen.xml.Z ex5.json ex5.json.Z
echo "| Encoding | Size | Compressed Size |" > size.md
echo "| JSON | " `cat ex5.json | wc -c ` "|" `cat ex5.json.Z | wc -c` "|" >> size.md
echo "| XML | " `cat ex5.gen.xml | wc -c ` "|" `cat ex5.gen.xml.Z | wc -c` "|" >> size.md
echo "| CBOR | " `cat ex5.gen.cbor | wc -c ` "|" `cat ex5.gen.cbor.Z | wc -c` "|" >> size.md
echo "| EXI | " `cat ex5.gen.exi | wc -c ` "|" `cat ex5.gen.exi.Z | wc -c` "|" >> size.md