###############################################################################
#
# Based on Makefile for a sample CDF Note by
#                                  Stefan Stonjek  <s.stonjek@physics.ox.ac.uk>
#                                  Martin Hennecke <hennecke@fnal.gov> 
#
###############################################################################

graphics_eps := $(wildcard *.eps)
graphics_pdf := $(patsubst %.eps,%.pdf,$(wildcard figs/*.eps)) $(patsubst %.eps.gz,%.pdf,$(wildcard figs/*.eps.gz))

ps: BTag_Plans_Summer2003.ps
	gv BTag_Plans_Summer2003.ps

pdf: BTag_Plans_Summer2003.pdf
	acroread BTag_Plans_Summer2003.pdf

BTag_Plans_Summer2003.pdf: BTag_Plans_Summer2003.tex $(graphics_pdf)
	pdflatex BTag_Plans_Summer2003.tex && thumbpdf BTag_Plans_Summer2003 && pdflatex BTag_Plans_Summer2003.tex

BTag_Plans_Summer2003.ps: BTag_Plans_Summer2003.tex
	latex BTag_Plans_Summer2003.tex && latex BTag_Plans_Summer2003.tex && dvips BTag_Plans_Summer2003.dvi -o 

%.pdf: %.eps
	epstopdf --outfile=$@ $< 

%.pdf: %.eps.gz
	gunzip $<
	epstopdf --outfile=$@ $(subst .gz,,$<)
	gzip --best $(subst .gz,,$<)

.PHONY: clean
clean: nearlyclean
	rm -r -f *.pdf *.ps

nearlyclean:
	rm -r -f *.aux *.dvi *.log *.out \
	*.toc *.tof *.bbl *.blg *.brf *.fot \
        thumb*.* *~ $(graphics_pdf)
