# main document
#SRC=doc
SRC=temp
# latex compilier
LATEX=pdflatex
# bibliography generator
BIBTEX=bibtex
# pdf viewer
PDFVIEW=evince

COLOR="\\033[32m"
NORMAL_COLOR="\\033[0m"

OPT="-e"

UNAME := $(shell uname)

ifeq ($(UNAME), Darwin)
PDFVIEW=open
LATEX=xelatex
OPT=""
endif

pdf:$(SRC).pdf
@echo $(OPT) "$(COLOR)===> Viewing PDF… $(NORMAL_COLOR)"
$(PDFVIEW) $(SRC).pdf &

$(SRC).pdf:$(SRC).tex $(SRC).bbl
@echo $(OPT) "$(COLOR)===> Running LaTeX… $(NORMAL_COLOR)"
$(LATEX) $(SRC)
@echo $(OPT) "$(COLOR)===> Running LaTeX once more… $(NORMAL_COLOR)"
$(LATEX) $(SRC)

$(SRC).bbl:$(SRC).aux $(SRC).tex
@echo $(OPT) "$(COLOR)===> Running BibTeX… $(NORMAL_COLOR)"
$(BIBTEX) $(SRC)

$(SRC).aux:$(SRC).tex
@echo $(OPT) "$(COLOR)===> Running LaTeX for BibTeX… $(NORMAL_COLOR)"
$(LATEX) $(SRC)

clean:
@echo $(OPT) "$(COLOR)===> Tidy up!… $(NORMAL_COLOR)"
rm -f *~
find . -maxdepth 1 -type f -name "$(SRC).*" ! -name "$(SRC).tex" -exec rm -f {} \;
# remove AucTeX-related files.
rm -rf _region_* $(DOC).prv prv_$(DOC).log

Comments Off on LaTeX Makefile
Trackback

no comment until now

Sorry, comments closed.