#please use gmake 
#add acro for distill/ps2pdf

document = lecture3
SOURCES = $(wildcard *.tex)
FIGURES = $(wildcard figures/*)

#don't bother to check the source files.  Assume they are out of date.
.PHONY : $(SOURCES)

all: $(document).dvi
ps: $(document).ps
pdf: $(document).pdf

$(document).pdf : $(document).dvi
	dvips $(document).dvi -Ppdf
	ps2pdf $(document).ps

$(document).ps : $(document).dvi
	dvips -f $(document).dvi > $(document).ps

$(document).dvi : $(SOURCES) $(FIGURES)
	latex $(document)
	bibtex $(document)
	latex $(document)
	latex $(document)

backup : clean
	tar czvf thesis.tgz *
	scp thesis.tgz athena.dialup.mit.edu:.

clean:
	rm -f *.dvi *.aux *.bbl *.log *.blg *.lot *.lof $(document).ps $(document).pdf thesis.tgz
