-
Notifications
You must be signed in to change notification settings - Fork 57
/
epstopdf-rule.mk
43 lines (39 loc) · 1.41 KB
/
epstopdf-rule.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright (C) Akira Yokosawa, 2021
#
# Authors: Akira Yokosawa <akiyks@gmail.com>
EPSTOPDF := $(shell $(WHICH) epstopdf 2>/dev/null)
GS_953_OR_LATER := $(shell gs --version | grep -c -E "^(9\.5[3-9]|10\.[0-9]).?")
GS_OPT=--gsopt=-dPDFSETTINGS=/ebook
$(PDFTARGETS_OF_GNUPLOT_NEEDFIXFONTS): $(FIXFONTS)
$(PDFTARGETS_OF_GNUPLOT_NEEDFIXFONTS): %.pdf: %.eps
@echo "$< --> $(suffix $@)"
ifndef EPSTOPDF
$(error $< --> $@: epstopdf not found. Please install it)
endif
@sh $(FIXFONTS) < $< > $(basename $<)__.eps
@eps2eps $(basename $<)__.eps $(basename $<)___.eps
@epstopdf $(GS_OPT) $(basename $<)___.eps $@
@rm -f $(basename $<)__.eps $(basename $<)___.eps
$(PDFTARGETS_OF_TEX): %.pdf: %.eps
@echo "$< --> $(suffix $@)"
ifndef EPSTOPDF
$(error $< --> $@: epstopdf not found. Please install it)
endif
ifeq ($(GS_953_OR_LATER),1)
@eps2eps -dALLOWPSTRANSPARENCY $< $(basename $<)__.eps
@epstopdf --gsopt=-dALLOWPSTRANSPARENCY $(GS_OPT) $(basename $<)__.eps $@
else
@eps2eps -dNOSAFER $< $(basename $<)__.eps
@epstopdf --nosafer $(GS_OPT) $(basename $<)__.eps $@
endif
@rm -f $(basename $<)__.eps
$(PDFTARGETS_OF_EPSORIG_NOFIXFONTS) $(PDFTARGETS_OF_EPSOTHER): %.pdf: %.eps
@echo "$< --> $(suffix $@)"
ifndef EPSTOPDF
$(error $< --> $@: epstopdf not found. Please install it)
endif
@eps2eps $< $(basename $<)__.eps
@epstopdf $(GS_OPT) $(basename $<)__.eps $@
@rm -f $(basename $<)__.eps