forked from zcash/zips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (43 loc) · 1.84 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
# Dependencies: see zip-guide.rst and protocol/README.rst
.PHONY: all all-zips release protocol discard
all-zips: .Makefile.uptodate
find . -name 'zip-*.rst' -o -name 'zip-*.md' |sort >.zipfilelist.new
diff .zipfilelist.current .zipfilelist.new || cp -f .zipfilelist.new .zipfilelist.current
rm -f .zipfilelist.new
$(MAKE) README.rst
$(MAKE) index.html $(addsuffix .html,$(filter-out README,$(basename $(sort $(wildcard *.rst) $(wildcard *.md)))))
all: all-zips protocol
release:
$(MAKE) -C protocol release
protocol:
$(MAKE) -C protocol
discard:
git checkout -- '*.html' 'protocol/*.pdf'
.Makefile.uptodate: Makefile
$(MAKE) clean
touch .Makefile.uptodate
define PROCESSRST
$(eval TITLE := $(shell echo '$(basename $<)' | sed -E 's|zip-0{0,3}|ZIP |;s|draft-|Draft |')$(shell grep -E '^(\.\.)?\s*Title: ' $< |sed -E 's|.*Title||'))
rst2html5 -v --title="$(TITLE)" $< >$@
./edithtml.sh --rst $@
endef
define PROCESSMD
$(eval TITLE := $(shell echo '$(basename $<)' | sed -E 's|zip-0{0,3}|ZIP |;s|draft-|Draft |')$(shell grep -E '^(\.\.)?\s*Title: ' $< |sed -E 's|.*Title||'))
pandoc --from=markdown --to=html $< --output=$@
./edithtml.sh --md $@ "${TITLE}"
endef
index.html: README.rst edithtml.sh
$(PROCESSRST)
%.html: %.rst edithtml.sh
$(PROCESSRST)
%.html: %.md edithtml.sh
$(PROCESSMD)
README.rst: .zipfilelist.current makeindex.sh README.template $(sort $(wildcard zip-*.rst) $(wildcard zip-*.md))
./makeindex.sh | cat README.template - >README.rst
.PHONY: linkcheck
linkcheck: all-zips
$(MAKE) -C protocol all-specs
./links_and_dests.py --check $(filter-out $(wildcard draft-*.html),$(wildcard *.html)) protocol/protocol.pdf protocol/canopy.pdf protocol/heartwood.pdf protocol/blossom.pdf protocol/sapling.pdf
.PHONY: clean
clean:
rm -f .zipfilelist.* README.rst index.html $(addsuffix .html,$(basename $(sort $(wildcard *.rst) $(wildcard *.md))))