-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (31 loc) · 1.14 KB
/
Makefile
File metadata and controls
38 lines (31 loc) · 1.14 KB
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
SHELL := /bin/bash
.PHONY: all html txt clean
.DELETE_ON_ERROR:
# Tool configuration.
# kramdown-rfc is a Ruby gem managed by Bundler, so we invoke it via
# `bundle exec` to find the gem on the Bundler load path. This lets plain
# `make` work both locally and in CI (where ruby/setup-ruby installs gems
# under a Bundler-managed location that is not on PATH for sub-shells).
# Override via e.g. `KRAMDOWN_RFC=kramdown-rfc make` if invoking globally
# installed binaries directly.
KRAMDOWN_RFC ?= bundle exec kramdown-rfc
XML2RFC ?= xml2rfc
# Discover drafts
drafts_md := $(wildcard draft-*.md)
drafts_xml := $(drafts_md:.md=.xml)
drafts_html := $(drafts_md:.md=.html)
drafts_txt := $(drafts_md:.md=.txt)
all: html txt
html: $(drafts_html)
txt: $(drafts_txt)
# Markdown -> XML (kramdown-rfc produces v3, then normalize with xml2rfc --v2v3)
%.xml: %.md
$(KRAMDOWN_RFC) --v3 < $< | $(XML2RFC) --v2v3 /dev/stdin -o $@
# XML -> HTML (uses xml2rfc built-in CSS per RFC 7992/7993)
%.html: %.xml
$(XML2RFC) -q --html $< -o $@
# XML -> TXT
%.txt: %.xml
$(XML2RFC) -q --text --no-pagination $< -o $@
clean:
rm -f $(drafts_xml) $(drafts_html) $(drafts_txt)