From 65677ea036071bed01f3ccd4983d7e53bbf00dc0 Mon Sep 17 00:00:00 2001
From: Simon Ruderich <simon@ruderich.org>
Date: Sat, 1 Oct 2016 16:21:09 +0200
Subject: [PATCH] Simplify Makefile setup

Use rubber instead of latexmk; rubber removes unnecessary output. Also
remove all @ (suppresses output) to make debugging easier.

Also rename tag1/uebung/print.pdf to tag1/uebung/aufgaben-tag1-print.pdf
and build tag2/uebung/urkunde.pdf.
---
 .gitignore                              |  5 +++-
 cheatsheet/Makefile                     | 15 +++-------
 common/rules.mk                         |  5 ++++
 skripte/Makefile                        |  2 --
 tag1/uebung/Makefile                    | 24 ++++++++--------
 tag1/vorlesung/Makefile                 | 37 ++++++++++---------------
 tag1/vorlesung/verzeichnisbaum/Makefile |  6 ++--
 tag2/uebung/Makefile                    | 19 ++++---------
 tag2/vorlesung/Makefile                 | 31 ++++++---------------
 9 files changed, 56 insertions(+), 88 deletions(-)
 create mode 100644 common/rules.mk

diff --git a/.gitignore b/.gitignore
index b820102..ed57583 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,11 @@
 /cheatsheet/cheatsheet.aux
 /cheatsheet/cheatsheet.log
 /cheatsheet/cheatsheet.pdf
+/tag1/uebung/aufgaben-tag1-print.pdf
 /tag1/uebung/aufgaben-tag1.aux
 /tag1/uebung/aufgaben-tag1.log
 /tag1/uebung/aufgaben-tag1.pdf
 /tag1/uebung/greencard-richtlinien.pdf
-/tag1/uebung/print.pdf
 /tag1/vorlesung/folien-vl-tag1-print.aux
 /tag1/vorlesung/folien-vl-tag1-print.fdb_latexmk
 /tag1/vorlesung/folien-vl-tag1-print.fls
@@ -65,6 +65,9 @@
 /tag2/uebung/aufgaben-tag2.aux
 /tag2/uebung/aufgaben-tag2.log
 /tag2/uebung/aufgaben-tag2.pdf
+/tag2/uebung/urkunde.aux
+/tag2/uebung/urkunde.log
+/tag2/uebung/urkunde.pdf
 /tag2/vorlesung/folien-vl-tag2-print.aux
 /tag2/vorlesung/folien-vl-tag2-print.fdb_latexmk
 /tag2/vorlesung/folien-vl-tag2-print.fls
diff --git a/cheatsheet/Makefile b/cheatsheet/Makefile
index 199eb23..5efdf46 100644
--- a/cheatsheet/Makefile
+++ b/cheatsheet/Makefile
@@ -1,15 +1,8 @@
-targets=cheatsheet.pdf
+include ../common/rules.mk
 
-all: ${targets}
-
-cheatsheet.pdf: cheatsheet.tex
-	@pdflatex $<
-	@pdflatex $<
+all: cheatsheet.pdf
 
 clean:
-	@${RM} *.aux *.log *.nav *.out *.snm *.toc *.vrb
-
-distclean: clean
-	@${RM} 	${targets}
+	rubber --clean --pdf cheatsheet.tex
 
-.PHONY: all clean distclean
+.PHONY: all clean
diff --git a/common/rules.mk b/common/rules.mk
new file mode 100644
index 0000000..226cefb
--- /dev/null
+++ b/common/rules.mk
@@ -0,0 +1,5 @@
+%.pdf: %.tex
+	rubber --pdf $<
+
+%.pdf: %.svg
+	rsvg-convert -f pdf -o $@ $<
diff --git a/skripte/Makefile b/skripte/Makefile
index b404c55..6bd659b 100644
--- a/skripte/Makefile
+++ b/skripte/Makefile
@@ -19,5 +19,3 @@ wildcards:
 failedbackup:
 	mkdir -p ${BASE}/aufgabe_failedbackup/archive
 	cp aufgabe_failedbackup/failedbackup.tar.bz2 ${BASE}/aufgabe_failedbackup/archive
