You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB
Makefile

#!Makefile
default all: pdf
TEXFILE=charter
TMPDIR:=$(shell mktemp -d /tmp/latex.XXXX)
FIRSTTAG:=$(shell git describe --abbrev=0 --tags --always)
RELTAG:=$(shell git describe --tags --long --always --dirty='-*' --match '[0-9]*.*')
pdf: gitinfo tex
.PHONY: gitinfo
gitinfo:
@git --no-pager log -1 --date=short --decorate=short --pretty=format:"\usepackage[shash={%h},lhash={%H},authname={%an},authemail={%ae},authsdate={%ad},authidate={%ai},authudate={%at},commname={%an},commemail={%ae},commsdate={%ad},commidate={%ai},commudate={%at},refnames={%d},firsttagdescribe="${FIRSTTAG}",reltag="${RELTAG}"]{gitexinfo}" HEAD > $(TMPDIR)/gitHeadLocal.gin
tex: $(TEXFILE).tex
@test -d $(TMPDIR) || mkdir $(TMPDIR)
@echo "Running 2 compiles $(TMPDIR)"
@pdflatex -output-directory=$(TMPDIR) -interaction=batchmode -file-line-error -no-shell-escape $< > /dev/null
@pdflatex -output-directory=$(TMPDIR) -interaction=batchmode -file-line-error -no-shell-escape $< > /dev/null
@cp $(TMPDIR)/$(TEXFILE).pdf .
@echo $(FIRSTTAG) > version
@echo "$(TEXFILE) PDF Ready"
.PHONY: clean
clean:
@rm -rf /tmp/latex.*
cleanall:
@rm -rf /tmp/latex.*
@rm -f $(TEXFILE).pdf