#General Makefile for latex
#Makes ps and pdf
#Can also make html
#Works on all *.tex files in directory
#makeinex and bibtex must be manually turned on or off in this file
#initally written jcv 06/16/2005
#v1.0
#I had wrong version up that looked for main.tex
#now it does any .tex files in a directory
#09/15/2006
#v1.1
#It is no longer necessary to comment or uncomment bibtex.
#Makefile works if you need bibtex or not.
#05/02/2007
#v1.2
#Copyright 2005-2007 John C. Vernaleo

#               (my_first_name)@netpurgatory.com
#                               or
#               (my_last_name)@astro.umd.edu
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

#see readme_makefile.latex.txt for more information and gpl.txt for a
#copy of the GPL

#Possible targets are:
#all, html, clean, cleaner, htmlclean

RM = rm -rf

BASE = ${wildcard *.tex}
FILES = ${BASE:%.tex=%.pdf}

all:	${FILES}

%.pdf:	*.tex
	latex $*
#	makeindex $*
	- bibtex $*
	latex $*
	latex $*
	dvips -Ppdf -o$*.ps $*.dvi
	ps2pdf14 $*.ps

html:	${BASE:%.tex=%}

%:	%.tex
	latex2html $*

clean:
	${RM} ${BASE:%.tex=%.log}
	${RM} ${BASE:%.tex=%.dvi}	
	${RM} *.aux
	${RM} ${BASE:%.tex=%.ps}
	${RM} ${BASE:%.tex=%.blg}

cleaner: clean
	${RM} ${BASE:%.tex=%.bbl}
	${RM} ${FILES}

htmlclean:
	${RM} ${BASE:%.tex=%/}
