#
# Makefile for acmart package
#
# This file is in public domain
#
# $Id: Makefile,v 1.10 2016/04/14 21:55:57 boris Exp $
#

PACKAGE=midl
BASENAME=midl24_211
LATEX_COMPILER=pdflatex
LATEX_FLAGS=-shell-escape

BIB_COMPILER=bibtex

TRASH_FILES=*.aux .bb *.bl *.lo *.lo *.nl *.ou *.to *.bc *.run.xml *.bbl *.blg *.fdb_latexmk *.fls *.log *.toc *.synctex.gz *.acn *.glo *.ist *.lof *.lot *.out *.acr *.alg *.glg *.gls *.glsdefs *.lol *.dvi *.ps *.tgz *.zip *.rpi *.hd *.cb *.cb2

SECTIONS := $(shell find $(PWD)/sections -name '*.tex')

all: main.pdf

main.pdf: ${BASENAME}.tex $(PACKAGE).cls $(SECTIONS) 
	pdflatex -shell-escape -halt-on-error ${BASENAME}.tex
	bibtex ${BASENAME}
	pdflatex -shell-escape -halt-on-error ${BASENAME}.tex
	pdflatex -shell-escape  -halt-on-error ${BASENAME}.tex
	pdflatex -shell-escape  -synctex=1 -halt-on-error ${BASENAME}.tex # changebar is still fragile

supplementary.pdf: supplementary.tex
	pdflatex -synctex=1 supplementary.tex
	pdflatex -synctex=1 supplementary.tex

.PRECIOUS:  acmart.cfg acmart.cls

docclean:
	$(RM) $(TRASH_FILES) sections/*.aux

clean: docclean distclean

distclean:
	$(RM) $(BASENAME).pdf

.PHONY: all docclean clean distclean
