all: ma.md bibma.bib template.tex settings/abkuerzungen.tex settings/commands.tex settings/environments.tex settings/hyphenation.tex settings/packages.tex files/titlepage.tex files/erklaerung.tex
	pandoc -s -N --template=template.tex ma.md -o ma.tex
	rm -f ma.pdf ma.aux ma.idx ma.lof ma.log ma.lot ma.out ma.tdo ma.toc ma.bbl ma.blg ma.loa
	xelatex -interaction batchmode ma.tex || true
	bibtexu ma
	xelatex -interaction batchmode ma.tex || true
	while test `cat ma.log | grep -e "\(Rerun to get citations correct\)" | wc -l` -gt 0 ; do \
		rm ma.log && (xelatex -interaction batchmode ma.tex || true) \
	done
	rm -f ma.aux ma.idx ma.lof ma.lot ma.out ma.tdo ma.toc ma.bbl ma.blg ma.loa
	# rm -f ma.log


clean:
	rm -f ma.pdf ma.aux ma.idx ma.lof ma.log ma.lot ma.out ma.tdo ma.toc ma.bbl ma.blg ma.loa
	rm -f ma.tex
