compilePdfOptions=--shell-escape #-interaction=nonstopmode
compPdftex=lualatex ${compilePdfOptions}
compile= ${compPdftex}

TARGET=main.pdf
FILES=*.tex

.SECONDEXPANSION:

####################  COMPILE PDF  ######################

SUMMARY = grep "\(error\|warn\|warning\|repeated\|skipping\)" -in --color

all: bin/${TARGET}

bin/%.pdf : ${FILES}
	mkdir -p bin
	${compile}  $*
	-bibtex $*
	-bibtex $*
	${compile} $*
	${compile} $*
	${compile} $*
	mv $*.pdf $@
	cp $@ ~/Dropbox/2022-07-talk-siam.pdf
	${SUMMARY} *.log *.blg
	#make clean
	@echo Done ....!

fast/%.pdf : ${FILES}
	mkdir -p fast
	${compile}  $*
	-bibtex $*
	-bibtex $*
	#${compile}  $*
	#${compile}  $*
	mv $*.pdf $@
	cp $@ ~/Dropbox/2022-07-talk-siam.pdf
	@echo Done ....!

########################  CLEAN  ########################

cleanall: clean
	rm -r -f fast/*.pdf bin/*.pdf
	@echo Cleaned All ....! 

clean:
	rm -f *.aux *.dvi *.blg *.bbl *.out *.log */*.log */*/*.log *~ */*~ */*/*~
	rm -f *.toc *.snm *.out *.nav *.cb *.cb2
	@echo Cleaned ....! 

