-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
114 lines (97 loc) · 2.7 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
# In case your system doesn't have any of these tools:
# https://pypi.python.org/pypi/xml2rfc
# https://github.com/cabo/kramdown-rfc2629
# https://github.com/Juniper/libslax/tree/master/doc/oxtradoc
# https://tools.ietf.org/tools/idnits/
xml2rfc ?= xml2rfc
kramdown-rfc2629 ?= kramdown-rfc2629
oxtradoc ?= oxtradoc
idnits ?= idnits
DRAFTS := draft-yn-netmod-rfc7950bis draft-yn-netmod-yang-xml draft-yn-netmod-yang-proto
default:
@for draft in $(DRAFTS); do \
export draft _; \
make make_draft; \
if [ "$$?" != "0" ]; then \
exit 1; \
fi; \
done
make_draft:
@echo "Making $(draft)..."
@current_ver=`git tag | grep '$(draft)-[0-9][0-9]' | tail -1 | sed -e"s/.*-//"`; \
if [ -z "$$current_ver" ]; then \
next_ver=00; \
else \
next_ver_num=`expr $${current_ver} + 1`; \
next_ver=`printf "%.2d" $${next_ver_num}`; \
fi; \
export next_ver; \
make $(draft)-$${next_ver}
$(draft)-$(next_ver):
make $@.xml
make $@.txt
make $@.html
$(draft)-$(next_ver).xml: $(draft).xml
@echo "Making $@ from $<..."
sed -e"s/$(basename $<)-latest/$(basename $@)/" -e"s/YYYY-MM-DD/$(shell date +%Y-%m-%d)/" $< > $@
#cd refs && ./validate-all.sh && ./gen-trees.sh && cd ..
./.insert-figures.sh $@ > tmp && mv tmp $@
#rm -f refs/*-tree*.txt refs/tree-*.txt
$(draft)-$(next_ver).txt: $(draft)-$(next_ver).xml
@echo "Making $@ from $<..."
$(xml2rfc) --v3 $< -o $@ --text
$(draft)-$(next_ver).html: $(draft)-$(next_ver).xml
@echo "Making $@ from $<..."
$(xml2rfc) --v3 $< -o $@ --html
.PHONY: clean
clean:
@for draft in $(DRAFTS); do \
export draft _; \
$(MAKE) clean_draft; \
done
clean_draft:
-rm -f $(draft)-[0-9][0-9].xml
-rm -f $(draft)-[0-9][0-9].txt
-rm -f $(draft)-[0-9][0-9].html
#draft_type := $(suffix $(firstword $(wildcard $(draft).md $(draft).org $(draft).xml) ))
#
#current_ver := $(shell git tag | grep '$(draft)-[0-9][0-9]' | tail -1 | sed -e"s/.*-//")
#ifeq "${current_ver}" ""
#next_ver ?= 00
#else
#next_ver ?= $(shell printf "%.2d" $$((1$(current_ver)-99)))
#endif
#next := $(draft)-$(next_ver)
#
#.PHONY: latest submit clean
#
##latest: $(draft).txt $(draft).html
#
#default: $(next).xml $(next).txt $(next).html
#
#idnits: $(next).txt
# $(idnits) $<
#
#clean:
#
#$(next).xml: $(draft).xml
# sed -e"s/$(basename $<)-latest/$(basename $@)/" -e"s/YYYY-MM-DD/$(shell date +%Y-%m-%d)/" $< > $@
# #cd refs && ./validate-all.sh && ./gen-trees.sh && cd ..
# ./.insert-figures.sh $@ > tmp && mv tmp $@
# #rm -f refs/*-tree*.txt refs/tree-*.txt
# xml2rfc --v2v3 $@
#
#.INTERMEDIATE: $(draft).xml
#%.xml: %.md
# $(kramdown-rfc2629) $< > $@
#
#%.xml: %.org
# $(oxtradoc) -m outline-to-xml -n "$@" $< > $@
#
#%.txt: %.xml
# $(xml2rfc) --v3 $< -o $@ --text
#
#%.html: %.xml
# $(xml2rfc) --v3 $< -o $@ --html
#
#