48 lines
1.7 KiB
Makefile
48 lines
1.7 KiB
Makefile
.PHONY: install_docker main.pdf clean redo test_git test_version versioned check-common-typos
|
|
|
|
DOCKER_VERSION=latest
|
|
|
|
DOCKER=docker run -i --rm --name latex -v "$$PWD":/usr/src/app -w /usr/src/app texlive/texlive
|
|
LATEXMK=$(DOCKER) latexmk
|
|
XETEX=$(DOCKER) xetex
|
|
LATEXDIFFVC=$(DOCKER) latexdiff-vc
|
|
|
|
# keep as first command to build stuff
|
|
main.pdf: main.tex main.bib
|
|
$(LATEXMK) -pdfxe main.tex # use xelatex to build pdf
|
|
|
|
install_docker:
|
|
docker pull texlive/texlive:$(DOCKER_VERSION)
|
|
|
|
clean:
|
|
$(LATEXMK) -c
|
|
x=`biber --cache` && if [ -d "$x" ]; then $(RM) $x; fi
|
|
#$(RM) *.out *.aux *.log *.bbl *.blg *~ *.toc *.idx *.eps dummy *.fls *.fdb_latexmk *.bcf *.run.xml *.xdv
|
|
#$(RM) $(patsubst %.tex, %.ps, $(wildcard *.tex))
|
|
#$(RM) $(patsubst %.tex, %.dvi, $(wildcard *.tex))
|
|
#$(RM) $(patsubst %.tex, %.pdf, $(wildcard *.tex))
|
|
|
|
redo: clean main.pdf
|
|
|
|
test_git:
|
|
if [ -z "$$(git status --untracked-files=no --porcelain)" ]; then exit 0; else echo -e "\nERROR: working directory not clean. commit changes before running versioned build"; exit 1; fi
|
|
# TODO check if we are also synced to at least one remote
|
|
|
|
test_version:
|
|
rm -f .version_local
|
|
$(LATEXMK) --version > .version_local
|
|
$(XETEX) --version | head -1 >> .version_local
|
|
@if ! diff -b .version_local .version_repo; then echo -e "\nWARNING! local versions and remote versions do not match! (above is local, below is repo)"; else echo "versions match!"; fi
|
|
|
|
versioned: test_git clean main.pdf test_version
|
|
cp main.pdf "main-$$(date -u +'%Y-%m-%dT%H:%M:%SZ')-$$(git rev-parse --short HEAD).pdf"
|
|
|
|
# latexdiff: # TODO
|
|
# latexdiff-vc --pdf main.tex -r 123456 -r abcdef
|
|
|
|
# common typos check. find words, but ignore latex comment and macros
|
|
check-common-typos:
|
|
./typos.sh
|
|
|
|
|