# $Id: Makefile,v 1.16 2006-01-16 01:11:40 eugene Exp $

PDFLATEX = env TEXINPUTS=.:LaTeX:$(TEXINPUTS): pdflatex
PSLATEX  = env TEXINPUTS=.:LaTeX:$(TEXINPUTS): latex

help:
	@echo "USAGE: make (target)"
	@echo "  targets:  sdrs add all sdrs-tag add-tag"

sdrs: psLibSDRS.pdf 
add: psLibADD.pdf
all : sdrs add

SDRS = psLibSDRS.tex \
       ChangeLogSDRS.tex \
       configFileTests.tex \
       timeTests.tex \
       pics/Metadata.ps \
       pics/earthrot.ps

ADD =  psLibADD.tex \
       ChangeLogADD.tex \
       raymodel.f \
       pics/rotations.ps \
       pics/earthrot.ps

psLibSDRS.pdf: $(SDRS)

psLibADD.pdf: $(ADD)

sdrs-tag:
	cvs tag `grep "version{" psLibSDRS.tex | tr "{}" " " | awk '{printf "SDRS-%02d\n", $$2}'` $(SDRS)

add-tag:
	cvs tag `grep "version{" psLibADD.tex | tr "{}" " " | awk '{printf "ADD-%02d\n", $$2}'` $(ADD)

%.pdf: %.tex
	$(PSLATEX) $*.tex 
	$(PSLATEX) $*.tex 
	dvips -z -t letter -o $*.ps $*.dvi
	ps2pdf $*.ps $*.pdf
	thumbpdf --modes=dvips $*.pdf
	$(PSLATEX) $*.tex 
	dvips -z -t letter -o $*.ps $*.dvi
	ps2pdf $*.ps $*.pdf
	@rm -f $*.ps $*.dvi $*.aux $*.log $*.tbr $*.tbd $*.toc $*.tpm $*.lof body.tmp head.tmp

clean :
	$(RM) *.log *.dvi *.aux *.toc *.tbd *.tbr *.tpm *.lof *.out *~ core body.tmp head.tmp

dist : clean
	$(RM) *.pdf

empty: clean
