#!/usr/bin/make

# fonts.tex is a fragment meant to be \input, not a document of its own, so it
# has to stay out of the list or make will try to typeset it.
TEX := $(filter-out fonts.tex,$(wildcard *.tex))
PDF := $(patsubst %.tex,%.pdf,$(TEX))
JOB := $(patsubst %.tex,%,$(TEX))

all: slides
slides: vc $(PDF)

%.pdf: %.tex
	latexmk -f -lualatex $<

# Double-width pages, slide left and notes right, for dspdfviewer and pdfpc.
# The notes pages are typeset with the same fonts as the slides.
notes: slides
	./mknotes $(JOB)

vc:
	resources/vc-git

viewpdf: slides
	evince $(PDF)

pdfpc: notes
	pdfpc -n right $(JOB)-notes.pdf

spell:
	aspell -c -t --tex-check-comments -b $(TEX)

clean:
	latexmk -C $(TEX)
	rm -f *.notes *.tmp *.nav *.snm *.pdfpc *-luamml-mathml.html
	rm -f vc
	rm -f $(JOB)-notes.pdf

.PHONY: all slides notes vc viewpdf pdfpc spell clean
