Simple Makefile for LaTeX

I create figures using Gnuplot, but I use terminal epslatex, which produces a .tex file as output. I then latex this .tex file which creates are .dvi file, which I then convert to .ps and finally to an .eps file. Anyway here's what I'm doing in steps

gnuplot plot.gplt (this writes out figure.tex)
latex figure.tex
dvips figure.dvi
ps2eps -f figure.ps

I was wondering if I could automate this process. perhaps by writing a Makefile? Thanks!

Have you considered a ghostscript printer and less middlemen?

You could use suffix rules I suppose.

.gnuplot.tex:
        gnuplot $<
        mv figure.tex $@

.tex.dvi:
        dvips $<

.dvi.ps:
        ps2eps -f $<

Note that the eight spaces in front of some things are tabs and must be tabs for the makefile to work.

Put it in the same directory, named Makefile.

Then you can do make plot.ps and it will follow the chain of logic back to plot.gnuplot and generate the appropriate files in turn.