forked from inadarei/rfc-healthcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
43 lines (30 loc) · 949 Bytes
/
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
xml2rfc ?= xml2rfc
kramdown-rfc2629 ?= kramdown-rfc2629
idnits ?= idnits
title = inadarei-api-health-check
latest = $(shell (ls draft-${title}-*.xml || echo "draft-${title}-00.xml") | sort | tail -1)
version = $(shell basename ${latest} .xml | awk -F- '{print $$NF}')
target = draft-$(title)-$(version)
prev = draft-$(title)-$(shell printf "%.2d" `echo ${version}-1 | bc`)
next = draft-$(title)-$(shell printf "%.2d" `echo ${version}+1 | bc`)
.PHONY: latest clean next diff idnits update
latest: $(target).html $(target).txt index.html index.txt
clean:
rm -f $(target).html $(target).txt
next:
cp $(target).xml $(next).xml
sed -i '' -e"s/$(target)/$(next)/" draft.md
diff:
rfcdiff $(prev).txt $(target).txt
idnits: $(target).txt
$(idnits) $<
%.xml: draft.md
$(kramdown-rfc2629) $< > $@
%.html: %.xml
$(xml2rfc) --html $< $@
%.txt: %.xml
$(xml2rfc) $< $@
index.html: $(target).html
cp $< $@
index.txt: $(target).txt
cp $< $@