.SILENT:

.PHONY : all clean ps

TNUM = 4B
RNUM = $(TNUM)

vtex: tex
	latex trial$(TNUM).tex
	dvips -o trial$(TNUM).ps trial$(TNUM).dvi
	gv -scalebase 8 trial$(TNUM).ps

vplt: plt
	echo "Launching xfig with newly created file"
	xfig -nosp trial$(TNUM).fig &

tex:
	rm -f trial$(TNUM).tex inc_trial$(TNUM).tex
	rep2tex -rep trial$(TNUM).rep -res trial$(RNUM).res \
	-tex trial$(TNUM).tex -inc inc_trial$(TNUM).tex

plt: 
	echo "Making plot data with rep2tex...."
	rep2tex -rep trial$(TNUM).rep2 -res trial$(RNUM).res \
	-plt trial$(TNUM).plt >& /dev/null
	echo "Building fig data with gnuplot...."
	gnuplot trial$(TNUM).gp >& /dev/null

itex: 
	echo "Making " inc_trial$(TNUM).tex
	rm -f trial$(TNUM).tex inc_trial$(TNUM).tex
	rep2tex -rep trial$(TNUM).rep -res trial$(RNUM).res \
	-tex trial$(TNUM).tex -inc inc_trial$(TNUM).tex >& /dev/null
	echo "Moving " inc_trial$(TNUM).tex "into place"; echo
	mv -f inc_trial$(TNUM).tex ../

iplt: 
	echo "Making " trial$(TNUM).plt
	rep2tex -rep trial$(TNUM).rep2 -res trial$(RNUM).res \
	-plt trial$(TNUM).plt >& /dev/null
	echo "Making " trial$(TNUM).fig
	gnuplot trial$(TNUM).gp >& /dev/null
	echo "Moving " trial$(TNUM).fig "into place"; echo
	mv -f trial$(TNUM).fig ../

clean:
	rm -f *.dvi *.pdf *~ *.log *.tex *.plt
	rm -f *.bbl *.blg *.ps *.aux *.bak *.fig