Skip to contentSkip to conversation

Makefile: Use implicit rules for various layout options

PATCH In review Akira Yokosawa 2 participants 2 messages Oct 6, 2016 – Oct 7, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: Use implicit rules for various layout options

From 9300942224fc8072cad9d6582858993c5efa5131 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <[email protected]>
Date: Thu, 6 Oct 2016 23:57:07 +0900
Subject: [PATCH] Makefile: Use implicit rules for various layout options

This commit replaces redundant rules for perfbook.pdf, perfbook-1c.pdf, and perfbook-hb.pdf with custom implicit rules. These implicit rules will also help when you want to add tentative rules to try some experimental layout option.

---
 Makefile | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)
Makefile +8 -24
index 0207473..55361c3 100644
@@ -9,6 +9,8 @@ LATEXSOURCES = \
 
 LATEXGENERATED = qqz.tex contrib.tex origpub.tex
 
+PDFTARGETS := perfbook.pdf perfbook-1c.pdf perfbook-hb.pdf
+
 EPSSOURCES_FROM_TEX := \
 	SMPdesign/DiningPhilosopher5.eps \
 	SMPdesign/DiningPhilosopher5TB.eps \
@@ -65,14 +67,14 @@ all: $(targ)
 
 hb: perfbook-hb.pdf
 
-perfbook.pdf: perfbook.bbl
-	sh utilities/runlatex.sh perfbook
+$(PDFTARGETS): %.pdf: %.tex %.bbl
+	sh utilities/runlatex.sh $(basename $@)
 
-perfbook.bbl: $(BIBSOURCES) perfbook.aux
-	bibtex perfbook
+$(PDFTARGETS:.pdf=.bbl): %.bbl: $(BIBSOURCES) %.aux
+	bibtex $(basename $@)
 
-perfbook.aux: $(LATEXSOURCES) $(LATEXGENERATED)
-	sh utilities/runfirstlatex.sh perfbook
+$(PDFTARGETS:.pdf=.aux): $(LATEXSOURCES) $(LATEXGENERATED)
+	sh utilities/runfirstlatex.sh $(basename $@)
 
 perfbook_flat.tex: perfbook.tex $(LATEXSOURCES) $(PDFTARGETS_OF_EPS) $(PDFTARGETS_OF_SVG)
 	echo > qqz.tex
@@ -89,30 +91,12 @@ contrib.tex: perfbook_flat.tex qqz.tex
 origpub.tex: perfbook_flat.tex
 	sh utilities/extractorigpub.sh < perfbook_flat.tex > origpub.tex
 
-perfbook-1c.pdf: perfbook-1c.tex perfbook-1c.bbl
-	sh utilities/runlatex.sh perfbook-1c
-
 perfbook-1c.tex: perfbook.tex
 	sed -e 's/,twocolumn//' -e 's/setboolean{twocolumn}{true}/setboolean{twocolumn}{false}/' < perfbook.tex > perfbook-1c.tex
 
-perfbook-1c.bbl: $(BIBSOURCES) perfbook-1c.aux
-	bibtex perfbook-1c
-
-perfbook-1c.aux: $(LATEXSOURCES) $(LATEXGENERATED)
-	sh utilities/runfirstlatex.sh perfbook-1c
-
-perfbook-hb.pdf: perfbook-hb.tex perfbook-hb.bbl
-	sh utilities/runlatex.sh perfbook-hb
-
 perfbook-hb.tex: perfbook.tex
 	sed -e 's/,twocolumn/&,letterpaperhb/' -e 's/setboolean{hardcover}{false}/setboolean{hardcover}{true}/' < perfbook.tex > perfbook-hb.tex
 
-perfbook-hb.bbl: $(BIBSOURCES) perfbook-hb.aux
-	bibtex perfbook-hb
-
-perfbook-hb.aux: $(LATEXSOURCES) $(LATEXGENERATED)
-	sh utilities/runfirstlatex.sh perfbook-hb
-
 # Rules related to perfbook_html are removed as of May, 2016
 
 $(EPSSOURCES_FROM_TEX): %.eps: %.tex
Signature · 1 line
2.7.4
#1 lore raw
Quoted 11 lines · Akira Yokosawa
Quoted 1 line

