Very basic Makefile for LaTeX documents

So I wanted to make a basic makefile for my tex documents, so I took the Makefile from and modified it to be amazingly simple.

Heres the Make file:


LATEX= latex
BIBTEX= bibtex
DVIPS= dvips
PS2PDF= ps2pdf

SRC := $(shell egrep -l '^[^%]*\begin{document}' *.tex | sed -e 's/.tex//')TRG = $(SRC).dviPSF = $(SRC).ps

all : pdf

dvi :  $(LATEX) $(SRC) && $(BIBTEX) $(SRC) && $(LATEX) $(SRC) && $(LATEX) $(SRC)

ps : dvi  $(DVIPS) $(TRG)

pdf : ps  $(PS2PDF) $(PSF)

clean :  rm *.bbl *.aux *.blg *.dvi *.log *pdf *.ps

Fairly simple and lets you choose your toolchain.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.