LATEX = xelatex -halt-on-error -interaction=nonstopmode

.PHONY: clean copy-s3

# Without this, a failed xelatex leaves a partial prezo.pdf that is newer
# than prezo.tex, so the next `make` reports "up to date" on a broken build.
.DELETE_ON_ERROR:

# Drop the aux files so the QR codes and TOC are recalculated from scratch,
# but keep the previous prezo.pdf until the new one succeeds.
prezo.pdf: prezo.tex images/* Makefile
	rm -f prezo.aux prezo.nav prezo.out prezo.snm prezo.toc
	$(LATEX) prezo.tex
	$(LATEX) prezo.tex

clean:
	rm -f prezo.pdf prezo.aux prezo.log prezo.nav prezo.out prezo.snm prezo.toc prezo.vrb prezo.fls prezo.fdb_latexmk

files.tar.gz: prezo.tex images/* Makefile LICENSE
	tar zcf files.tar.gz prezo.tex images/ Makefile LICENSE


copy-s3: prezo.pdf files.tar.gz
	aws s3 cp prezo.pdf s3://screenshotbot-assets/nextapp26.pdf
	aws s3 cp files.tar.gz s3://screenshotbot-assets/nextapp26.tar.gz
