LATEX_BASE = ../../../../latex
RUBBER_OPTS = -m lualatex:pdf --shell-escape -I "$(LATEX_BASE)"

PANDOC_FILTER_DIR = ../../../../pandoc
PANDOC_FILTERS = --lua-filter "$(PANDOC_FILTER_DIR)/center-img.lua" --lua-filter "$(PANDOC_FILTER_DIR)/include-files.lua" --no-highlight --lua-filter "$(PANDOC_FILTER_DIR)/minted.lua"
SLIDE_OPTIONS = --standalone --slide-level 2 -t beamer

%.pdf: %.tex $(wildcard img/*)
	rubber $(RUBBER_OPTS) $< && rubber --clean -q $<

slides.tex: slides.md | Makefile
	pandoc $(SLIDE_OPTIONS) --pdf-engine=lualatex $(PANDOC_FILTERS) $< -o $@

slides_handout.tex: slides.md | Makefile
	pandoc $(SLIDE_OPTIONS) -M handout --pdf-engine=lualatex $(PANDOC_FILTERS) $< -o $@

.PHONY:
clean:
	rm -f slides.pdf; rm -f slides.tex