From 9300942224fc8072cad9d6582858993c5efa5131 Mon Sep 17 00:00:00 2001

From: Akira Yokosawa <[email protected]>
Date: Thu, 6 Oct 2016 23:57:07 +0900
Subject: [PATCH] Makefile: Use implicit rules for various layout options

This commit replaces redundant rules for perfbook.pdf, perfbook-1c.pdf, and perfbook-hb.pdf with custom implicit rules. These implicit rules will also help when you want to add tentative rules to try some experimental layout option.

Nice! Queued and pushed, thank you!

Thanx, Paul

Quoted 72 lines
---
 Makefile | 32 ++++++++------------------------
 1 file changed, 8 insertions(+), 24 deletions(-)
Makefile +8 -24
index 0207473..55361c3 100644
@@ -9,6 +9,8 @@ LATEXSOURCES = \
 
 LATEXGENERATED = qqz.tex contrib.tex origpub.tex
 
+PDFTARGETS := perfbook.pdf perfbook-1c.pdf perfbook-hb.pdf
+
 EPSSOURCES_FROM_TEX := \
 	SMPdesign/DiningPhilosopher5.eps \
 	SMPdesign/DiningPhilosopher5TB.eps \
@@ -65,14 +67,14 @@ all: $(targ)
 
 hb: perfbook-hb.pdf
 
-perfbook.pdf: perfbook.bbl
-	sh utilities/runlatex.sh perfbook
+$(PDFTARGETS): %.pdf: %.tex %.bbl
+	sh utilities/runlatex.sh $(basename $@)
 
-perfbook.bbl: $(BIBSOURCES) perfbook.aux
-	bibtex perfbook
+$(PDFTARGETS:.pdf=.bbl): %.bbl: $(BIBSOURCES) %.aux
+	bibtex $(basename $@)
 
-perfbook.aux: $(LATEXSOURCES) $(LATEXGENERATED)
-	sh utilities/runfirstlatex.sh perfbook
+$(PDFTARGETS:.pdf=.aux): $(LATEXSOURCES) $(LATEXGENERATED)
+	sh utilities/runfirstlatex.sh $(basename $@)
 
 perfbook_flat.tex: perfbook.tex $(LATEXSOURCES) $(PDFTARGETS_OF_EPS) $(PDFTARGETS_OF_SVG)
 	echo > qqz.tex
@@ -89,30 +91,12 @@ contrib.tex: perfbook_flat.tex qqz.tex
 origpub.tex: perfbook_flat.tex
 	sh utilities/extractorigpub.sh < perfbook_flat.tex > origpub.tex
 
-perfbook-1c.pdf: perfbook-1c.tex perfbook-1c.bbl
-	sh utilities/runlatex.sh perfbook-1c
-
 perfbook-1c.tex: perfbook.tex
 	sed -e 's/,twocolumn//' -e 's/setboolean{twocolumn}{true}/setboolean{twocolumn}{false}/' < perfbook.tex > perfbook-1c.tex
 
-perfbook-1c.bbl: $(BIBSOURCES) perfbook-1c.aux
-	bibtex perfbook-1c
-
-perfbook-1c.aux: $(LATEXSOURCES) $(LATEXGENERATED)
-	sh utilities/runfirstlatex.sh perfbook-1c
-
-perfbook-hb.pdf: perfbook-hb.tex perfbook-hb.bbl
-	sh utilities/runlatex.sh perfbook-hb
-
 perfbook-hb.tex: perfbook.tex
 	sed -e 's/,twocolumn/&,letterpaperhb/' -e 's/setboolean{hardcover}{false}/setboolean{hardcover}{true}/' < perfbook.tex > perfbook-hb.tex
 
-perfbook-hb.bbl: $(BIBSOURCES) perfbook-hb.aux
-	bibtex perfbook-hb
-
-perfbook-hb.aux: $(LATEXSOURCES) $(LATEXGENERATED)
-	sh utilities/runfirstlatex.sh perfbook-hb
-
 # Rules related to perfbook_html are removed as of May, 2016
 
 $(EPSSOURCES_FROM_TEX): %.eps: %.tex
Signature · 1 line
2.7.4