TEX = pandoc
texsrc = template.tex handin.md
src = output.pdf
FLAGS = --latex-engine=xelatex
pdfname = $(shell basename $(CURDIR)).pdf

package: $(src)
	mkdir -p output
	cp $(src) output/
	mv output/output.pdf output/$(pdfname)

output.pdf : $(texsrc)
	$(TEX) $(filter-out $<,$^ ) -o $@ --template=$< $(FLAGS)

.PHONY: clean
clean :
	rm output.pdf
	rm -R output