-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
44 lines (34 loc) · 1.51 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
VERSION := 21
STATUS := draft-
OUTPUT := $(STATUS)ietf-cellar-ebml-$(VERSION)
XML2RFC_CALL := xml2rfc
MMARK_CALL := mmark
-include runtimes.mak
XML2RFC := $(XML2RFC_CALL) --v3
MMARK := $(MMARK_CALL)
all: $(OUTPUT).html $(OUTPUT).txt $(OUTPUT).xml
$(info RFC rendering has been tested with mmark version 2.2.8 and xml2rfc 2.46.0, please ensure these are installed and recent enough.)
$(OUTPUT).md: specification.markdown rfc_frontmatter.markdown rfc_backmatter.markdown EBMLSchema.xsd ebml_schema_example.xml
cat rfc_frontmatter.markdown $< rfc_backmatter.markdown | sed "s/@BUILD_DATE@/$(shell date +'%F')/" > $(OUTPUT).md
%.xml: %.md
$(MMARK) $< > $@
sed -i -e 's/<sourcecode type="xsd">/<sourcecode type="xml">/' $@
rfc8794.xml: $(OUTPUT).xml
sed -e 's/<?xml version="1.0" encoding="utf-8"?>/<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">/' \
-e "s/docName=\"8794\"/docName=\"$(OUTPUT)\" sortRefs=\"true\"/" \
-e "s@\"http://www.w3.org/2001/XInclude\"@\"http://www.w3.org/2001/XInclude\" tocInclude=\"true\" symRefs=\"true\"@" \
-e 's@<organization></organization>@@' \
-e 's@<street></street>@@' \
-e 's@<li>@<li><t>@' \
-e 's@</li>@</t>\n</li>@' \
-e 's@BCP 14@BCP\ 14@' \
-e 's@<dd><t>@<dd>@' \
-e 's@<date></date>@@' \
-e 's@<back>@<back>\n<displayreference target="I-D.ietf-cellar-matroska" to="Matroska"/>@' \
$< > $@
%.html: rfc8794.xml
$(XML2RFC) --html $< -o $@
%.txt: rfc8794.xml
$(XML2RFC) $< -o $@
clean:
rm -f $(OUTPUT).txt $(OUTPUT).html $(OUTPUT).md $(OUTPUT).xml