Penguin
Note: You are viewing an old revision of this page. View the current version.

In the process of writing 420 final reports, SamJansen and Tom Young worked to create some makefiles useful for Latex projects. Latex and Bibtex have some strange properties which makes writing makefiles for them an interesting challenge. This page is currently a work in progress.

A Basic Makefile

A very basic makefile that does not support Bibtex, images, or multiple input files looks something like the following
  1. vim: tabstop=8 shiftwidth=8 noexpandtab
  2. A very basic Latex makefile by Sam Jansen. See http://www.wlug.org.nz/LatexMakefiles for more information
  3. Change the following to whatever you like. Target will have '.ps' or '.pdf'
  4. appended as need be. Tex should be the tex file WITHOUT the '.tex' suffix.

TEX=report TARGET=report

  1. You probably don't need to change anything below the following line:

.PHONY: clean debug gvshow pdfshow acroshow dvishow LATEX_ARGS=--interaction batchmode LATEX=latex

$(TARGET).ps: $(TARGET).dvi

dvips $(TARGET) -o $(TARGET).ps

$(TARGET).pdf: $(TEX).tex

pdflatex $(LATEX_ARGS) $(TEX)

$(TARGET).dvi: $(TEX).tex

$(LATEX) $(LATEX_ARGS) $(TEX) @mv $(TEX).dvi $(TARGET).dvi

clean

rm *.toc *.aux *.pdf *.ps *.eps *.log *.tex *.lof *.bib *.bbl *.blg *.dvi

debug

latex $(TEX)

gvshow: $(TARGET).ps

gv $(TARGET).ps

pdfshow: $(TARGET).pdf

xpdf $(TARGET).pdf

acroshow: $(TARGET).pdf

acroread $(TARGET).pdf

dvishow: $(TARGET).dvi

xdvi $(TARGET).dvi

Probably the most interesting thing about the above makefile is that it uses --interaction batchmode as an argument to Latex. The rest is a fairly standard makefile. Things get a little more complex when Bibtex and automatic image conversion is added to the makefiles.

More Powerful Makefiles