#---------------------------------------------------------------
#                            Makefile
# Note the use of latexmk, to make sure that the paper is only 
# regenerated when the latex source file changes
#---------------------------------------------------------------
.SILENT:

PAPER    = bhv_loiter
FIGSDIR  = $(CURDIR)/figures/
MAKETK   = "pdflatex -interaction=nonstopmode"

.PHONY : $(PAPER).pdf all clean

all: $(PAPER).pdf 

$(PAPER).pdf: $(PAPER).tex
	latexmk -pdf -pdflatex=$(MAKETK) -use-make $(PAPER).tex

pdfo: all cleanx
	open $(PAPER).pdf &

pdfoo: all cleanx
	open -a Preview $(PAPER).pdf &

pdfv: 
	open $(PAPER).pdf &

cleanx:
	rm -f *~  $(PAPER).log $(PAPER).ind
	rm -f $(PAPER).bbl $(PAPER).blg  $(PAPER).aux
	rm -f $(PAPER).idx $(PAPER).ilg
	rm -f $(PAPER).out *.log $(PAPER).toc
	rm -f $(PAPER)*.adx $(PAPER).bdx $(PAPER).cdx $(PAPER).mdx
	rm -f $(PAPER)*.fls $(PAPER).fdb_latexmk
	rm -f biblio.bib citations.tex 

clean: cleanx
	rm -f $(PAPER).pdf  $(PAPER)
	rm -f biblio.bib citations.tex