2019-08-06 05:58:27 -07:00
|
|
|
# Dependencies:
|
2020-06-15 05:17:10 -07:00
|
|
|
# sudo apt-get install python3-pip pandoc perl sed
|
2020-05-12 07:54:17 -07:00
|
|
|
# sudo pip3 install rst2html5
|
2019-08-05 16:46:18 -07:00
|
|
|
|
2020-07-05 09:12:07 -07:00
|
|
|
.PHONY: all all-zips release protocol discard
|
2020-04-14 05:06:08 -07:00
|
|
|
all-zips: .Makefile.uptodate
|
2020-05-26 15:03:45 -07:00
|
|
|
find . -name 'zip-*.rst' -o -name 'zip-*.md' |sort >.zipfilelist.new
|
2020-04-14 05:08:16 -07:00
|
|
|
diff .zipfilelist.current .zipfilelist.new || cp -f .zipfilelist.new .zipfilelist.current
|
|
|
|
rm -f .zipfilelist.new
|
2019-08-24 06:36:41 -07:00
|
|
|
$(MAKE) README.rst
|
2020-09-15 07:15:01 -07:00
|
|
|
$(MAKE) index.html $(addsuffix .html,$(filter-out README,$(basename $(sort $(wildcard *.rst) $(wildcard *.md)))))
|
2019-08-24 05:56:44 -07:00
|
|
|
|
2020-01-05 12:54:51 -08:00
|
|
|
all: all-zips protocol
|
|
|
|
|
2020-07-05 08:04:48 -07:00
|
|
|
release:
|
|
|
|
$(MAKE) -C protocol release
|
|
|
|
|
|
|
|
protocol:
|
2020-01-05 12:54:51 -08:00
|
|
|
$(MAKE) -C protocol
|
|
|
|
|
2020-07-05 09:12:07 -07:00
|
|
|
discard:
|
|
|
|
git checkout -- '*.html' 'protocol/*.pdf'
|
|
|
|
|
2020-04-14 05:06:08 -07:00
|
|
|
.Makefile.uptodate: Makefile
|
2020-03-10 09:38:14 -07:00
|
|
|
$(MAKE) clean
|
2020-04-14 05:06:08 -07:00
|
|
|
touch .Makefile.uptodate
|
2020-03-10 09:38:14 -07:00
|
|
|
|
2020-03-10 06:05:31 -07:00
|
|
|
define PROCESSRST
|
2020-05-12 07:55:06 -07:00
|
|
|
$(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||'))
|
2020-03-10 06:05:31 -07:00
|
|
|
rst2html5 -v --title="$(TITLE)" $< >$@
|
2020-05-26 15:03:45 -07:00
|
|
|
./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}"
|
2020-03-10 06:05:31 -07:00
|
|
|
endef
|
|
|
|
|
2020-04-22 06:35:00 -07:00
|
|
|
index.html: README.rst edithtml.sh
|
2020-03-10 06:05:31 -07:00
|
|
|
$(PROCESSRST)
|
2019-08-24 06:36:41 -07:00
|
|
|
|
2020-04-22 06:35:00 -07:00
|
|
|
%.html: %.rst edithtml.sh
|
2020-03-10 06:05:31 -07:00
|
|
|
$(PROCESSRST)
|
2019-08-05 17:21:10 -07:00
|
|
|
|
2020-05-26 15:03:45 -07:00
|
|
|
%.html: %.md edithtml.sh
|
|
|
|
$(PROCESSMD)
|
|
|
|
|
2020-09-15 07:15:01 -07:00
|
|
|
README.rst: .zipfilelist.current makeindex.sh README.template $(sort $(wildcard zip-*.rst) $(wildcard zip-*.md))
|
2019-08-24 06:36:41 -07:00
|
|
|
./makeindex.sh | cat README.template - >README.rst
|
2019-08-05 17:21:10 -07:00
|
|
|
|
2021-09-09 06:58:42 -07:00
|
|
|
.PHONY: linkcheck
|
|
|
|
linkcheck: protocol/protocol.pdf protocol/canopy.pdf protocol/heartwood.pdf protocol/blossom.pdf protocol/sapling.pdf
|
|
|
|
./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
|
|
|
|
|
2019-08-24 05:56:44 -07:00
|
|
|
.PHONY: clean
|
2019-08-05 17:21:10 -07:00
|
|
|
clean:
|
2020-09-15 07:15:01 -07:00
|
|
|
rm -f .zipfilelist.* README.rst index.html $(addsuffix .html,$(basename $(sort $(wildcard *.rst) $(wildcard *.md))))
|