.PHONY: all clean view

# Main document name (without extension)
MAIN = main

# LaTeX compiler
LATEX = lualatex
BIBER = biber

all: $(MAIN).pdf

$(MAIN).pdf: $(MAIN).tex chapters/*.tex bib/literatur.bib
	$(LATEX) $(MAIN).tex
	$(BIBER) $(MAIN)
	$(LATEX) $(MAIN).tex
	$(LATEX) $(MAIN).tex

view: $(MAIN).pdf
	xdg-open $(MAIN).pdf || open $(MAIN).pdf || echo "Open $(MAIN).pdf manually"

clean:
	rm -f $(MAIN).pdf $(MAIN).log $(MAIN).aux $(MAIN).bbl $(MAIN).bcf \
	       $(MAIN).blg $(MAIN).run.xml $(MAIN).toc $(MAIN).lof $(MAIN).lot \
	       $(MAIN).out $(MAIN).nav $(MAIN).snm $(MAIN).vrb $(MAIN).synctex.gz

cleanall: clean
	rm -f $(MAIN).pdf
