* [PATCH 1/2] Makefile: Use more automatic variables
2016-10-13 22:05 [PATCH 0/2] Makefile cleanups Akira Yokosawa
@ 2016-10-13 22:07 ` Akira Yokosawa
2016-10-13 22:08 ` [PATCH 2/2] Makefile: Use secondary expansion Akira Yokosawa
2016-10-14 14:51 ` [PATCH 0/2] Makefile cleanups Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Akira Yokosawa @ 2016-10-13 22:07 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
From 2d0765641c633f9e259339f0814259aefbae863e Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sun, 9 Oct 2016 20:38:46 +0900
Subject: [PATCH 1/2] Makefile: Use more automatic variables
This commit simplifies some rules by using automatic variables
such as "$<" and "$@".
It also simplifies the "clean" rule by using wildcards.
.gitignore is modified accordingly.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
.gitignore | 7 ++-----
Makefile | 15 +++++++--------
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/.gitignore b/.gitignore
index 4a2dc33..965b94d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,11 +18,8 @@ perfbook_flat.tex
qqz.tex
contrib.tex
origpub.tex
-perfbook.out
-perfbook-1c.tex
-perfbook-1c.out
-perfbook-hb.tex
-perfbook-hb.out
+perfbook*.out
+perfbook-*.tex
extraction
embedfonts
diff --git a/Makefile b/Makefile
index 55361c3..6e6d66b 100644
--- a/Makefile
+++ b/Makefile
@@ -80,22 +80,22 @@ perfbook_flat.tex: perfbook.tex $(LATEXSOURCES) $(PDFTARGETS_OF_EPS) $(PDFTARGET
echo > qqz.tex
echo > contrib.tex
echo > origpub.tex
- texexpand perfbook.tex > perfbook_flat.tex
+ texexpand perfbook.tex > $@
qqz.tex: perfbook_flat.tex
- sh utilities/extractqqz.sh < perfbook_flat.tex > qqz.tex
+ sh utilities/extractqqz.sh < $< > $@
contrib.tex: perfbook_flat.tex qqz.tex
- cat perfbook_flat.tex qqz.tex | sh utilities/extractcontrib.sh > contrib.tex
+ cat $^ | sh utilities/extractcontrib.sh > $@
origpub.tex: perfbook_flat.tex
- sh utilities/extractorigpub.sh < perfbook_flat.tex > origpub.tex
+ sh utilities/extractorigpub.sh < $< > $@
perfbook-1c.tex: perfbook.tex
- sed -e 's/,twocolumn//' -e 's/setboolean{twocolumn}{true}/setboolean{twocolumn}{false}/' < perfbook.tex > perfbook-1c.tex
+ sed -e 's/,twocolumn//' -e 's/setboolean{twocolumn}{true}/setboolean{twocolumn}{false}/' < $< > $@
perfbook-hb.tex: perfbook.tex
- sed -e 's/,twocolumn/&,letterpaperhb/' -e 's/setboolean{hardcover}{false}/setboolean{hardcover}{true}/' < perfbook.tex > perfbook-hb.tex
+ sed -e 's/,twocolumn/&,letterpaperhb/' -e 's/setboolean{hardcover}{false}/setboolean{hardcover}{true}/' < $< > $@
# Rules related to perfbook_html are removed as of May, 2016
@@ -139,9 +139,8 @@ clean:
find . -name '*.aux' -o -name '*.blg' \
-o -name '*.dvi' -o -name '*.log' \
-o -name '*.qqz' -o -name '*.toc' -o -name '*.bbl' | xargs rm -f
- rm -f perfbook_flat.tex perfbook.out perfbook-1c.out
+ rm -f perfbook_flat.tex perfbook*.out perfbook-*.tex
rm -f $(LATEXGENERATED)
- rm -f perfbook-hb.out perfbook-1c.tex perfbook-hb.tex
rm -f extraction
distclean: clean
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] Makefile: Use secondary expansion
2016-10-13 22:05 [PATCH 0/2] Makefile cleanups Akira Yokosawa
2016-10-13 22:07 ` [PATCH 1/2] Makefile: Use more automatic variables Akira Yokosawa
@ 2016-10-13 22:08 ` Akira Yokosawa
2016-10-14 14:51 ` [PATCH 0/2] Makefile cleanups Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Akira Yokosawa @ 2016-10-13 22:08 UTC (permalink / raw)
To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa
From 3fc3583818c9103ef2d1c01516b362c4b6768604 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Mon, 10 Oct 2016 00:10:27 +0900
Subject: [PATCH 2/2] Makefile: Use secondary expansion
By using secondary expansion, abbreviated targets' dependencies
can be expressed as a single rule.
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
Makefile | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 6e6d66b..eb83af4 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,9 @@ LATEXSOURCES = \
LATEXGENERATED = qqz.tex contrib.tex origpub.tex
-PDFTARGETS := perfbook.pdf perfbook-1c.pdf perfbook-hb.pdf
+ABBREVTARGETS := 1c hb
+
+PDFTARGETS := perfbook.pdf $(foreach v,$(ABBREVTARGETS),perfbook-$(v).pdf)
EPSSOURCES_FROM_TEX := \
SMPdesign/DiningPhilosopher5.eps \
@@ -58,15 +60,11 @@ else
targ = $(default)
endif
-.PHONY: all touchsvg clean distclean neatfreak 1c 2c hb ls-unused
+.PHONY: all touchsvg clean distclean neatfreak 2c ls-unused $(ABBREVTARGETS)
all: $(targ)
-1c: perfbook-1c.pdf
-
2c: perfbook.pdf
-hb: perfbook-hb.pdf
-
$(PDFTARGETS): %.pdf: %.tex %.bbl
sh utilities/runlatex.sh $(basename $@)
@@ -156,3 +154,6 @@ ls-unused:
neatfreak: distclean
# Don't forget to regenerate the .pdf from each .svg file
find . -name '*.pdf' | xargs rm -f
+
+.SECONDEXPANSION:
+$(ABBREVTARGETS): %: perfbook-$$@.pdf
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Makefile cleanups
2016-10-13 22:05 [PATCH 0/2] Makefile cleanups Akira Yokosawa
2016-10-13 22:07 ` [PATCH 1/2] Makefile: Use more automatic variables Akira Yokosawa
2016-10-13 22:08 ` [PATCH 2/2] Makefile: Use secondary expansion Akira Yokosawa
@ 2016-10-14 14:51 ` Paul E. McKenney
2 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2016-10-14 14:51 UTC (permalink / raw)
To: Akira Yokosawa; +Cc: perfbook
On Fri, Oct 14, 2016 at 07:05:35AM +0900, Akira Yokosawa wrote:
> >From 3fc3583818c9103ef2d1c01516b362c4b6768604 Mon Sep 17 00:00:00 2001
> From: Akira Yokosawa <akiyks@gmail.com>
> Date: Thu, 13 Oct 2016 20:51:46 +0900
> Subject: [PATCH 0/2] Makefile cleanups
>
> Hi,
>
> Here is a patch set sequel to commit 0e6e192e6ea7 ("Makefile: Use
> implicit rules for various layout options").
>
> 1st patch shortens some rules by using automatic variables.
> 2nd one gets rid of apparent dependency rules like "1c: perfbook-1c.pdf"
> by using secondary-expansion feature of GNU make.
>
> Now almost all redundant rules have been removed.
> There is no change in the behavior of make command.
>
> This set is a by-product of my attempt to try some alternative monospace
> fonts to be used among Times Roman text. To give you an easy way to
> compare candidates, I'm preparing patches to add a few make targets, but
> not sure where it goes. This cleanup set seems worthwhile on its own.
>
> Thanks, Akira
>
> Akira Yokosawa (2):
> Makefile: Use more automatic variables
> Makefile: Use seconday expansion
>
> .gitignore | 7 ++-----
> Makefile | 28 ++++++++++++++--------------
> 2 files changed, 16 insertions(+), 19 deletions(-)
Applied and pushed, thank you!
Thanx, Paul
^ permalink raw reply [flat|nested] 4+ messages in thread