-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile-helper
executable file
·78 lines (70 loc) · 2.01 KB
/
Makefile-helper
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
##
# \file Makefile-helper
# \library Documents
# \author Chris Ahlstrom
# \date 2015-11-01
# \update 2022-05-15
# \version $Revision$
# \license $XPC_SUITE_GPL_LICENSE$
#
# Makefile for the yoshimi-doc project.
#
# Note the new usage of gs (Ghostscript) to optimize the PDF. Obviously, one
# must have Ghostscript installed. This optimization reduces the near 11 Mb
# PDF down to about 4 Mb in size, with no significant reduction in quality.
#
# However, lately it has started disabling the hyperlinks. So using "optimize"
# or "opt" is no longer the default.
MKERROR="no"
MKDEBUG=""
GSFLAGS="-dCompatibilityLevel=1.5 -dNOPAUSE -dQUIET -dBATCH \
-dPDFSETTINGS=/prepress"
if [ "$1" == "clean" ] ; then
pushd tex
make clean
popd
else
if [ "$1" == "debug" ] ; then
MKDEBUG="debug"
fi
echo "Building PDF using latexmk..."
pushd tex
make $MKDEBUG
if [ $? != 0 ] ; then
MKERROR="yes"
echo "FATAL ERROR in processing TeX files!"
else
cp yoshimi-advanced-reference-manual.pdf ../pdf/
fi
popd
if [ "$MKERROR" == "no" ] ; then
if [ "$1" == "optimize" ] ; then
echo "Optimizing PDF using ghostscript pdfwrite device..."
pushd pdf
cp yoshimi-advanced-reference-manual.pdf y-temp.pdf
gs -sDEVICE=pdfwrite $GSFLAGS -sOutputFile=yoshimi-advanced-reference-manual-optimized.pdf y-temp.pdf
if [ $? == 0 ] ; then
rm y-temp.pdf
else
echo "? Could not reduce the size of the PDF"
fi
popd
fi
if [ "$1" == "opt" ] ; then
echo "Optimizing PDF using ps2pdf ..."
pushd pdf
cp yoshimi-advanced-reference-manual.pdf y-temp.pdf
ps2pdf -dPDFSETTINGS=/ebook y-temp.pdf yoshimi-advanced-reference-manual-optimized.pdf
if [ $? == 0 ] ; then
rm y-temp.pdf
else
echo "? Could not reduce the size of the PDF"
fi
popd
fi
fi
fi
#******************************************************************************
# vim: ts=3 sw=3 noet ft=sh
#------------------------------------------------------------------------------