From 6c602828ef80d3c49a5dcc49075176e50d9ac58c Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Wed, 3 Apr 2024 22:11:54 +0200
Subject: [PATCH] compile with latexmk

---
 Makefile | 45 ++++++++++++++++++++++-----------------------
 vars     |  6 ++++++
 2 files changed, 28 insertions(+), 23 deletions(-)
 create mode 100644 vars

diff --git a/Makefile b/Makefile
index 3c8a7968..bcda99db 100644
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,31 @@
+include vars
+
 output: docs.pdf
 
+rubbish/:
+	mkdir rubbish
+
 images:
 	mkdir images
 images/wide.jpg:| images
 	convert -size 100x60 xc:skyblue -fill white -stroke black  -draw "ellipse 50,30 40,20 45,270" images/wide.jpg
 
-docs.pdf: images/wide.jpg svg-inkscape $(wildcard *.sty) docs.tex
-	pdflatex -shell-escape docs.tex
-test.pdf: test.tex $(wildcard *.sty) $(wildcard *.tex)
-	pdflatex -shell-escape test.tex
-resources.pdf: $(wildcard *.tex) $(wildcard *.sty) 
-	pdflatex -shell-escape resources.tex
-svg-inkscape:
-	pdflatex -shell-escape rules.tex
-	pdflatex -shell-escape docs.tex
-rules.pdf: images/wide.jpg svg-inkscape rules.tex rules $(wildcard *.sty)
-	pdflatex -shell-escape rules.tex
+ALL_FILES = $(wildcard *.tex) $(wildcard *.sty) | rubbish/
+
+rubbish/test.pdf: test.tex $(ALL_FILES)
+	$(RUN) test.tex
+
+docs.pdf: images/wide.jpg $(ALL_FILES)
+	$(RUN) docs.tex
+	$(CP) rubbish/docs.pdf docs.pdf
+resources.pdf: $(ALL_FILES)
+	$(RUN) resources.tex
+	$(CP) rubbish/resources.pdf resources.pdf
+rules.pdf: images/wide.jpg $(ALL_FILES)
+	$(RUN) rules.tex
+	$(CP) rubbish/rules.pdf rules.pdf
 
-all: docs.pdf test.pdf resources.pdf rules.pdf
+.PHONY: all clean
+all: docs.pdf resources.pdf rules.pdf rubbish/test.pdf 
 clean:
-	rm -rf *pdf *.aux *.toc *.acn *.acr *.log *.ptc *.out *.idx *.ist *.alg \
-    *glo \
-	*slo \
-	*sls \
-	*slg \
-	*glg \
-	*gls \
-	*.ind \
-	*.ilg \
-  images/wide.jpg \
-	svg-inkscape
+	$(CLEAN) images/wide.jpg
diff --git a/vars b/vars
new file mode 100644
index 00000000..61051d50
--- /dev/null
+++ b/vars
@@ -0,0 +1,6 @@
+CP = ln -f
+BOOK = $(shell basename "$$(pwd)")
+COMPILER = latexmk -auxdir=rubbish -pdflua -silent -shell-escape -jobname=$(BOOK)
+RUN = lualatex -output-directory rubbish -shell-escape
+QR_TARGET = $(shell grep 'mailto' README.md | cut -d' ' -f2)
+CLEAN = $(RM) -r rubbish qr.tex *.pdf
-- 
GitLab