# 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.
#
FIGS = $(wildcard *.fig)
.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) $< $@

# If this does'nt work, the following should help:
#
# >#!/bin/bash
# >for i in *.fig; do fig2dev -L pstex $i `basename $i .fig`.pstex; done
# >for i in *.fig; do fig2dev -L pstex_t $i `basename $i .fig`.pstex_t; done
#

#-----------------------------------------------------#
all: $(FIGS:.fig=.pstex) $(FIGS:.fig=.pstex_t) st.ps

st.dvi: $(FIGS:.fig=.pstex) $(FIGS:.fig=.pstex_t) st.tex 
#	latex st.tex
#	latex st.tex
#	Two times to get cross-references right

clean:
	-rm $(FIGS:.fig=.pstex) $(FIGS:.fig=.pstex_t) *.toc *.aux *.log
