Makefile for TeX compilation 

Newsgroups: comp.text.tex

Hi,

 I use the following Makefile with toc, bibtex handling. When I will
have more time I will modify this makefile to handle index.
LATEX = latex
BIBTEX = bibtex
L2H = latex2html
PDFLATEX = ps2pdf
DVIPS = dvips

RERUN = "(There were undefined references|Rerun to get
(cross-references|the bars) right)"
RERUNBIB = "No file.*\.bbl|Citation.*undefined"

GOALS = enonce.ps enonce.pdf
DVIFILES = enonce.dvi

COPY = if test -r $*.toc; then cp $*.toc $*.toc.bak; fi
RM = /usr/bin/rm -f

main:           $(DVIFILES)

all:            $(GOALS)

%.dvi:          %.tex
                $(COPY);$(LATEX) $<
                egrep -c $(RERUNBIB) $*.log && ($(BIBTEX) $*;$(COPY);$(LATEX) $<) ;
true
                egrep $(RERUN) $*.log && ($(COPY);$(LATEX) $<) ; true
                egrep $(RERUN) $*.log && ($(COPY);$(LATEX) $<) ; true
                if cmp -s $*.toc $*.toc.bak; then . ;else $(LATEX) $< ; fi
                $(RM) $*.toc.bak
# Display relevant warnings
                egrep -i "(Reference|Citation).*undefined" $*.log ; true

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

%.pdf:          %.ps
                $(PDFLATEX) $<

clean:
                rm -f *.aux *.log *.bbl *.blg *.brf *.cb *.ind *.idx *.ilg  \
                *.inx *.ps *.dvi *.pdf *.toc *.out

Makefile for TeX compilation 

Somewhere — I have no idea where, now — I came across a Makefile for LaTeX. The name at the top of it is Stefan van den Oord, who seems to have been a student in the Netherlands. I've slightly modified it (PDF-friendly tags in the dvips invocation, a .pdf target that uses distill with A4 paper).

I can't seem to find this file anywhere on the web any more (after a cursory search with google), so I'll include it here… warning, it's a bit long (~330 lines). My signature will probably be appended after it, so watch out for that if cutting and pasting.

Mary Ellen Foster