-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
69 lines (58 loc) · 2.18 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
MD_FILE := draft-ietf-teep-protocol.md
CDDL_FILE := $(MD_FILE:%.md=%.cddl)
FN := $(shell grep 'docname: draft-ietf-teep-protocol' $(MD_FILE) | awk '{print $$2}')
.PHONY: all
all: $(CDDL_FILE) $(FN).txt $(FN).html
.PHONY: cat-cddl
cat-cddl:
make -C cddl cat-cddl
.PHONY: validate
validate: validate-cbor validate-cddl
.PHONY: validate-cbor
validate-cbor:
make -C cbor validate
.PHONY: validate-cddl
validate-cddl:
make -C cddl validate-cddl
.PHONY: validate-teep-cddl
validate-teep-cddl:
make -C cddl validate-teep-cddl
CODE_PAT := ^\~\~\~\~
$(CDDL_FILE): $(MD_FILE)
> $@
echo "; DO NOT EDIT this cddl file manually." >> $@
echo "; This cddl file is Auto-generated file from md file." >> $@
echo "; Edit the md file and run make for generating this cddl file." >> $@
echo "; Please do not forget to commit and push this cddl file to git repo" >> $@
echo "; every time you have revised the md file." >> $@
echo >> $@
sed -n '/${CODE_PAT} cddl-teep-message/,/${CODE_PAT}/ p' $< | sed '/${CODE_PAT}.*/ d' >> $@
echo >> $@
sed -n '/${CODE_PAT} cddl-query-request/,/${CODE_PAT}/ p' $< | sed '/${CODE_PAT}.*/ d' >> $@
echo >> $@
sed -n '/${CODE_PAT} cddl-cipher-suite/,/${CODE_PAT}/ p' $< | sed '/${CODE_PAT}.*/ d' >> $@
echo >> $@
sed -n '/${CODE_PAT} cddl-suit-cose-profile/,/${CODE_PAT}/ p' $< | sed '/${CODE_PAT}.*/ d' >> $@
echo >> $@
sed -n '/${CODE_PAT} cddl-freshness/,/${CODE_PAT}/ p' $< | sed '/${CODE_PAT}.*/ d' >> $@
echo >> $@
sed -n '/${CODE_PAT} cddl-query-response/,/${CODE_PAT}/ p' $< | sed '/${CODE_PAT}.*/ d' >> $@
echo >> $@
sed -n '/${CODE_PAT} cddl-update/,/${CODE_PAT}/ p' $< | sed '/${CODE_PAT}.*/ d' >> $@
echo >> $@
sed -n '/${CODE_PAT} cddl-teep-success/,/${CODE_PAT}/ p' $< | sed '/${CODE_PAT}.*/ d' >> $@
echo >> $@
sed -n '/${CODE_PAT} cddl-teep-error/,/${CODE_PAT}/ p' $< | sed '/${CODE_PAT}.*/ d' >> $@
echo >> $@
sed -n '/${CODE_PAT} cddl-label/,/${CODE_PAT}/ p' $< | sed '/${CODE_PAT}.*/ d' >> $@
$(FN).html: $(FN).xml
xml2rfc $(FN).xml --html
$(FN).txt: $(FN).xml
xml2rfc $(FN).xml
$(FN).xml: $(MD_FILE) $(CDDL_FILE)
kramdown-rfc2629 $(MD_FILE) > $(FN).xml
.PHONY: clean
clean:
rm -fr $(FN).txt $(FN).xml $(CDDL_FILE)
$(MAKE) -C cbor clean
$(MAKE) -C cddl clean