diff options
author | Melody Horn <melody@boringcactus.com> | 2020-10-26 23:22:29 -0600 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2020-10-26 23:22:29 -0600 |
commit | 5ada504d5667a6f17ee2631dd471b073b332dd33 (patch) | |
tree | 130ed731247e5fe01ed2fae366e7bf08aef46b37 /Makefile | |
parent | c7ce2058a94c7fbd22fc409738ad8d15af30b170 (diff) | |
download | spec-5ada504d5667a6f17ee2631dd471b073b332dd33.tar.gz spec-5ada504d5667a6f17ee2631dd471b073b332dd33.zip |
build spec in gemtext too
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -1,6 +1,6 @@ .POSIX: .SUFFIXES: -.SUFFIXES: .md .html +.SUFFIXES: .md .html .gmi # commands GIT = git @@ -10,9 +10,12 @@ 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: spec.pdf $(GMI) spec.pdf: $(HTML) - if $(GIT) describe --tags --exact-match 2>/dev/null; \ + @if $(GIT) describe --tags --exact-match 2>/dev/null; \ then \ metadata="subtitle=$$($(GIT) describe --tags --exact-match)"; \ else \ @@ -21,11 +24,23 @@ spec.pdf: $(HTML) $(PANDOC) --defaults=etc/pdf.yml -M "$$metadata" -o $@ $(HTML) .md.html: - offset=`echo $(SRC) | awk '{for (i=1; i<=NF; i++) if ($$i == "$<") print (i-1) }'`; \ + @offset=`echo $(SRC) | awk '{for (i=1; i<=NF; i++) if ($$i == "$<") print (i-1) }'`; \ $(PANDOC) --defaults=etc/md.yml --number-offset=$$offset -o $@ $< -clean: - rm -f $(HTML) spec.pdf +.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 $@ $< + +clean: clean-pdf clean-html clean-gmi + +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 |