From 4d60de1efb21796a0796985952f8866b482347f6 Mon Sep 17 00:00:00 2001
From: Malin Freeborn <malinfreeborn@posteo.net>
Date: Tue, 18 Jul 2023 18:08:50 +0200
Subject: [PATCH] update Makefile

---
 .gitignore     |  2 ++
 .gitlab-ci.yml |  3 +--
 Makefile       | 40 +++++++++++++++++-----------------------
 3 files changed, 20 insertions(+), 25 deletions(-)

diff --git a/.gitignore b/.gitignore
index dd9d1582..ae49cb03 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,5 @@ old
 *.slo
 *.sls
 .switch-*
+*.fls
+*latexmk
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a56a2848..d96d4d14 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -11,5 +11,4 @@ compile_pdf:
     - run
   artifacts:
     paths:
-      - BIND.pdf
-      - resources.pdf
+      - core.pdf
diff --git a/Makefile b/Makefile
index 819de3a7..9b4c0ea5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,26 @@
-output: main.pdf
-book: main.pdf
-	mv main.pdf BIND.pdf
+BOOK = $(shell basename "$$(pwd)")
+
+output: $(BOOK).pdf
 
 global: config/bind.sty .switch-gls
 .switch-gls:
-	touch -r Makefile .switch-gls
+	@touch -r Makefile .switch-gls
 config/bind.sty:
-	git submodule update --init
-
-main.pdf: main.gls config $(wildcard *tex)
-	pdflatex main.tex
-main.gls: svg-inkscape/logo_svg-tex.pdf
-	makeglossaries main
-	pdflatex main.tex
-svg-inkscape/logo_svg-tex.pdf: images/ global
-	pdflatex -shell-escape main.tex
-	pdflatex main.tex
-	pdflatex main.tex
+	@git submodule update --init
 
-svg-inkscape: global
-	pdflatex -shell-escape -jobname main.tex
-	pdflatex -jobname main.tex
+svg-inkscape: | config/bind.sty
+	@pdflatex -shell-escape -jobname $(BOOK) main.tex
+$(BOOK).glo: | svg-inkscape
+	@pdflatex -jobname $(BOOK) main.tex
+$(BOOK).sls: | $(BOOK).glo
+	@makeglossaries $(BOOK)
+$(BOOK).pdf: $(BOOK).sls
+	@pdflatex -jobname $(BOOK) main.tex
 
-resources: resources.pdf
-resources.pdf: main.gls global
-	pdflatex resources.tex
-
-all: resources book 
+all: $(BOOK).pdf 
+	latexmk -jobname=$(BOOK) -shell-escape -pdf main.tex
 
 clean:
 	rm -fr *.aux *.sls *.slo *.slg *.toc *.acn *.log *.ptc *.out *.idx *.ist *.glo *.glg *.gls *.acr *.alg *.ilg *.ind *.pdf sq/*aux svg-inkscape
+
+.PHONY: clean all
-- 
GitLab