diff options
author | Melody Horn <melody@boringcactus.com> | 2020-10-28 17:01:55 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2020-10-28 17:01:55 -0600 |
commit | edf87f09045e8f56576b37078b4a0d220d6ddf55 (patch) | |
tree | 4503afb80ee7ea068db257c6381541a5fe1f716b /Makefile | |
parent | 72e8cabe8e3c8ae272fb4771f0d1dabb306dc2ae (diff) | |
download | spec-edf87f09045e8f56576b37078b4a0d220d6ddf55.tar.gz spec-edf87f09045e8f56576b37078b4a0d220d6ddf55.zip |
start using Sphinx for doc generation
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 52 |
1 files changed, 19 insertions, 33 deletions
@@ -1,46 +1,32 @@ .POSIX: .SUFFIXES: -.SUFFIXES: .md .html .gmi # commands GIT = git -PANDOC = pandoc +SPHINXBUILD = sphinx-build +SPHINXOPTS = +SPHINXDEFVER = -D version="$$($(GIT) describe --tags --exact-match 2>/dev/null || $(GIT) log -1 --no-decorate --oneline)" +SPHINXFULLOPTS = $(SPHINXDEFVER) $(SPHINXOPTS) +SOURCEDIR = . +BUILDDIR = _build PDFINFO = pdfinfo -# input files -SRC = index.md vs-c.md tagged-unions.md types.md safety.md errors.md syntax.md LICENSE.md -HTML = $(SRC:.md=.html) -GMI = $(SRC:.md=.gmi) +all: html pdf epub # gmi -all: spec.pdf $(GMI) +html: Makefile + @$(SPHINXBUILD) -M html "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXFULLOPTS) -spec.pdf: $(HTML) - @if $(GIT) describe --tags --exact-match 2>/dev/null; \ - then \ - metadata="subtitle=$$($(GIT) describe --tags --exact-match)"; \ - else \ - metadata="version=$$($(GIT) log -1 --no-decorate --oneline)"; \ - fi; \ - $(PANDOC) --defaults=etc/pdf.yml -M "$$metadata" -o $@ $(HTML) +gmi: Makefile + @$(SPHINXBUILD) -M gmi "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXFULLOPTS) -.md.html: - @offset=`echo $(SRC) | awk '{for (i=1; i<=NF; i++) if ($$i == "$<") print (i-1) }'`; \ - $(PANDOC) --defaults=etc/md.yml --number-offset=$$offset -o $@ $< +pdf: Makefile + @$(SPHINXBUILD) -M rinoh "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXFULLOPTS) -.md.gmi: - @offset=`echo $(SRC) | awk '{for (i=1; i<=NF; i++) if ($$i == "$<") print (i-1) }'`; \ - $(PANDOC) --defaults=etc/md.yml --write=etc/gemtext.lua --template=etc/template.gmi --number-offset=$$offset -o $@ $< +epub: Makefile + @$(SPHINXBUILD) -M epub "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXFULLOPTS) -clean: clean-pdf clean-html clean-gmi +clean: + rm -rf _build/* -clean-pdf: - rm -f spec.pdf - -clean-html: - rm -f $(HTML) - -clean-gmi: - rm -f $(GMI) - -check: spec.pdf - test $$($(PDFINFO) spec.pdf | grep Pages | awk '{ print $$2 }') -le 200 +check: pdf + test $$($(PDFINFO) _build/rinoh/crowbarlanguage.pdf | grep Pages | awk '{ print $$2 }') -le 200 |