Skip to content

Instantly share code, notes, and snippets.

@sebix
Created Jan 7, 2012
Embed
What would you like to do?
Sample Makefile for compiling LaTeX-Documents + gitignore
*.pdf
#Backup-Files
*.backup
*~
*.bak
# logfiles
*.aux
*.log
*.out
# Tables
*.toc
*.lot
*.lof
# Bibliography
*.blg
*.bbl
# Glossary
*.glo
*.xdy
*.glg
*.gls
*.ist
*.acn
# Index
*.idx
*.ilg
*.ind
NAME=nameOfWork
COMPILER=pdflatex
#adjust the number to your requirement; there's no good solution to reduce the output
COMPARGS=| tail -n -233 | grep -v .pfb
BIBLIO=bibtex
INDEXER=makeindex
GLOSSARY=makeglossaries
all: clean once bib glo idx
$(COMPILER) $(NAME).tex $(COMPARGS)
$(INDEXER) $(NAME).idx
$(COMPILER) $(NAME).tex $(COMPARGS)
once:
$(COMPILER) $(NAME).tex $(COMPARGS)
# -r to remove also files in subdirectories (helpful when working with multiple tex-files)
clean:
rm -rf $(NAME).toc $(NAME).lot $(NAME).lof
rm -rf $(NAME).blg $(NAME).bbl
rm -rf $(NAME).glo $(NAME).glg $(NAME).gls $(NAME).ist $(NAME).xdy $(NAME).acn
rm -rf $(NAME).idx $(NAME).ilg $(NAME).ind
rm -rf *.log *.aux *.out
rm -rf *~ *.pdf
glo: once
$(GLOSSARY) $(NAME).glo
idx: once
$(INDEXER) $(NAME).idx
bib: once
$(BIBLIO) $(NAME).aux
simple: once bib glo idx
$(COMPILER) $(NAME).tex $(COMPARGS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment