aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: f5f30d3f9b317178183110726195f3c4d852d744 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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