-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
42 lines (32 loc) · 935 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
xml2rfc ?= xml2rfc
idnits ?= idnits
draft := $(basename $(lastword $(sort $(wildcard draft-*.xml))))
draft_type := xml
current_ver := $(shell git tag | grep '$(draft)-[0-9][0-9]'| tail -1 | sed 's/.*-//')
ifeq "$(current_ver)" ""
next_ver ?= 00
else
next_ver ?= $(shell printf "%.2d" $$((1$(current_ver)-99)))
endif
next := $(draft)-$(next_ver)
.PHONY: all idnits clean
all: $(next).xml $(next).txt $(next).html
idnits: $(next).txt
$(idnits) $<
clean:
rm -f $(draft).txt $(draft).html
rm -f $(next).txt $(next).html
rm -f $(draft)-[0-9][0-9].xml
rm -f $(draft)-[0-9][0-9].v2v3.xml
n:
echo $(next)
$(next).xml: $(draft).xml
sed -e"s/$(basename $<)-latest/$(basename $@)/" \
-e"s/YYYY-MM-DD/$(shell date +%Y-%m-%d)/" $< > $@
xml2rfc --v3 $@
.INTERMEDIATE: $(draft).xml
%.txt: %.xml
$(xml2rfc) --v3 $< -o $@ --text
@if [ "$(next_ver)" -ne "00" ]; then idnits $@; fi
%.html: %.xml
$(xml2rfc) --v3 $< -o $@ --html