Skip to content

Instantly share code, notes, and snippets.

@sebix
Created January 7, 2012 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebix/1575781 to your computer and use it in GitHub Desktop.
Save sebix/1575781 to your computer and use it in GitHub Desktop.
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