aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2020-10-25 18:14:46 -0600
committerMelody Horn <melody@boringcactus.com>2020-10-25 18:14:46 -0600
commite900d76aaaa171496d6fefa28ce07e3364500743 (patch)
tree857b37a84727fbd878354b1b14489b9bcc929a08 /Makefile
parent743870947f61028c43bd414d5248fedf9bb72817 (diff)
downloadspec-e900d76aaaa171496d6fefa28ce07e3364500743.tar.gz
spec-e900d76aaaa171496d6fefa28ce07e3364500743.zip
just build with make
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 23 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f5f30d3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,23 @@
+SRC = index.md vs-c.md tagged-unions.md types.md safety.md errors.md syntax.md LICENSE.md
+HTML = $(SRC:%.md=%.html)
+
+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)
+
+%.html: %.md
+ 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
+
+check: spec.pdf
+ test $$(pdfinfo spec.pdf | grep Pages | awk '{ print $$2 }') -le 200
+
+.PHONY: clean check