Created
August 20, 2012 09:16
-
-
Save tachi-hi/3402572 to your computer and use it in GitHub Desktop.
makefile for TeX (manual version management)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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) | |
$(DVIFILE): $(TEXFILE) $(BIBFILE) $(EPS) | |
@$(RM) *.bbl | |
$(LATEX) ${TEXFILE} > /dev/null | |
$(BIBTEX) ${FILE} | |
$(LATEX) ${TEXFILE} > /dev/null | |
$(LATEX) ${TEXFILE} | |
@$(RM) *.aux *.log | |
pdf: $(PDFFILE) | |
$(PDFFILE): $(DVIFILE) | |
$(DVIPDF) $(FILE) | |
aspell: | |
$(ASPELL) $(TEXFILE) | |
.PHONY: clean | |
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