UK TeX FAQ -- question 194

### Makefiles for LaTeX documents

LaTeX is a tricky beast for running make on: the need to instruct LaTeX to run several times for essentially different reasons (for example, "get the table of contents stable", "get the labels stable", "add the bibliography", "add the index") is actually rather difficult to express in the 'ordinary' sort of dependency graph that one constructs for make.

For this reason, the only make-like package on CTAN (for a long time) was latexmk, which is a Perl script that analyses your LaTeX source for its dependencies, runs BibTeX or makeindex as and when it notices that those programs' input (parts of the `.aux` file, or the `.idx` file, respectively) has changed, and so on. Latexmk is a fine solution (and was used in generating printable versions of these FAQs for a long time); it has recently been upgraded and has many bells and whistles that allow it to operate as if it were a poor man's WYSIWYG system.

The texinfo system comes with a utility called texi2dvi, which is capable of "converting" either LaTeX or texinfo files into DVI (or into PDF, using PDFTeX).

A later contribution is the bundle latexmake, which offers a set of make rules that invoke texi2dvi as necessary.

The curious may examine the rules employed to run the present FAQ through LaTeX: we don't present them as a complete solution, but some of the tricks employed are surely re-usable.

`FAQ distribution`
  help/uk-tex-faq.tar.gz
`latexmake`
  support/latexmake.tar.gz
`latexmk`
  support/latexmk.tar.gz
`texi2dvi`
  Distributed as part of macros/texinfo/texinfo.tar.gz