# SAMPLE Makefile
#	for latex of paper
#	for power4 talk
#	moving fig.tar files 
######################################################

#variables
######################################################
p=p
p=io

######################################################
# defaults: either paper or slides or programs
######################################################
default: prog
#default: dvi
#default: slide

######################################################
# Targets for programs
######################################################

prog gcc:
	gcc ${p}.c -o ${p}

test:
	${p}
	
######################################################
# Targets for paper
######################################################
	
dvi ${p}.dvi:	${p}.tex
	latex ${p}.tex 

ps ${p}.ps:	${p}.tex ${p}.dvi
	dvips -t letter ${p}.dvi -o

bib ${p}.bbl:
	bibtex ${p}

gv:
	# ideal for my solaris display
	gv ${p}.ps -geometry 800x800-20+10 &

gvv:
	# ideal for my laptop display
	gv ${p}.ps -geometry 1000x700+20+10 &

vi:
	gvim ${p}.tex &

spell:
	aspell -c ${p}.tex

pdf ${p}.pdf:	${p}.dvi
	dvips -o ${p}.ps -Ppdf ${p}
	ps2pdf ${p}.ps ${p}.pdf

${p}.ps.gz gz:	${p}.ps
	gzip ${p}.ps

cp: pdf
	cp ${p}.pdf ~/tmp/tmp
	chmod a+rw ~/tmp/tmp/${p}.pdf

a8:	${p}.ps
	a2ps -1 -Pnhp8 ${p}.ps &

a1 a a23: ${p}.ps
	a2ps -1 -Pnhp23 ${p}.ps &

# how to do simplex with pdf file?
l8:	${p}.ps
	lp -dnhp8 -osimplex ${p}.ps

######################################################
#Targets for cvs
######################################################

old-com:
	export CVSROOT=:ext:yap@dept.cs.nyu.edu:/home/yap/cvsroot ; cvs commit

com commit:
	-@cvs commit -m "" 

# Update: -I = ignore list, -l = local (nonrecursive)
cvsupdate:
	cvs update -l -I '*.aux *.pdf *.ps *.dvi *.blg *.log *.swp *.bbl'
	(cd figs; cvs update -I '*.tex *.eps *.ps')

# Update: -I = ignore list, -l = local (nonrecursive) 
#	We need -l since figs is a subdirectory with different ignores.
#	Bug: if figs subdirectory is missing, error (ignore it)
up update:
	-@cvs update -l \
	   -I '*.aux *.pdf *.ps *.dvi *.blg *.log *.swp *.bbl *.tmp *.swp *.swo *.swn'
	-@cd figs; cvs update -I '*.tex *.eps *.ps *.swp *.swo *.swn'

# just for figs directory:
upfig:
	-@cvs update -I '*.tex *.eps *.ps *.swp *.swo *.swn'

######################################################
#Targets for slides
######################################################

slide pp4:	$(p)-tmp.pdf
	pp4 $(p)-tmp.pdf $(p).pdf

tmp $(p)-tmp.pdf: $(p).tex
	pdflatex $(p).tex
	mv $(p).pdf $(p)-tmp.pdf

ac: $(p).pdf
	acroread $(p).pdf

out outline:
	latex outline.tex


######################################################
# Housekeeping
######################################################
file=fig.tar 
curpath=pap/cur/exact/mesh/isotopic

figtar:
	-@gtar cvf $(file) --exclude=CVS \
		figs

get:
	scp4 $(curpath)/$(file) 
	-@tar xvf $(file)

put:
	scp2 $(file) $(curpath)

save:
	-@ci -m"make save"  -l ${p}.tex Makefile \
		lmac.tex
	
tar:
	-@tar cvf T.tar \
		t.tex Makefile lmac.tex figs \
		abstract.txt Notes

clean:
	-@rm -f *-tmp.pdf
	-@rm -f *.log *.aux *.dvi *.out
