Skip to content

Instantly share code, notes, and snippets.

Created August 20, 2012 09:16
What would you like to do?
makefile for TeX (manual version management)
# makefile for TeX document whose version number is managed manually
# e.g.
# document_v1.tex document_v2.tex ...
LATEX = latex
BIBTEX = bibtex
DVIPDF = dvipdf
RM = rm -f
ASPELL = aspell -t -c --lang=en
VERSION = $(shell ls *.tex | sed -e 's/.*_v\([0-9]*\).*/\1/g' | sort -n | tail -n 1)
TEXFILE = $(shell ls *_v$(VERSION).tex)
FILE = $(TEXFILE:%.tex=%)
DVIFILE = $(TEXFILE:%.tex=%.dvi)
PDFFILE = $(TEXFILE:%.tex=%.pdf)
BIBFILE = $(shell ls *.bib)
EPS = $(shell ls *.eps)
all: $(DVIFILE)
@$(RM) *.bbl
$(LATEX) ${TEXFILE} > /dev/null
$(LATEX) ${TEXFILE} > /dev/null
@$(RM) *.aux *.log
pdf: $(PDFFILE)
.PHONY: clean
$(RM) *.aux *.toc *.lot *.log *.bbl *.blg *.pbm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment