Last active
April 25, 2022 10:14
-
-
Save moriglia/7e73287cb32c8072e45c0bd2fd427f8a to your computer and use it in GitHub Desktop.
Makefile for compiling tex files (starting with 3 digits) in pdfs. Tune your pattern in the ALLPDF variable
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
OUTDIR ?= `pwd` | |
DRAFTFLAGS = -draftmode --shell-escape -interaction nonstopmode -output-directory $(OUTDIR) | |
PDFFLAGS = --shell-escape -interaction nonstopmode -output-format pdf -output-directory $(OUTDIR) | |
ALLPDF = $(patsubst %.tex,%.pdf,$(shell find . -iregex \.\/[0-9]+_.*\.tex)) | |
.PHONY: clean cleanpdf all | |
all: $(ALLPDF) | |
%.log %.aux: %.tex | |
pdflatex $(DRAFTFLAGS) $< | |
%.bbl: %.aux | |
bibtex $< | |
ifdef MAKEBIB | |
%.pdf: %.bbl | |
pdflatex $(DRAFTFLAGS) $*.tex | |
else | |
%.pdf: %.log # Make a draft once | |
endif | |
# Finally make the pdf | |
pdflatex $(PDFFLAGS) $*.tex | |
clean: | |
rm -rf *.aux *.log | |
cleanpdf: | |
# Do not remove pdfs that are not produced by make | |
rm -rf $(ALLPDF) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment