Last active
December 7, 2017 19:29
-
-
Save lorepozo/cacb58c117f32a5c34f24d7a6d3f88a6 to your computer and use it in GitHub Desktop.
Makefile for LaTeX
This file contains hidden or 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
| THIS_FILE := $(lastword $(MAKEFILE_LIST)) | |
| TEX := xelatex -shell-escape -interaction=nonstopmode -file-line-error | |
| PRE := $(wildcard ./*.tex) | |
| OBJ := $(PRE:%.tex=%.pdf) | |
| BIB := $(wildcard ./*.bib) | |
| BIB_OBJ := $(BIB:%.bib=%.bbl) | |
| all: $(OBJ) | |
| bib: $(BIB_OBJ) | |
| %.bbl: %.bib | |
| bibtex $(^:.bib=) | |
| %.pdf: %.tex | |
| $(TEX) $^ | |
| if [ -e "$(^:.tex=.bib)" ] ; then $(MAKE) -f $(THIS_FILE) $(^:.tex=.bbl) && $(TEX) $^ && $(TEX) $^ ; fi | |
| clean: | |
| $(RM) *.aux *.log *.out *.bbl *.blg | |
| cleanall: clean | |
| $(RM) $(OBJ) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just use
makein any directory with a.texfile.If you're using bibtex for citations, name the
.bibfile like the associated.texfile (e.g.main.texandmain.bib).make cleangets rid of all auxiliary files, andmake cleanallwill also get rid of the produced PDFs.