PANDOC ?= pandoc
PYTHON ?= python3

.PHONY: all checks clean
all: higher-egraphs-futamura.pdf

higher-egraphs-futamura.tex: manuscript.md appendices.md metadata.yaml header.tex
	$(PANDOC) manuscript.md appendices.md --from=markdown+tex_math_dollars+raw_tex --standalone --metadata-file=metadata.yaml --include-in-header=header.tex --to=latex -o $@

higher-egraphs-futamura.pdf: higher-egraphs-futamura.tex
	pdflatex -interaction=nonstopmode -halt-on-error $<
	pdflatex -interaction=nonstopmode -halt-on-error $<

checks:
	$(PYTHON) checks.py > checks-result.json

clean:
	rm -f higher-egraphs-futamura.aux higher-egraphs-futamura.log higher-egraphs-futamura.out
