[PATCH -perfbook 2/6] Makefile: Split rules related to a2ping into a2ping-rule.mk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Preparatory change for adding alternative rules for "eps --> pdf"
conversion.
No behavior change is intended.

Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
---
 Makefile       | 64 ++--------------------------------------------
 a2ping-rule.mk | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 62 deletions(-)
 create mode 100644 a2ping-rule.mk

diff --git a/Makefile b/Makefile
index e2838779..5d9ef4b9 100644
--- a/Makefile
+++ b/Makefile
@@ -88,7 +88,6 @@ BIBSOURCES := bib/*.bib alphapf.bst
 # required commands
 DOT := $(shell which dot 2>/dev/null)
 FIG2EPS := $(shell which fig2eps 2>/dev/null)
-A2PING := $(shell which a2ping 2>/dev/null)
 INKSCAPE := $(shell which inkscape 2>/dev/null)
 ifdef INKSCAPE
   INKSCAPE_ONE := $(shell inkscape --version 2>/dev/null | grep -c "Inkscape 1")
@@ -137,29 +136,6 @@ endif
 
 STEELFONTID := $(shell fc-list | grep -i steel | grep -c Steel)
 
-ifdef A2PING
-  GS_950_OR_LATER := $(shell gs --version | grep -c -E "9\.[5-9].?")
-  A2PING_277P := $(shell a2ping --help 2>&1 | grep -c "2.77p,")
-  A2PING_283P := $(shell a2ping --help 2>&1 | grep -c "2.83p,")
-  GS_953_OR_LATER := $(shell gs --version | grep -c -E "9\.5[3-9].?")
-  ifeq ($(A2PING_277P),1)
-    A2PING_GSCNFL = 1
-  else
-    ifeq ($(A2PING_283P),1)
-      ifeq ($(GS_950_OR_LATER),1)
-        A2PING_GSCNFL = 1
-      else
-        A2PING_GSCNFL = 0
-      endif
-    else
-      A2PING_GSCNFL = 0
-    endif
-  endif
-  ifeq ($(GS_953_OR_LATER),1)
-    A2PING_GSCNFL = 2
-  endif
-endif
-
 LINELABEL_ENV_BEGIN := $(shell grep -l -F '\begin{linelabel}' $(LATEXSOURCES))
 LINELABEL_ENV_END   := $(shell grep -l -F '\end{linelabel}'   $(LATEXSOURCES))
 LINEREF_ENV_BEGIN   := $(shell grep -l -F '\begin{lineref}'   $(LATEXSOURCES))
@@ -431,44 +407,8 @@ endif
 	@fig2eps --nogv $< > /dev/null 2>&1
 	@sh $(FIXANEPSFONTS) $@
 
-$(PDFTARGETS_OF_EPSORIG): %.pdf: %.eps
-	@echo "$< --> $@"
-ifndef A2PING
-	$(error $< --> $@: a2ping not found. Please install it)
-endif
-ifeq ($(A2PING_GSCNFL),1)
-	$(error You need to update a2ping. See #7 in FAQ-BUILD.txt)
-endif
-	@cp $< $<i
-	@sh $(FIXANEPSFONTS) $<i
-	@a2ping --below --hires --bboxfrom=compute-gs $<i $@ > /dev/null 2>&1
-	@rm -f $<i
-
-$(PDFTARGETS_OF_TEX): %.pdf: %.eps
-	@echo "$< --> $@"
-ifndef A2PING
-	$(error $< --> $@: a2ping not found. Please install it)
-endif
-ifeq ($(A2PING_GSCNFL),1)
-	$(error a2ping version conflict. See #7 in FAQ-BUILD.txt)
-endif
-ifeq ($(A2PING_GSCNFL),2)
-	@a2ping --below --gsextra=-dALLOWPSTRANSPARENCY $< $(basename $@)__.pdf > /dev/null 2>&1
-	@pdfcrop --hires $(basename $@)__.pdf $@ > /dev/null
-	@rm -f $(basename $@)__.pdf
-else
-	@a2ping --below --hires --bboxfrom=compute-gs $< $@ > /dev/null 2>&1
-endif
-
-$(PDFTARGETS_OF_EPSOTHER): %.pdf: %.eps
-	@echo "$< --> $@"
-ifndef A2PING
-	$(error $< --> $@: a2ping not found. Please install it)
-endif
-ifeq ($(A2PING_GSCNFL),1)
-	$(error a2ping version conflict. See #7 in FAQ-BUILD.txt)
-endif
-	@a2ping --below --hires --bboxfrom=compute-gs $< $@ > /dev/null 2>&1
+# .eps --> .pdf rules
+include a2ping-rule.mk
 
 $(PDFTARGETS_OF_SVG): %.pdf: %.svg
 	@echo "$< --> $@"
diff --git a/a2ping-rule.mk b/a2ping-rule.mk
new file mode 100644
index 00000000..296fc575
--- /dev/null
+++ b/a2ping-rule.mk
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (C) Akira Yokosawa, 2021
+#
+# Authors: Akira Yokosawa <akiyks@xxxxxxxxx>
+
+A2PING := $(shell which a2ping 2>/dev/null)
+
+ifdef A2PING
+  GS_950_OR_LATER := $(shell gs --version | grep -c -E "9\.[5-9].?")
+  A2PING_277P := $(shell a2ping --help 2>&1 | grep -c "2.77p,")
+  A2PING_283P := $(shell a2ping --help 2>&1 | grep -c "2.83p,")
+  GS_953_OR_LATER := $(shell gs --version | grep -c -E "9\.5[3-9].?")
+  ifeq ($(A2PING_277P),1)
+    A2PING_GSCNFL = 1
+  else
+    ifeq ($(A2PING_283P),1)
+      ifeq ($(GS_950_OR_LATER),1)
+        A2PING_GSCNFL = 1
+      else
+        A2PING_GSCNFL = 0
+      endif
+    else
+      A2PING_GSCNFL = 0
+    endif
+  endif
+  ifeq ($(GS_953_OR_LATER),1)
+    A2PING_GSCNFL = 2
+  endif
+endif
+
+$(PDFTARGETS_OF_EPSORIG): %.pdf: %.eps
+	@echo "$< --> $@"
+ifndef A2PING
+	$(error $< --> $@: a2ping not found. Please install it)
+endif
+ifeq ($(A2PING_GSCNFL),1)
+	$(error You need to update a2ping. See #7 in FAQ-BUILD.txt)
+endif
+	@cp $< $<i
+	@sh $(FIXANEPSFONTS) $<i
+	@a2ping --below --hires --bboxfrom=compute-gs $<i $@ > /dev/null 2>&1
+	@rm -f $<i
+
+$(PDFTARGETS_OF_TEX): %.pdf: %.eps
+	@echo "$< --> $@"
+ifndef A2PING
+	$(error $< --> $@: a2ping not found. Please install it)
+endif
+ifeq ($(A2PING_GSCNFL),1)
+	$(error a2ping version conflict. See #7 in FAQ-BUILD.txt)
+endif
+ifeq ($(A2PING_GSCNFL),2)
+	@a2ping --below --gsextra=-dALLOWPSTRANSPARENCY $< $(basename $@)__.pdf > /dev/null 2>&1
+	@pdfcrop --hires $(basename $@)__.pdf $@ > /dev/null
+	@rm -f $(basename $@)__.pdf
+else
+	@a2ping --below --hires --bboxfrom=compute-gs $< $@ > /dev/null 2>&1
+endif
+
+$(PDFTARGETS_OF_EPSOTHER): %.pdf: %.eps
+	@echo "$< --> $@"
+ifndef A2PING
+	$(error $< --> $@: a2ping not found. Please install it)
+endif
+ifeq ($(A2PING_GSCNFL),1)
+	$(error a2ping version conflict. See #7 in FAQ-BUILD.txt)
+endif
+	@a2ping --below --hires --bboxfrom=compute-gs $< $@ > /dev/null 2>&1
-- 
2.17.1





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux