-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
114 lines (79 loc) · 3.2 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
# https://pypi.python.org/pypi/xml2rfc
xml2rfc ?= xml2rfc
# mmark (https://github.com/miekg/mmark)
mmark ?= mmark -xml2 -page
ifneq (,$(XML_LIBRARY))
mmark += -bib-id $(XML_LIBRARY)/ -bib-rfc $(XML_LIBRARY)/
endif
DRAFT = draft-jennings-dispatch-spad-v0
ifeq (,$(VERSION))
VERSION = latest
endif
.PHONY: all clean diff draft tidy check test
.PRECIOUS: %.xml
all: dirs draft
dirs:
mkdir -p gen/content
mkdir -p docs
mkdir -p themes/
draft: docs/id/$(DRAFT)-$(VERSION).txt docs/id/$(DRAFT)-$(VERSION).html
diff: $(DRAFT).diff.html
clean:
-rm -f docs/* docs/*/* gen/content/* gen/*
-rmdir docs/* gen/content
check:
jayschema spec/example1.json spec/spad-schema.json
jayschema spec/example2.json spec/spad-schema.json
tidy:
json -I --output json -f spec/spad-schema.json
json -I --output json -f spec/example1.json
json -I --output json -f spec/example2.json
ramllint spec/spad.raml
%.txt: %.xml
$(xml2rfc) -N $< -o $@ --text
%.html: %.xml
$(xml2rfc) -N $< -o $@ --html
docs/id/$(DRAFT)-$(VERSION).xml: spec/$(DRAFT).md \
gen/example1.json.md gen/example2.json.md \
gen/spad.raml.md gen/spad-schema.json.md gen/ietf-spad.yang.md gen/spad.apib.md
mkdir -p docs/id
$(mmark) -xml2 -page spec/$(DRAFT).md $@
$(DRAFT).diff.html: $(DRAFT)-$(VERSION).txt $(DRAFT)-old.txt
touch $(DRAFT)-old.txt
htmlwdiff $(DRAFT)-old.txt $(DRAFT)-$(VERSION).txt > $(DRAFT).diff.html
gen/%.raml.md: spec/%.raml
mkdir -p gen
( echo "~~~ yaml" ; cat $< ; echo "~~~" ) > $@
gen/%.yang.md: spec/%.yang
mkdir -p gen
( echo "~~~ yang" ; cat $< ; echo "~~~" ) > $@
gen/%.apib.md: spec/%.apib
mkdir -p gen
( echo "~~~ md" ; cat $< ; echo "~~~" ) > $@
gen/%.json.md: spec/%.json
mkdir -p gen
( echo "~~~ " ; cat $< ; echo "~~~" ) > $@
test: gen/ietf-spad.ok gen/example-tmpl.xml gen/ietf-spad.xsl gen/example.json gen/rev-example.xml gen/ietf-spad.dsdl gen/ietf-spad.yang gen/example1.xml gen/example2.xml
gen/ietf-spad.ok: spec/ietf-spad.yang
pyang -V -p contrib --ietf spec/ietf-spad.yang
touch gen/ietf-spad.ok
gen/example-tmpl.xml: spec/ietf-spad.yang
pyang -f sample-xml-skeleton spec/ietf-spad.yang -p contrib -o gen/example-tmpl.xml
gen/ietf-spad.yang: spec/ietf-spad.yang
pyang -f yang -p contrib spec/ietf-spad.yang -o gen/ietf-spad.yang
gen/ietf-spad.xsl: spec/ietf-spad.yang
pyang -f jsonxsl -p contrib spec/ietf-spad.yang -o gen/ietf-spad.xsl
gen/ietf-spad.dsdl: spec/ietf-spad.yang
pyang -f dsdl -p contrib spec/ietf-spad.yang -o gen/ietf-spad.dsdl
gen/example.json: spec/example.xml gen/ietf-spad.xsl
xsltproc -o gen/example.json gen/ietf-spad.xsl spec/example.xml
gen/ietf-spad.jtox: spec/ietf-spad.yang
pyang -f jtox -p contrib spec/ietf-spad.yang -o gen/ietf-spad.jtox
gen/rev-example.xml: gen/ietf-spad.jtox gen/example.json
json2xml -t config gen/ietf-spad.jtox gen/example.json -o gen/rev-example.xml
gen/example1.xml: gen/ietf-spad.jtox spec/example1.json
json2xml -t config gen/ietf-spad.jtox spec/example1.json -o gen/example1.xml
xmllint --format gen/example1.xml -o gen/example1.xml
gen/example2.xml: gen/ietf-spad.jtox spec/example2.json
json2xml -t config gen/ietf-spad.jtox spec/example2.json -o gen/example2.xml
xmllint --format gen/example2.xml -o gen/example2.xml