#
# Makefile to latex document, uncompress .ps files etc...
# original version : Mark Ito
# modified:
#
#     use for hadron05 paper - Elton Smith 9/30/03
#     html output de-activated for now
#     halld_safety - Elton Smith 10/16/06
#     cc_geometry - Elton Smith 10/16/06
#     bcal_specs - Elton Smith 04/02/07
#     halld_specs - Elton Smith 08/27/07
#     feldman_cousins - Elton Smith 09/17/07
#     feldman_cousins systematics  - Elton Smith 08/05/08
#     cdc_segments  - Elton Smith 09/31/08
#     sipm_cooling  - Elton Smith 09/31/08
#
#
TEX_FILES_0 = sipm_cooling

TEX_FILES = $(addsuffix .tex,$(TEX_FILES_0)) # add .tex suffix

PS_FILES_0 = 
PS_FILES = $(addsuffix .ps,$(PS_FILES_0)) # add .ps suffix

EPS_FILES_0 = bcal_drpde_tradeoff2_T10photonique  bcal_drpde_tradeoff2_T10sensl \
              bcal_drpde_tradeoff2_T20 bcal_drpde_tradeoff2_T5photonique \
              bcal_drpde_tradeoff2_T5sensl bcal_drpde_tradeoff2_T5lightfoot \
              bcal_drpde_tradeoff2_T10lightfoot fit_dr fit_pde fit_pde_slope \

EPS_FILES = $(addsuffix .eps,$(EPS_FILES_0)) # add .eps suffix

all : sipm_cooling.ps

sipm_cooling.dvi : $(TEX_FILES) Makefile sipm_cooling.bbl $(PS_FILES) \
               $(EPS_FILES)                      # make the dvi file
	latex sipm_cooling
	latex sipm_cooling

sipm_cooling.bbl : sipm_cooling.bib $(TEX_FILES) $(PS_FILES) $(EPS_FILES)
	latex sipm_cooling
	bibtex sipm_cooling

tar : $(TEX_FILES) $(PS_FILES) $(EPS_FILES) # tar files; will remove old tar files
	rm -f sipm_cooling.tar
	rm -f sipm_cooling.tar.gz
	rm -rf sipm_cooling
	mkdir sipm_cooling
	cp sipm_cooling.ps sipm_cooling
	cp sipm_cooling.bib sipm_cooling
	cp $(TEX_FILES) sipm_cooling
	cp $(EPS_FILES) sipm_cooling
#	cp $(PS_FILES) sipm_cooling
	cp bcal_drpde_tradeoff2.C sipm_cooling
	cp fit_dr.C sipm_cooling
	cp fit_pde.C sipm_cooling
	cp trig_efficiency.C  sipm_cooling
	cp sipm_cooling.pdf sipm_cooling
	cp Makefile sipm_cooling
	tar cvf sipm_cooling.tar sipm_cooling
	gzip sipm_cooling.tar
#	rm -rf sipm_cooling

%.ps : %.dvi
	dvips -t letter -o $*.ps $* 
	dvipdf $*.dvi $*.pdf


%.dvi : %.tex
	latex $*
	latex $*

%.ps : %.ps.gz
	gunzip -l $*.ps.gz
	rm -f $*.ps
	gunzip -c $*.ps.gz > $*.ps

%.eps : %.eps.gz
	gunzip -l $*.eps.gz
	rm -f $*.eps
	gunzip -c $*.eps.gz > $*.eps

#
#
% : %.dvi
#	'rm' -rf $*
#	latex2html $*      # produce html pages

clean:
	rm -f sipm_cooling.dvi sipm_cooling.ps