-
-
diff --git a/tag1/uebung/Makefile b/tag1/uebung/Makefile
index 507062d..d99b134 100644
--- a/tag1/uebung/Makefile
+++ b/tag1/uebung/Makefile
@@ -1,19 +1,17 @@
-targets=aufgaben-tag1.pdf
+include ../../common/rules.mk
 
-all: ${targets}
+all: aufgaben-tag1.pdf aufgaben-tag1-print.pdf
 
-aufgaben-tag1.pdf: aufgaben-tag1.tex ../../aufgabensammlung/*.tex greencard-richtlinien.pdf
-	@pdflatex $<
-	@pdflatex $<
-	pdftk aufgaben-tag1.pdf greencard-richtlinien.pdf output print.pdf
+aufgaben-tag1.pdf: aufgaben-tag1.tex ../../aufgabensammlung/*.tex ../../aufgabensammlung/images/*
 
-clean:
-	@${RM} *.aux *.log *.nav *.out *.snm *.toc *.vrb print.pdf greencard-richtlinien.pdf
-
-distclean: clean
-	@${RM} 	${targets}
+aufgaben-tag1-print.pdf: aufgaben-tag1.pdf greencard-richtlinien.pdf
+	pdftk $^ output $@
 
 greencard-richtlinien.pdf:
-	wget https://wwwcip.informatik.uni-erlangen.de/download/greencard-richtlinien.pdf
+	wget --no-verbose https://wwwcip.cs.fau.de/download/greencard-richtlinien.pdf
+
+clean:
+	rubber --clean --pdf aufgaben-tag1.tex
+	rm -f aufgaben-tag1-print.pdf greencard-richtlinien.pdf
 
-.PHONY: all clean distclean print
+.PHONY: all clean
diff --git a/tag1/vorlesung/Makefile b/tag1/vorlesung/Makefile
index fd8a23f..d14b19c 100644
--- a/tag1/vorlesung/Makefile
+++ b/tag1/vorlesung/Makefile
@@ -1,28 +1,21 @@
-targets=folien-vl-tag1.pdf folien-vl-tag1-print.pdf
-DEPS = $(patsubst %.svg,%.pdf,$(wildcard images/*.svg)) $(wildcard images/*)
-
-all: ${targets}
-
-folien-vl-tag1.pdf: folien-vl-tag1.tex *.tex verzeichnisbaum/*.tex $(DEPS)
-	make -C verzeichnisbaum
-	@latexmk -pdf $<
+include ../../common/rules.mk
 
-folien-vl-tag1-print.pdf: folien-vl-tag1-print.tex *.tex verzeichnisbaum/*.tex $(DEPS)
-	make -C verzeichnisbaum
-	@latexmk -pdf $<
+all: folien-vl-tag1.pdf folien-vl-tag1-print.pdf
 
-clean:
-	make -C verzeichnisbaum clean
-	@${RM} *.aux *.log *.nav *.out *.snm *.toc *.vrb
-	@latexmk -c ${targets}
+DEPS = $(patsubst %.svg,%.pdf,$(wildcard images/*.svg)) $(wildcard images/*)
+TREE_TEX = $(wildcard verzeichnisbaum/baum*.tex)
+TREE_DEPS = $(patsubst %.tex,%.pdf,$(TREE_TEX))
 
-distclean: clean
-	@${RM} 	${targets}
+folien-vl-tag1.pdf: *.tex $(DEPS) $(TREE_DEPS)
+folien-vl-tag1-print.pdf: *.tex $(DEPS) $(TREE_DEPS)
 
-%.pdf: %.tex
-	@latexmk -pdf $<
+$(TREE_DEPS): $(TREE_TEX) verzeichnisbaum/baeume.tex
+	$(MAKE) -C verzeichnisbaum $(@F)
 
-%.pdf: %.svg
-	rsvg-convert -f pdf -o $@ $<
+clean:
+	rubber --clean --pdf folien-vl-tag1.tex folien-vl-tag1-print.tex
+	rm -f *.vrb
+	rm -f images/techfak-plan.pdf
+	$(MAKE) -C verzeichnisbaum clean
 
-.PHONY: all clean distclean 
+.PHONY: all clean
diff --git a/tag1/vorlesung/verzeichnisbaum/Makefile b/tag1/vorlesung/verzeichnisbaum/Makefile
index 5352338..68a10b1 100644
--- a/tag1/vorlesung/verzeichnisbaum/Makefile
+++ b/tag1/vorlesung/verzeichnisbaum/Makefile
@@ -1,6 +1,4 @@
-.PHONY: all clean
-
-all: baum0.pdf baum1.pdf baum2.pdf baum3.pdf baum4.pdf baum5.pdf baum6.pdf
+all: $(patsubst %.tex,%.pdf,$(wildcard baum*.tex))
 
 %.pdf: %.tex baeume.tex
 	echo $@ $* $^ $<
@@ -12,3 +10,5 @@ all: baum0.pdf baum1.pdf baum2.pdf baum3.pdf baum4.pdf baum5.pdf baum6.pdf
 
 clean:
 	rm -f *.pdf *.ps *.aux *.dvi *.log
+
+.PHONY: all clean
diff --git a/tag2/uebung/Makefile b/tag2/uebung/Makefile
index dd8a36a..643792c 100644
--- a/tag2/uebung/Makefile
+++ b/tag2/uebung/Makefile
@@ -1,19 +1,10 @@
-targets=aufgaben-tag2.pdf
+include ../../common/rules.mk
 
-all: ${targets}
+all: aufgaben-tag2.pdf urkunde.pdf
 
-aufgaben-tag2.pdf: aufgaben-tag2.tex ../../aufgabensammlung/*.tex
-	@pdflatex $<
-	@pdflatex $<
-
-urkunde.pdf: urkunde.tex
-	@pdflatex $<
-	@pdflatex $<
+aufgaben-tag2.pdf: aufgaben-tag2.tex ../../aufgabensammlung/*.tex ../../aufgabensammlung/images/*
 
 clean:
-	@${RM} *.aux *.log *.nav *.out *.snm *.toc *.vrb urkunde.pdf
-
-distclean: clean
-	@${RM} 	${targets}
+	rubber --clean --pdf aufgaben-tag2.tex urkunde.tex
 
-.PHONY: all clean distclean
+.PHONY: all clean
diff --git a/tag2/vorlesung/Makefile b/tag2/vorlesung/Makefile
index 368b2da..c770d41 100644
--- a/tag2/vorlesung/Makefile
+++ b/tag2/vorlesung/Makefile
@@ -1,28 +1,15 @@
-.SUFFIXES:.eps .pdf .tex
+include ../../common/rules.mk
 
-targets=folien-vl-tag2.pdf folien-vl-tag2-print.pdf
-DEPS = $(patsubst %.svg,%.pdf,$(wildcard images/*.svg)) $(wildcard images/*.png)
-
-all: ${targets}
+all: folien-vl-tag2.pdf folien-vl-tag2-print.pdf
 
-folien-vl-tag2.pdf: folien-vl-tag2.tex *.tex $(DEPS)
+DEPS = $(patsubst %.svg,%.pdf,$(wildcard images/*.svg)) $(wildcard images/*.png)
 
-folien-vl-tag2-print.pdf: folien-vl-tag2-print.tex *.tex $(DEPS)
+folien-vl-tag2.pdf: *.tex $(DEPS)
+folien-vl-tag2-print.pdf: *.tex $(DEPS)
 
 clean:
-	@latexmk -c ${targets}
-	@${RM} *.nav *.snm *.vrb
-
-distclean: clean
-	@${RM} 	${targets}
-
-.tex.pdf:
-	@latexmk -pdf $<
-
-.eps.pdf:
-	@epstopdf $<
-
-%.pdf: %.svg
-	rsvg-convert -f pdf -o $@ $<
+	rubber --clean --pdf folien-vl-tag2.tex folien-vl-tag2-print.tex
+	rm -f *.vrb
+	rm -f images/*.pdf
 
-.PHONY: all clean distclean
+.PHONY: all clean
-- 
GitLab