# Makefile for the documentation file "st.tex" - gernerates postscript 
# images from .fig files -- fig2dev required, and also transfig.tex.
# 
# You will have to do a  make twice to get crossreferences right.
#
# $Id: Makefile,v 1.6 1996/06/18 20:03:54 i2c Exp $

FIGS 	= $(wildcard *.fig)
MAIN	= i2c
PARTS 	= chap1.tex chap2.tex chap3.tex chap4.tex chap5.tex app1.tex
BIBLIO	= i2c.bib

.SUFFIXES: .ps .dvi .tex .fig

%.ps: %.dvi
	dvips -o $@ $<  

%.dvi: %.tex
	latex $<

%.pstex: %.fig
	fig2dev -L pstex $< $@

%.pstex_t: %.fig
	fig2dev -L pstex_t -p $(@:.pstex_t=.pstex) $< $@

#-----------------------------------------------------#
all: $(MAIN).dvi

$(MAIN).dvi: $(MAIN).bbl
	latex $(MAIN)

$(MAIN).bbl: $(MAIN).aux
	bibtex $(MAIN)

$(MAIN).aux: $(PARTS) $(BIBLIO) $(FIGS:.fig=.pstex) $(FIGS:.fig=.pstex_t) $(MAIN).tex 
	latex $(MAIN)
	latex $(MAIN)

# creates a first (incomplete) dvi-file & bibliography
#$(MAIN).aux: $(PARTS) $(BIBLIO)
#	latex $(MAIN)
#	bibtex $(MAIN)
#	touch $(MAIN).tex
clean:
	-rm $(FIGS:.fig=.pstex) $(FIGS:.fig=.pstex_t) *.toc *.aux *.log *.blg *.bbl
