| 1 |
# Copyright 2004 Chris Monson ([email protected]) |
| 2 |
# Latest version available at http://www.bouncingchairs.net/oss |
| 3 |
# |
| 4 |
# This file is part of ``Chris Monson's Free Software''. |
| 5 |
# |
| 6 |
# ``Chris Monson's Free Software'' is free software; you can redistribute it |
| 7 |
# and/or modify it under the terms of the GNU General Public License as |
| 8 |
# published by the Free Software Foundation, Version 2. |
| 9 |
# |
| 10 |
# ``Chris Monson's Free Software'' is distributed in the hope that it will |
| 11 |
# be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 13 |
# Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License along |
| 16 |
# with ``Chris Monson's Free Software''; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 |
# |
| 19 |
# It is also available on the web at http://www.gnu.org/copyleft/gpl.html |
| 20 |
# |
| 21 |
# Note that using this makefile to build your documents does NOT place them |
| 22 |
# under the GPL unless you, the author, specifically do so. In other words, |
| 23 |
# I, Chris Monson, the copyright holder and author of this makefile, |
| 24 |
# consider it impossible to ``link'' to this makefile in any way covered by |
| 25 |
# the GPL. |
| 26 |
# |
| 27 |
# |
| 28 |
# TO OBTAIN INSTRUCTIONS FOR USING THIS FILE, RUN: |
| 29 |
# make help |
| 30 |
# |
| 31 |
fileinfo := LaTeX Makefile |
| 32 |
author := Chris Monson |
| 33 |
version := 2.2.0 |
| 34 |
# |
| 35 |
.DEFAULT_GOAL := all |
| 36 |
# Note that the user-global version is imported *after* the source directory, |
| 37 |
# so that you can use stuff like ?= to get proper override behavior. |
| 38 |
.PHONY: Makefile GNUmakefile Makefile.ini $(HOME)/.latex-makefile/Makefile.ini |
| 39 |
-include Makefile.ini |
| 40 |
-include $(HOME)/.latex-makefile/Makefile.ini |
| 41 |
# Better names for these things |
| 42 |
.PHONY: Variables.ini $(HOME)/.latex-makefile/Variables.ini |
| 43 |
-include Variables.ini |
| 44 |
-include $(HOME)/.latex-makefile/Variables.ini |
| 45 |
# |
| 46 |
# This can be pdflatex or latex - you can change this by adding the following line to your Makefile.ini: |
| 47 |
# BUILD_STRATEGY := latex |
| 48 |
BUILD_STRATEGY ?= xelatex |
| 49 |
# |
| 50 |
# Sets LC_ALL=C, by default, so that the locale-aware tools, like sort, be |
| 51 |
# # immune to changes to the locale in the user environment. |
| 52 |
export LC_ALL ?= C |
| 53 |
# |
| 54 |
# |
| 55 |
# If you specify sources here, all other files with the same suffix |
| 56 |
# will be treated as if they were _include_ files. |
| 57 |
#onlysources.tex ?= main.tex |
| 58 |
#onlysources.tex.sh ?= |
| 59 |
#onlysources.tex.pl ?= |
| 60 |
#onlysources.tex.py ?= |
| 61 |
#onlysources.rst ?= |
| 62 |
#onlysources.fig ?= |
| 63 |
#onlysources.gpi ?= |
| 64 |
#onlysources.dot ?= |
| 65 |
#onlysources.xvg ?= |
| 66 |
#onlysources.svg ?= |
| 67 |
#onlysources.eps.gz ?= |
| 68 |
#onlysources.eps ?= |
| 69 |
# |
| 70 |
# If you list files here, they will be treated as _include_ files |
| 71 |
#includes.tex ?= file1.tex file2.tex |
| 72 |
#includes.tex.sh ?= |
| 73 |
#includes.tex.pl ?= |
| 74 |
#includes.tex.py ?= |
| 75 |
#includes.rst ?= |
| 76 |
#includes.fig ?= |
| 77 |
#includes.gpi ?= |
| 78 |
#includes.dot ?= |
| 79 |
#includes.xvg ?= |
| 80 |
#includes.svg ?= |
| 81 |
#includes.eps.gz ?= |
| 82 |
#includes.eps ?= |
| 83 |
# |
| 84 |
# If you list files or wildcards here, they will *not* be cleaned - default is |
| 85 |
# to allow everything to be cleaned. |
| 86 |
neverclean ?= *.pdf |
| 87 |
# |
| 88 |
# Alternatively (recommended), you can add those lines to a Makefile.ini file |
| 89 |
# and it will get picked up automatically without your having to edit this |
| 90 |
# Makefile. |
| 91 |
# |
| 92 |
# KNOWN ISSUES: |
| 93 |
# * The following occurs: |
| 94 |
# file with: \usepackage{named}\bibliographystyle{named} |
| 95 |
# Compile |
| 96 |
# change to: \usepackage{apalike}\bibliographystyle{apalike} |
| 97 |
# Compile again -- BARF! |
| 98 |
# |
| 99 |
# The workaround: make clean-nographics; make |
| 100 |
# |
| 101 |
# Note that we may not be able to fix this. LaTeX itself barfs |
| 102 |
# on this, not the makefile. The very first invocation of LaTeX |
| 103 |
# (when something like this has happened) reads the existing .aux |
| 104 |
# file and discovers invalid commands like \citeauthoryear that |
| 105 |
# are only valid in the package that was just removed. It then |
| 106 |
# tries to parse them and explodes. It's not at all clear to me |
| 107 |
# how to fix this. I tried removing the .aux files on the first |
| 108 |
# run of LaTeX, but that necessarily requires more subsequent |
| 109 |
# rebuilds on common edits. There does not appear to be a |
| 110 |
# graceful solution to this issue. |
| 111 |
# |
| 112 |
# |
| 113 |
# CHANGES: |
| 114 |
# Chris Monson (2011-05-20): |
| 115 |
# * Bumped version to 2.2.0 (release!) |
| 116 |
# Chris Monson (2011-05-19): |
| 117 |
# * Bumped version to 2.2.0-rc15 |
| 118 |
# * Issue 125: infinite recursion with nomenclature files |
| 119 |
# * Issue 125: removed .d as a target for .nls in get-log-index |
| 120 |
# * Cleaned up invocation of run-makeindex to take an optional .ist instead of flags. |
| 121 |
# Chris Monson (2011-04-06): |
| 122 |
# * Bumped version to 2.2.0-rc14 |
| 123 |
# * Issue 121: Added Targets.ini and corresponding help text for it. |
| 124 |
# * Issue 121: Added Variables.ini (Makefile.ini still works, though). |
| 125 |
# * Issue 121: Added .DEFAULT_GOAL optional setting. |
| 126 |
# * Issue 120: xindy compatibility |
| 127 |
# Chris Monson (2011-03-16): |
| 128 |
# * Bumped version to 2.2.0-rc13 |
| 129 |
# * Fixed a bug in kspewhich invocation - random characters and a missing pipe. |
| 130 |
# * Added font embedding to gnuplot output. |
| 131 |
# Chris Monson (2011-03-15): |
| 132 |
# * Bumped version to 2.2.0-rc12 |
| 133 |
# * Issue 119: Annoying warning from which if Gnuplot not installed. |
| 134 |
# * Fixed catchall error output to show more info from the log. Cutting off the |
| 135 |
# first line is too jarring. |
| 136 |
# * Issue 118: Better glossary support |
| 137 |
# Chris Monson (2011-03-03): |
| 138 |
# * Bumped version to 2.2.0-rc11 |
| 139 |
# * Issue 112: Fixed regression introduced by use of cygpath (ugly warnings) |
| 140 |
# Chris Monson (2011-02-03): |
| 141 |
# * Bumped version to 2.2.0-rc10 |
| 142 |
# * Issue 112: Added path normalization for cygwin systems |
| 143 |
# * Fixed a bug in get-missing-inputs where we weren't specifying target files |
| 144 |
# Chris Monson (2011-01-24): |
| 145 |
# * Issue 111: Added .jpeg as a possible image extension |
| 146 |
# Chris Monson (2011-01-21): |
| 147 |
# * Issue 110: Long filenames not produced correctly in .d file |
| 148 |
# * Fixed problem with unknown control sequence error parsing |
| 149 |
# * Fixed problem with \r in fatal output (was interpreted as LF by echo) |
| 150 |
# * Removed a spurious "hi" |
| 151 |
# Chris Monson (2011-01-14): |
| 152 |
# * Bumped version to 2.2.0-rc8 |
| 153 |
# * Issue 107: Removed comment with embedded newline, fixing MinGW on Windows 7. |
| 154 |
# Chris Monson (2011-01-07): |
| 155 |
# * Emit an error if .gpi.d files have dependencies with : in the name |
| 156 |
# Chris Monson (2011-01-05): |
| 157 |
# * Bumped version to 2.2.0-rc7 |
| 158 |
# * Issue 106: existing graphic dependencies not generated correctly |
| 159 |
# Chris Monson (2011-01-04): |
| 160 |
# * Issue 106: not cleaning eps log files properly |
| 161 |
# * Issue 106: not rebuilding after creating .pdf graphics from .eps |
| 162 |
# * Issue 94: svg going unnecessarily through eps (can't reproduce) |
| 163 |
# Chris Monson (2010-12-31): |
| 164 |
# * Issue 100: make hanging because of faulty graphics detection (sed bug) |
| 165 |
# * Issue 108: do not ignore fatal errors from pdftex |
| 166 |
# Chris Monson (2010-12-23): |
| 167 |
# * Added gpi_global to gnuplot dependencies so that changes are detected |
| 168 |
# Chris Monson (2010-12-20): |
| 169 |
# * Updated build file to be smarter about Python version detection |
| 170 |
# * Created a bunch of test files and supporting scripts |
| 171 |
# * Issue 72: added apacite capaability (thanks to matkarat) |
| 172 |
# Chris Monson (2010-11-23): |
| 173 |
# * Changed to multi-part makefile build (split out sed scripts) |
| 174 |
# * Added build script and supporting infrastructure |
| 175 |
# * Updated test directory format |
| 176 |
# * Added notes about needed test cases |
| 177 |
# * Changed to use -file-line-error and fixed multiple inclusion/error bugs |
| 178 |
# * Added run_sed.py to allow easy testing of sed scripts outside of make |
| 179 |
# Chris Monson (2010-11-11): |
| 180 |
# * Bumped version to 2.2.0-rc7 |
| 181 |
# * issue 92: broken hyperref driver detection fixed |
| 182 |
# * issue 101: Broken inkscape conversion |
| 183 |
# * issue 102: Broken specification of font size for gnuplot pdfcairo |
| 184 |
# * Added KEEP_TEMP so that we can avoid deleting useful temporaries for debugging |
| 185 |
# * Restructured gnuplot code to be easier to follow |
| 186 |
# * Fixed a bug in convert-gpi where we were using $< instead of $1 |
| 187 |
# Chris Monson (2010-11-03): |
| 188 |
# * Bumped version to 2.2.0-rc6 |
| 189 |
# * issue 96: Fix sed errors when using make variables in substitutions |
| 190 |
# Chris Monson (2010-07-28): |
| 191 |
# * Bumped version to 2.2.0-rc5 (rc4 is broken) |
| 192 |
# * Bail out when we find the use of the import.sty package |
| 193 |
# * Issue 90: Add -z to dvips invocation |
| 194 |
# * Issue 67: Add xelatex support (thanks to Nikolai Prokoschenko for the patch!) |
| 195 |
# * Issue 85: Add warning about make 3.80 |
| 196 |
# Chris Monson (2010-06-20): |
| 197 |
# * Bumped version to 2.2.0-rc3 |
| 198 |
# * Attempt to fix bug with ! error detection (issue 88) |
| 199 |
# * Added svg->pdf direct support (issue 89) |
| 200 |
# Chris Monson (2010-04-28): |
| 201 |
# * Bumped version to 2.2.0-rc2 |
| 202 |
# * Fixed %._show target |
| 203 |
# Chris Monson (2010-04-08): |
| 204 |
# * Bumped version to 2.2.0-rc1 |
| 205 |
# * Added back in the rst_style_file stuff that got broken when switching |
| 206 |
# rst -> tex to use the script mechanism |
| 207 |
# Chris Monson (2010-03-23): |
| 208 |
# * Bumped version to 2.2.0-beta8 |
| 209 |
# * Work on issue 76: bad backtick escape for some sed versions, failure |
| 210 |
# to clear out the hold buffer when outputting MISSING comment. |
| 211 |
# - Backed out 2>&1 to &> (doesn't work in sh) |
| 212 |
# - Backed out using . to source variables |
| 213 |
# Chris Monson (2010-03-22): |
| 214 |
# * Bumped version to 2.2.0-beta7 |
| 215 |
# * Issue 72: Fix latex/bibtex invocation order for annotated bib styles |
| 216 |
# * Fixed informational output to reflect which LaTeX run we're on |
| 217 |
# * Fixed graphic detection to include graphics that are already there in |
| 218 |
# .d files |
| 219 |
# * Tightened up the .d file output to only make .d depend on graphic |
| 220 |
# *source* files. This means that building foo.d no longer |
| 221 |
# builds all of the graphics files on which foo.tex depends. |
| 222 |
# Had to use .SECONDEXPANSION trickery to make it work. |
| 223 |
# * Changed get-graphics to only accept a stem. |
| 224 |
# * Fixed build-once logic for scripted .tex to work better |
| 225 |
# * Made get-inputs sed script more maintainable. |
| 226 |
# * Moved Makefile.ini import up higher. |
| 227 |
# * Changed bare stems to not recursively invoke make |
| 228 |
# * Updated diff output to be more silent everywhere |
| 229 |
# * Added a MISSING comment to the .d file if stuff isn't found - forces |
| 230 |
# removal of .1st.make file, which often forces it to try again. |
| 231 |
# * Fixed broken graphics-target function |
| 232 |
# * Added sleep to .d file generation when stuff is missing - if it |
| 233 |
# builds too fast, make doesn't realize it needs to be reloaded, |
| 234 |
# and thus never discovers some deeper dependencies (especially |
| 235 |
# evident when graphics are included from scripted include |
| 236 |
# files). |
| 237 |
# Chris Monson (2010-03-17): |
| 238 |
# * Bumped version to 2.2.0-beta6 |
| 239 |
# * Fixed bareword builds to actually work (requires static patterns) |
| 240 |
# * Fixed colorization to work with new paragraph stuff |
| 241 |
# Chris Monson (2010-03-17): |
| 242 |
# * Bumped version to 2.2.0-beta5 |
| 243 |
# * Fixed graphic detection to be much more focused - splits log file |
| 244 |
# into paragraphs before doing pattern matching. |
| 245 |
# * Fixed make foo to work properly (recursively calls make foo.pdf) |
| 246 |
# * Fixed gpi -> pdf generation to not waste time building .eps *after* |
| 247 |
# the pdf already exists. |
| 248 |
# * Changed log copies to include MAKE_RESTARTS as part of the name. |
| 249 |
# * Fixed missing include file detection (also makes use of the paragraph |
| 250 |
# stuff) to detect missing scripted include files. |
| 251 |
# Chris Monson (2010-03-16): |
| 252 |
# * Bumped version to 2.2.0-beta4 |
| 253 |
# * issue 70: .pdf not moved out of the way properly on first |
| 254 |
# compilation, resulting in early error detection failure. |
| 255 |
# * issue 74: fixed broken error on missing .aux files: the |
| 256 |
# implementation was masking real errors. |
| 257 |
# Chris Monson (2010-03-15): |
| 258 |
# * Bumped version to 2.2.0-beta3 |
| 259 |
# * issue 71: Made the tput dependency optional |
| 260 |
# * issue 73: Made .tex targets not pull in .d files (building them from |
| 261 |
# scripts should not require a .d) |
| 262 |
# * issue 74: Output a much saner error when a .aux file is not produced |
| 263 |
# (e.g., when you are typing "make" without arguments in a |
| 264 |
# directory with included .tex files that are not named with |
| 265 |
# ._include_.) |
| 266 |
# Chris Monson (2010-03-11): |
| 267 |
# * Bumped version to 2.2.0-beta2 |
| 268 |
# * Fixed clean-graphics to get rid of intermediate .eps files that may |
| 269 |
# be hanging around |
| 270 |
# * Added an automatic setting to use eps terminals in pdflatex mode for |
| 271 |
# gnuplot if it doesn't understand pdf. |
| 272 |
# * issue 66: Removed grayscale generation via magic suffix. Grayscale |
| 273 |
# generation is now only available via GRAY=1 |
| 274 |
# * issue 68: Added explicit handling of LC_ALL for locale-aware tools |
| 275 |
# like "sort" |
| 276 |
# Chris Monson (2010-03-10): |
| 277 |
# * Bumped version to 2.2.0-beta1 |
| 278 |
# * Fixed success message to handle output message in different places |
| 279 |
# * Added name of produced file to success message |
| 280 |
# Chris Monson (2010-03-10): |
| 281 |
# * Bumped version to 2.2.0-alpha3 |
| 282 |
# * Added meaningful error message for wrong hyperref options |
| 283 |
# * Added meaningful error message for incorrect graphics extensions |
| 284 |
# Chris Monson (2010-03-09): |
| 285 |
# * Bumped version to 2.2.0-alpha2 |
| 286 |
# * Updated graphics handling (gnuplot and fig generate pdf natively) |
| 287 |
# * Changed xmgrace to output monochrome natively |
| 288 |
# Chris Monson (2010-03-09): |
| 289 |
# * Bumped version to 2.2.0-alpha1 - major change! |
| 290 |
# * Support pdflatex natively and by default (issue 6 - a long time coming) |
| 291 |
# * Add ability to have a single $HOME/.latex-makefile/Makefile.ini for |
| 292 |
# all invocations |
| 293 |
# * Reworked graphic inclusion detection so that extensions need not be |
| 294 |
# specified for either build strategy (e.g., |
| 295 |
# \includegraphics{test1.eps} -> \includegrahpics{test1}) |
| 296 |
# * Changed log format to include filenames and line numbers |
| 297 |
# Chris Monson (2010-02-04): |
| 298 |
# * Bumped version to 2.1.43 |
| 299 |
# * All of the following are for issue 63 (thanks to mojoh81): |
| 300 |
# * Added documentation about fixing Makefile.ini default target |
| 301 |
# * Added perl and python script targets |
| 302 |
# * Fixed run logic to allow included .tex files to be scripted (the |
| 303 |
# run-again logic now detects missing .tex files, and the MV |
| 304 |
# command has been switched out for a command that only invokes |
| 305 |
# MV if the files exist) |
| 306 |
# * Changed scripted generation to only run once per make invocation |
| 307 |
# * Added dependency on expr |
| 308 |
# Chris Monson (2010-01-19): |
| 309 |
# * Bumped version to 2.1.42 |
| 310 |
# * issue 62: Added .brf extension to cleanable files (backrefs) |
| 311 |
# Chris Monson (2010-01-07): |
| 312 |
# * Bumped version to 2.1.41 |
| 313 |
# * issue 60: bad makeindex runs now error out on subsequent tries |
| 314 |
# Chris Monson (2009-12-01): |
| 315 |
# * Bumped version to 2.1.40 |
| 316 |
# * issue 36: build all indices (for e.g., splitidx usage) |
| 317 |
# * issue 59: clean up all generated files (including indices) |
| 318 |
# Chris Monson (2009-11-23): |
| 319 |
# * Bumped version to 2.1.39 |
| 320 |
# * issue 57: change ps2pdf invocations to just use gs directly |
| 321 |
# Chris Monson (2009-11-19): |
| 322 |
# * Bumped version to 2.1.38 |
| 323 |
# * issue 57: Added some limited support for Cygwin (spaces in filenames) |
| 324 |
# Chris Monson (2009-11-15): |
| 325 |
# * Bumped version to 2.1.37 |
| 326 |
# * Removed svninfo, since this is now managed by mercurial |
| 327 |
# * Fixed typo in changelist |
| 328 |
# * Issue 52: added jpg->eps conversion (thanks to brubakee) |
| 329 |
# * Issue 54: fix missing Overfull colorization due to lack of a blank |
| 330 |
# line preceding the first error. |
| 331 |
# * Issue 51: remove head.tmp and body.tmp in make clean invocation |
| 332 |
# * Issue 56: maintain multiple versions of log files (for debugging) |
| 333 |
# Chris Monson (2009-11-14): |
| 334 |
# * Bumped version to 2.1.36 |
| 335 |
# * Issues 53 and 49: added .brf, .mtc, and .maf to the cleanables |
| 336 |
# Chris Monson (2009-11-05): |
| 337 |
# * Bumped version to 2.1.35 |
| 338 |
# * Added nomenclature support (see issue 48) |
| 339 |
# Chris Monson (2009-10-29): |
| 340 |
# * Bumped version to 2.1.34 |
| 341 |
# * Fixed _out_ creation bug introduced in 2.1.33 (it was always created) |
| 342 |
# * Fixed erroneous help output for $HOME in BINARY_TARGET_DIR |
| 343 |
# * Changed contact email address - bring on the spam! |
| 344 |
# Chris Monson (2009-10-21): |
| 345 |
# * Bumped version to 2.1.33 |
| 346 |
# * Fixed issue 46, adding support for dot2tex (thanks to fdemesmay) |
| 347 |
# * Made all_files.* settable in Makefile.ini (using ?= instead of :=) |
| 348 |
# * Fixed issue 47, thanks to fdemesmay: add binary copy directory, copy |
| 349 |
# dvi, pdf, and ps if it exists |
| 350 |
# Chris Monson (2009-09-25): |
| 351 |
# * Bumped version to 2.1.32 |
| 352 |
# * Fixed so that a changed lol file will cause a rebuild |
| 353 |
# * Added .lol files to the cleanable list |
| 354 |
# Chris Monson (2009-09-08): |
| 355 |
# * Bumped version to 2.1.31 |
| 356 |
# * Closed issue 43: evince doesn't notice pdf change w/out touch |
| 357 |
# Chris Monson (2009-08-28): |
| 358 |
# * Bumped version to 2.1.30 |
| 359 |
# * Closed issue 39: Capture multi-line log warnings/errors to output |
| 360 |
# Chris Monson (2009-08-26): |
| 361 |
# * Bumped version to 2.1.29 |
| 362 |
# * Closed issue 42: add svg support using inkscape |
| 363 |
# Chris Monson (2009-08-17): |
| 364 |
# * Bumped version to 2.1.28 |
| 365 |
# * Patch from paul.biggar for issue 38: package warnings are overlooked |
| 366 |
# Chris Monson (2009-08-07): |
| 367 |
# * Bumped version to 2.1.27 |
| 368 |
# * Included patch for issue 37 - removes pdf/ps files before copying, |
| 369 |
# allowing some broken viewers to see changes properly. |
| 370 |
# Chris Monson (2009-05-15): |
| 371 |
# * Bumped version to 2.1.26 |
| 372 |
# * Included patch for issue 9 from favonia - detects .fig changes for |
| 373 |
# pstex files during regular compilation, so long as the pstex |
| 374 |
# has been built at least once with make all-pstex. |
| 375 |
# Chris Monson (2009-03-27): |
| 376 |
# * Bumped version to 2.1.25 |
| 377 |
# * Cleaned up a bunch of variable setting stuff - more stuff is now |
| 378 |
# settable from Makefile.ini |
| 379 |
# * Cleaned up documentation for various features, especially settable |
| 380 |
# variables. |
| 381 |
# * issue 28: support for png -> eps conversion (it even looks good!) |
| 382 |
# * issue 29: support for "neverclean" files in Makefile.ini |
| 383 |
# * issue 30: make ps2pdf14 the default - fall back when not there |
| 384 |
# Chris Monson (2009-03-09): |
| 385 |
# * Bumped version to 2.1.24 |
| 386 |
# * issue 27: xmgrace support (thanks to rolandschulzhd) |
| 387 |
# Chris Monson (2008-10-23): |
| 388 |
# * Bumped version to 2.1.23 |
| 389 |
# * issue 23: fixed _check_programs to not use bash string subs |
| 390 |
# Chris Monson (2008-09-02): |
| 391 |
# * Bumped version to 2.1.22 |
| 392 |
# * Appled patch from Holger <[email protected]> to add include |
| 393 |
# sources and some documentation updates. |
| 394 |
# * Updated backup_patterns to be a bit more aggressive (also thanks to |
| 395 |
# Holger) |
| 396 |
# Chris Monson (2008-08-30): |
| 397 |
# * Bumped version to 2.1.21 |
| 398 |
# * Added ability to specify onlysources.* variables to indicate the only |
| 399 |
# files that should *not* be considered includes. Thanks to Holger |
| 400 |
# <[email protected]> for this patch. |
| 401 |
# * Added an automatic include of Makefile.ini if it exists. Allows |
| 402 |
# settings to be made outside of this makefile. |
| 403 |
# Chris Monson (2008-05-21): |
| 404 |
# * Bumped version to 2.1.20 |
| 405 |
# * Added manual pstex compilation support (run make all-pstex first) |
| 406 |
# * Removed all automatic pstex support. It was totally breaking |
| 407 |
# everything and is very hard to incorporate into the makefile |
| 408 |
# concept because it requires LaTeX to *fail* before it can |
| 409 |
# determine that it needs the files. |
| 410 |
# Chris Monson (2008-04-17): |
| 411 |
# * Bumped version to 2.1.19 |
| 412 |
# * Changed the pstex build hack to be on by default |
| 413 |
# Chris Monson (2008-04-09): |
| 414 |
# * Bumped version to 2.1.18 |
| 415 |
# * issue 16: fixed pstex build problems, seems nondeterministic. Added |
| 416 |
# gratuitious hack for testing: set PSTEX_BUILD_ALL_HACK=1. |
| 417 |
# Chris Monson (2008-04-09): |
| 418 |
# * Bumped version to 2.1.17 |
| 419 |
# * issue 20: fixed accumulation of <pid>*.make files - wildcard was |
| 420 |
# refusing to work on files that are very recently created. |
| 421 |
# Chris Monson (2008-04-02): |
| 422 |
# * Bumped version to 2.1.16 |
| 423 |
# * issue 19: Removed the use of "type" to fix broken "echo" settings |
| 424 |
# Chris Monson (2008-03-27): |
| 425 |
# * Bumped version to 2.1.15 |
| 426 |
# * issue 18: Favors binary echo over builtin, as binary understands -n |
| 427 |
# * issue 16: Fixed handling of missing pstex_t files in the log |
| 428 |
# * issue 9: Added .SECONDARY target for .pstex files |
| 429 |
# Chris Monson (2008-03-21): |
| 430 |
# * Bumped version to 2.1.14 |
| 431 |
# * Fixed broken aux file flattening, which caused included bibs to be |
| 432 |
# missed. |
| 433 |
# Chris Monson (2008-03-20): |
| 434 |
# * Bumped version to 2.1.13 |
| 435 |
# * Changed error output colorization to show errors for missing files |
| 436 |
# that are not graphics files. |
| 437 |
# Chris Monson (2008-03-20): |
| 438 |
# * Bumped version to 2.1.12 |
| 439 |
# * Fixed a regression introduced in r28 that makes bibtex fail when |
| 440 |
# there is no index file present |
| 441 |
# Chris Monson (2008-03-03): |
| 442 |
# * Bumped version to 2.1.11 |
| 443 |
# * Fixed issue 11 (handle index files, reported by abachn) |
| 444 |
# * Cleaned up some comments and help text |
| 445 |
# Chris Monson (2008-01-24): |
| 446 |
# * Bumped version to 2.1.10 |
| 447 |
# * Fixed to work when 'sh' is a POSIX shell like 'dash' |
| 448 |
# Chris Monson (2007-12-12): |
| 449 |
# * Bumped version to 2.1.9 |
| 450 |
# * Fixed documentation and dependency graph for pstex files |
| 451 |
# Chris Monson (2007-12-12): |
| 452 |
# * Bumped version to 2.1.8 |
| 453 |
# * Added basic pstex_t support for fig files (Issue 9 by favonia) |
| 454 |
# I still suggest that psfrag be used instead. |
| 455 |
# Chris Monson (2007-10-16): |
| 456 |
# * Bumped version to 2.1.7 |
| 457 |
# * Removed todo item: allow other comment directives for rst conversion |
| 458 |
# * Added ability to use global rst style file _rststyle_._include_.tex |
| 459 |
# * Added help text to that effect |
| 460 |
# Chris Monson (2007-05-20): |
| 461 |
# * Bumped version to 2.1.6 |
| 462 |
# * Changed default paper size for rst files |
| 463 |
# * Added todo item: fix paper size for rst files |
| 464 |
# * Added todo item: allow other comment directives for rst conversion |
| 465 |
# Chris Monson (2007-04-02): |
| 466 |
# * Bumped version to 2.1.5 |
| 467 |
# * Addressed Issue 7, incorrect .gpi.d generation in subdirectories |
| 468 |
# Chris Monson (2007-03-28): |
| 469 |
# * Bumped version to 2.1.4 |
| 470 |
# * Fixed syntax error in dot output |
| 471 |
# Chris Monson (2007-03-01): |
| 472 |
# * Bumped version to 2.1.3 |
| 473 |
# * Added reST to the included documentation |
| 474 |
# * Fixed graphics and script generation to be settable in the |
| 475 |
# environment. |
| 476 |
# Chris Monson (2007-02-23): |
| 477 |
# * Bumped version to 2.1.2 |
| 478 |
# * Added the ability to generate .tex files from .rst files |
| 479 |
# Chris Monson (2006-10-17): |
| 480 |
# * Bumped version to 2.1.1 |
| 481 |
# * Fixed includes from subdirectories (sed-to-sed slash escape problem) |
| 482 |
# Chris Monson (2006-10-05): |
| 483 |
# * Bumped version to 2.1.0 (pretty serious new feature added) |
| 484 |
# * New feature: bib files can now be anywhere on the BIBINPUTS path |
| 485 |
# * New programs: kpsewhich (with tetex) and xargs (BSD) |
| 486 |
# Chris Monson (2006-09-28): |
| 487 |
# * Bumped version to 2.0.9 |
| 488 |
# * Added ability to parse more than one bibliography |
| 489 |
# Chris Monson (2006-06-01): |
| 490 |
# * Bumped version to 2.0.8 |
| 491 |
# * Added .vrb to the list of cleaned files |
| 492 |
# Chris Monson (2006-04-26): |
| 493 |
# * Bumped version to 2.0.7 |
| 494 |
# * Fixed so that clean-nographics does not remove .gpi.d files |
| 495 |
# * Removed jpg -> eps hack (not working properly -- just pre-convert) |
| 496 |
# * Fixed so that postscript grayscale can be done with BSD sed |
| 497 |
# Chris Monson (2006-04-25): |
| 498 |
# * Bumped version to 2.0.6 |
| 499 |
# * Fixed so that changed toc, lot, lof, or out causes a rebuild |
| 500 |
# Chris Monson (2006-04-17): |
| 501 |
# * Bumped version to 2.0.5 |
| 502 |
# * Added jpg -> eps conversion target |
| 503 |
# Chris Monson (2006-04-12): |
| 504 |
# * Bumped version to 2.0.4 |
| 505 |
# * Fixed BSD sed invocation to not use \| as a branch delimiter |
| 506 |
# * Added a comment section on what is and is not allowed in BSD sed |
| 507 |
# * Made paper size handling more robust while I was at it |
| 508 |
# * Fixed postscript RGB grayscale to use a weighted average |
| 509 |
# * Fixed postscript HSB grayscale to convert to RGB first |
| 510 |
# * Fixed a problem with rebuilding .bbl files |
| 511 |
# Chris Monson (2006-04-11): |
| 512 |
# * Bumped version to 2.0.3 |
| 513 |
# * Fixed some BSD sed problems: can't use \n in substitutions |
| 514 |
# Chris Monson (2006-04-10): |
| 515 |
# * Bumped version to 2.0.2 |
| 516 |
# * Once again removed ability to create .tex files from scripts |
| 517 |
# * \includeonly works again |
| 518 |
# Chris Monson (2006-04-09): |
| 519 |
# * Bumped version to 2.0.1 |
| 520 |
# * Fixed grayscale postscript handling to be more robust |
| 521 |
# * Added ability to generate ._gray_. files from eps and eps.gz |
| 522 |
# * Added ability to clean ._gray_.eps files created from .eps files |
| 523 |
# Chris Monson (2006-04-07): |
| 524 |
# * Bumped version to 2.0.0 |
| 525 |
# * Removed clunky ability to create included .tex files from scripts |
| 526 |
# * Added note in the help about included tex scripting not working |
| 527 |
# * Fixed the .eps generation to delete %.gpihead.make when finished |
| 528 |
# * Abandoned designs to use shell variables to create sed scripts |
| 529 |
# * Abandoned __default__.tex.sh idea: it causes recursion with %: . |
| 530 |
# * Removed web page to-do. All items are now complete. |
| 531 |
# * Added better grayscale conversion for dot figures (direct ps fixup). |
| 532 |
# * Include files can now be scripted (at the expense of \includeonly). |
| 533 |
# * Updated dependency graph to contain better node names. |
| 534 |
# Chris Monson (2006-04-06): |
| 535 |
# * Bumped version to 2.0b3 |
| 536 |
# * Top level includes now fail if there is no rule to build them |
| 537 |
# * A helpful message is printed when they do fail |
| 538 |
# * Grayscale has been changed to be ._gray_, other phonies use _ now, too |
| 539 |
# * Grayscale handling has been completed |
| 540 |
# * Changed _include_stems target to _includes target. |
| 541 |
# * Fixed _includes target to be useful by itself. |
| 542 |
# * Removed the ability to specify clean and build targets at once |
| 543 |
# * Verified that epsfig works fine with current code |
| 544 |
# * Fixed included scripts so that they are added to the dep files |
| 545 |
# * Fixed so that graphics includes don't happen if they aren't for gpi |
| 546 |
# * Fixed dot output to allow grayscale. |
| 547 |
# Chris Monson (2006-04-05): |
| 548 |
# * Bumped version to 2.0b2 |
| 549 |
# * Removed automatic -gray output. It needs fixing in a bad way. |
| 550 |
# * Revamped dependency creation completely. |
| 551 |
# * Fixed conditional inclusion to actually work (test.nobuild.d, test.d). |
| 552 |
# * Fixed clean target to remove log targets |
| 553 |
# * Added the 'monochrome' word for gray gpi output |
| 554 |
# * Added a _check_gpi_files target that checks for common problems |
| 555 |
# * Changed the _version target into the version target (no _) |
| 556 |
# * Added better handling of grayscale files. Use the .gray.pdf target. |
| 557 |
# * Fixed testing for rebuilds |
| 558 |
# Chris Monson (2006-04-04): |
| 559 |
# * Bumped version to 2.0b1 |
| 560 |
# * Changed colorization of output |
| 561 |
# * Made .auxbbl and .auxtex .make files secondary targets |
| 562 |
# * Shortened and simplified the final latex invocation loop |
| 563 |
# * Added version-specific output ($$i vs. $$$$i) in latex loop |
| 564 |
# * Added a build message for the first .dvi run (Building .dvi (0)) |
| 565 |
# * Removed some build messages that most people don't care about. |
| 566 |
# * Simplified procedure for user-set colors -- simple text specification |
| 567 |
# * Fixed diff output to...not output. |
| 568 |
# * Fixed rerun bug -- detect not only when preceded with LaTeX Warning |
| 569 |
# * Sped up gpi plotting |
| 570 |
# * Added error handling and colorized output for gpi failure |
| 571 |
# * Documented color changing stuff. |
| 572 |
# * Now sort the flattened aux file to avoid false recompilation needs |
| 573 |
# * Added clean-nographics target |
| 574 |
# * Don't remove self.dvi file if self.aux is missing in the log |
| 575 |
# * Clarified some code. Did some very minor adjusting. |
| 576 |
# Chris Monson (2006-04-03): |
| 577 |
# * Bumped version to 2.0a7 |
| 578 |
# * Added .dvi and .ps files as secondary files. |
| 579 |
# * Fixed handling of multiple run detection when includeonly is in use. |
| 580 |
# * Added code to flatten .aux files. |
| 581 |
# * Added more files as .SECONDARY prerequisites to avoid recompilation. |
| 582 |
# * Fixed the inputs generation to be much simpler and to use pipes. |
| 583 |
# * Added the dependency graph directly into the makefile. |
| 584 |
# * Changed flatten-aux to remove \@writefile \relax \newlabel, etc. |
| 585 |
# * Undid pipe changes with sed usage (BSD sed doesn't know -f-). |
| 586 |
# * Added a _check_programs target that tells you what your system has. |
| 587 |
# * Fixed an error in colorization that made unnecessary errors appear |
| 588 |
# * Added view targets. |
| 589 |
# * Updated help text. |
| 590 |
# * Augmented cookies so that .aux can trigger .bbl and .dvi rebuilds |
| 591 |
# * Added more informative error handling for dvips and ps2pdf |
| 592 |
# Chris Monson (2006-04-02): |
| 593 |
# * Bumped version to 2.0a6 |
| 594 |
# * Added indirection to .bbl dependencies to avoid rebuilding .bbl files |
| 595 |
# * Streamlined the diff invocation to eliminate an existence test |
| 596 |
# * Removed special shell quote escape variables |
| 597 |
# * Moved includes to a more prominent location |
| 598 |
# * Fixed .inputs.make to not contain .aux files |
| 599 |
# * Fixed embedding to use a file instead of always grepping. |
| 600 |
# * Added *.make.temp to the list of cleanable files |
| 601 |
# * Fixed Ruby. It should now be supported properly. |
| 602 |
# * Now differentiate between all, default, and buildable files. |
| 603 |
# * Fixed to bail out on serious errors. |
| 604 |
# * Revised the handling of includable files. Still working on it. |
| 605 |
# Chris Monson (2006-03-31): |
| 606 |
# * Bumped version to 2.0a5 |
| 607 |
# * Fixed a bug with LaTeX error detection (there can be spaces) |
| 608 |
# * Added .bbl support, simplifying everything and making it more correct |
| 609 |
# * Refactored some tests that muddy the code |
| 610 |
# * Did a little cleanup of some shell loops that can safely be make loops |
| 611 |
# * Added support for graphviz .dot files |
| 612 |
# * Made _all_programs output easier to read |
| 613 |
# * Added the ruby support that has long been advertised |
| 614 |
# * Font embedding was screwed up for PostScript -- now implicit |
| 615 |
# * Changed the generation of -gray.gpi files to a single command |
| 616 |
# * Changed any make-generated file that is not included from .d to .make |
| 617 |
# Chris Monson (2006-03-30): |
| 618 |
# * Bumped version to 2.0a4 |
| 619 |
# * Fixed a bug with very long graphics file names |
| 620 |
# * Added a todo entry for epsfig support |
| 621 |
# * Fixed a bug paper size bug: sometimes more than one entry appears |
| 622 |
# * Fixed DVI build echoing to display the number instead of process ID |
| 623 |
# * DVI files are now removed on first invocation if ANY file is missing |
| 624 |
# * Added a simple grayscale approach: if a file ends with -gray.gpi, it |
| 625 |
# is created from the corresponding .gpi file with a special |
| 626 |
# comment ##GRAY in its header, which causes coloring to be |
| 627 |
# turned off. |
| 628 |
# * Fixed a bug in the handling of .tex.sh files. For some reason I had |
| 629 |
# neglected to define file stems for scripted output. |
| 630 |
# * Removed a trailing ; from the %.graphics dependencies |
| 631 |
# * Added dvips embedding (I think it works, anyway) |
| 632 |
# Chris Monson (2006-03-29): |
| 633 |
# * Bumped version to 2.0a3 |
| 634 |
# * Fixed error in make 3.79 with MAKEFILE_LIST usage |
| 635 |
# * Added the presumed filename to the _version output |
| 636 |
# * Added a vim macro for converting sed scripts to make commands |
| 637 |
# * Added gpi dependency support (plotting external files and loading gpi) |
| 638 |
# * Allow .gpi files to be ignored if called .include.gpi or .nobuild.gpi |
| 639 |
# * Fixed sed invocations where \+ was used. BSD sed uses \{1,\}. |
| 640 |
# Chris Monson (2006-03-28): |
| 641 |
# * Bumped version to 2.0a2 |
| 642 |
# * Added SHELL_DEBUG and VERBOSE options |
| 643 |
# * Changed the default shell back to /bin/sh (unset, in other words) |
| 644 |
# * Moved .PHONY declarations closer to their targets |
| 645 |
# * Moved help text into its own define block to obtain better formatting |
| 646 |
# * Removed need for double-entry when adding a new program invocation |
| 647 |
# * Moved .SECONDARY declaration closer to its relevant occurrence |
| 648 |
# * Commented things more heavily |
| 649 |
# * Added help text about setting terminal and output in gnuplot |
| 650 |
# * Created more fine-grained clean targets |
| 651 |
# * Added a %.graphics target that generates all of %'s graphics |
| 652 |
# * Killed backward-compatible graphics generation (e.g., eps.gpi=gpi.eps) |
| 653 |
# * For now, we're just GPL 2, not 3. Maybe it will change later |
| 654 |
# * Made the version and svninfo into variables |
| 655 |
# Chris Monson (2006-03-27): |
| 656 |
# * Bumped version to 2.0a1 |
| 657 |
# * Huge, sweeping changes -- automatic dependencies |
| 658 |
# |
| 659 |
|
| 660 |
# IMPORTANT! |
| 661 |
# |
| 662 |
# When adding to the following list, do not introduce any blank lines. The |
| 663 |
# list is extracted for documentation using sed and is terminated by a blank |
| 664 |
# line. |
| 665 |
# |
| 666 |
# EXTERNAL PROGRAMS: |
| 667 |
# = ESSENTIAL PROGRAMS = |
| 668 |
# == Basic Shell Utilities == |
| 669 |
CAT ?= cat |
| 670 |
CP ?= cp -f |
| 671 |
DIFF ?= diff |
| 672 |
ECHO ?= echo |
| 673 |
EGREP ?= egrep |
| 674 |
ENV ?= env |
| 675 |
EXPR ?= expr |
| 676 |
MV ?= mv -f |
| 677 |
SED ?= sed |
| 678 |
SORT ?= sort |
| 679 |
TOUCH ?= touch |
| 680 |
UNIQ ?= uniq |
| 681 |
WHICH ?= which |
| 682 |
XARGS ?= xargs |
| 683 |
SLEEP ?= sleep |
| 684 |
# == LaTeX (tetex-provided) == |
| 685 |
BIBTEX ?= bibtex |
| 686 |
DVIPS ?= dvips |
| 687 |
LATEX ?= latex |
| 688 |
PDFLATEX ?= pdflatex |
| 689 |
XELATEX ?= xelatex |
| 690 |
EPSTOPDF ?= epstopdf |
| 691 |
MAKEINDEX ?= makeindex |
| 692 |
XINDY ?= xindy |
| 693 |
KPSEWHICH ?= kpsewhich |
| 694 |
GS ?= gs |
| 695 |
# = OPTIONAL PROGRAMS = |
| 696 |
# == For MikTex under Cygwin, to get path names right |
| 697 |
CYGPATH ?= cygpath |
| 698 |
# == Makefile Color Output == |
| 699 |
TPUT ?= tput |
| 700 |
# == TeX Generation == |
| 701 |
PERL ?= perl |
| 702 |
PYTHON ?= python |
| 703 |
RST2LATEX ?= rst2latex.py |
| 704 |
# == EPS Generation == |
| 705 |
CONVERT ?= convert # ImageMagick |
| 706 |
DOT ?= dot # GraphViz |
| 707 |
DOT2TEX ?= dot2tex # dot2tex - add options (not -o) as needed |
| 708 |
FIG2DEV ?= fig2dev # XFig |
| 709 |
GNUPLOT ?= gnuplot # GNUplot |
| 710 |
INKSCAPE ?= inkscape # Inkscape (svg support) |
| 711 |
XMGRACE ?= xmgrace # XMgrace |
| 712 |
PNGTOPNM ?= pngtopnm # From NetPBM - step 1 for png -> eps |
| 713 |
PPMTOPGM ?= ppmtopgm # From NetPBM - (gray) step 2 for png -> eps |
| 714 |
PNMTOPS ?= pnmtops # From NetPBM - step 3 for png -> eps |
| 715 |
GUNZIP ?= gunzip # GZipped EPS |
| 716 |
# == Beamer Enlarged Output == |
| 717 |
PSNUP ?= psnup |
| 718 |
# == Viewing Stuff == |
| 719 |
VIEW_POSTSCRIPT ?= gv |
| 720 |
VIEW_PDF ?= xpdf |
| 721 |
VIEW_GRAPHICS ?= display |
| 722 |
|
| 723 |
# Xindy glossaries |
| 724 |
XINDYLANG ?= english |
| 725 |
XINDYENC ?= utf8 |
| 726 |
|
| 727 |
# If cygpath is present, then we create a path-norm function that uses it, |
| 728 |
# otherwise the function is just a no-op. Issue 112 has details. |
| 729 |
USE_CYGPATH := $(if $(shell $(WHICH) $(CYGPATH) 2>/dev/null),yes,) |
| 730 |
|
| 731 |
# $(call get-cygpath,<path>) |
| 732 |
define get-cygpath |
| 733 |
$(shell $(CYGPATH) -u "$(shell $(CYGPATH) -s -w $1)") |
| 734 |
endef |
| 735 |
|
| 736 |
define path-norm |
| 737 |
$(if $(USE_CYGPATH),$(call get-cygpath,$1),$1) |
| 738 |
endef |
| 739 |
|
| 740 |
# Command options for embedding fonts and postscript->pdf conversion |
| 741 |
PS_EMBED_OPTIONS ?= -dPDFSETTINGS=/printer -dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100 |
| 742 |
PS_COMPATIBILITY ?= 1.4 |
| 743 |
|
| 744 |
# If set to something, will cause temporary files to not be deleted immediately |
| 745 |
KEEP_TEMP ?= |
| 746 |
|
| 747 |
# Defaults for GPI |
| 748 |
DEFAULT_GPI_EPS_FONTSIZE ?= 22 |
| 749 |
DEFAULT_GPI_PDF_FONTSIZE ?= 12 |
| 750 |
|
| 751 |
# Style file for ReST |
| 752 |
RST_STYLE_FILE ?= $(wildcard _rststyle_._include_.tex) |
| 753 |
|
| 754 |
# This ensures that even when echo is a shell builtin, we still use the binary |
| 755 |
# (the builtin doesn't always understand -n) |
| 756 |
FIXED_ECHO := $(if $(findstring -n,$(shell $(ECHO) -n)),$(shell which echo),$(ECHO)) |
| 757 |
ECHO := $(if $(FIXED_ECHO),$(FIXED_ECHO),$(ECHO)) |
| 758 |
|
| 759 |
define determine-gnuplot-output-extension |
| 760 |
$(if $(shell $(WHICH) $(GNUPLOT) 2>/dev/null), |
| 761 |
$(if $(findstring unknown or ambiguous, $(shell $(GNUPLOT) -e "set terminal pdf" 2>&1)), |
| 762 |
eps, pdf), |
| 763 |
none) |
| 764 |
endef |
| 765 |
|
| 766 |
GNUPLOT_OUTPUT_EXTENSION ?= $(strip $(call determine-gnuplot-output-extension)) |
| 767 |
|
| 768 |
# Internal code should use this because of :=. This means that the potentially |
| 769 |
# expensive script invocation used to determine whether pdf is available will |
| 770 |
# only be run once. |
| 771 |
GPI_OUTPUT_EXTENSION := $(strip $(GNUPLOT_OUTPUT_EXTENSION)) |
| 772 |
|
| 773 |
# Note, if the terminal *does* understand fsize, then we expect this call to |
| 774 |
# create a specific error here: "fsize: expecting font size". Otherwise, we |
| 775 |
# assume that fsize is not understood. |
| 776 |
GPI_FSIZE_SYNTAX := $(strip \ |
| 777 |
$(if \ |
| 778 |
$(filter pdf,$(GPI_OUTPUT_EXTENSION)),\ |
| 779 |
$(if \ |
| 780 |
$(findstring fsize: expecting font size,$(shell $(GNUPLOT) -e "set terminal pdf fsize" 2>&1)),\ |
| 781 |
fsize FONTSIZE,\ |
| 782 |
font ",FONTSIZE"),\ |
| 783 |
FONTSIZE)) |
| 784 |
|
| 785 |
# Directory into which we place "binaries" if it exists. |
| 786 |
# Note that this can be changed on the commandline or in Makefile.ini: |
| 787 |
# |
| 788 |
# Command line: |
| 789 |
# make BINARY_TARGET_DIR=$HOME/pdfs myfile.pdf |
| 790 |
# |
| 791 |
# Also, you can specify a relative directory (relative to the Makefile): |
| 792 |
# make BINARY_TARGET_DIR=pdfs myfile.pdf |
| 793 |
# |
| 794 |
# Or, you can use Makefile.ini: |
| 795 |
# |
| 796 |
# BINARY_TARGET_DIR := $(HOME)/bin_out |
| 797 |
# |
| 798 |
BINARY_TARGET_DIR ?= _out_ |
| 799 |
|
| 800 |
RESTARTS := $(if $(MAKE_RESTARTS),$(MAKE_RESTARTS),0) |
| 801 |
# SH NOTES |
| 802 |
# |
| 803 |
# On some systems, /bin/sh, which is the default shell, is not linked to |
| 804 |
# /bin/bash. While bash is supposed to be sh-compatible when invoked as sh, it |
| 805 |
# just isn't. This section details some of the things you have to stay away |
| 806 |
# from to remain sh-compatible. |
| 807 |
# |
| 808 |
# * File pattern expansion does not work for {} |
| 809 |
# * [ "$x" = "$y" ] has to be [ x"$x" x"$y" ] |
| 810 |
# * &> for stderr redirection doesn't work, use 2>&1 instead |
| 811 |
# |
| 812 |
# BSD SED NOTES |
| 813 |
# |
| 814 |
# BSD SED is not very nice compared to GNU sed, but it is the most |
| 815 |
# commonly-invoked sed on Macs (being based on BSD), so we have to cater to |
| 816 |
# it or require people to install GNU sed. It seems like the GNU |
| 817 |
# requirement isn't too bad since this makefile is really a GNU makefile, |
| 818 |
# but apparently GNU sed is much less common than GNU make in general, so |
| 819 |
# I'm supporting it here. |
| 820 |
# |
| 821 |
# Sad experience has taught me the following about BSD sed: |
| 822 |
# |
| 823 |
# * \+ is not understood to mean \{1,\} |
| 824 |
# * \| is meaningless (does not branch) |
| 825 |
# * \n cannot be used as a substitution character |
| 826 |
# * ? does not mean \{0,1\}, but is literal |
| 827 |
# * a\ works, but only reliably for a single line if subsequent lines |
| 828 |
# have forward slashes in them (as is the case in postscript) |
| 829 |
# |
| 830 |
# For more info (on the Mac) you can consult |
| 831 |
# |
| 832 |
# man -M /usr/share/man re_format |
| 833 |
# |
| 834 |
# And look for the word "Obsolete" near the bottom. |
| 835 |
|
| 836 |
# |
| 837 |
# EXTERNAL PROGRAM DOCUMENTATION SCRIPT |
| 838 |
# |
| 839 |
|
| 840 |
# $(call output-all-programs,[<output file>]) |
| 841 |
define output-all-programs |
| 842 |
[ -f '$(this_file)' ] && \ |
| 843 |
$(SED) \ |
| 844 |
-e '/^[[:space:]]*#[[:space:]]*EXTERNAL PROGRAMS:/,/^$$/!d' \ |
| 845 |
-e '/EXTERNAL PROGRAMS/d' \ |
| 846 |
-e '/^$$/d' \ |
| 847 |
-e '/^[[:space:]]*#/i\ '\ |
| 848 |
-e 's/^[[:space:]]*#[[:space:]][^=]*//' \ |
| 849 |
$(this_file) $(if $1,> '$1',) || \ |
| 850 |
$(ECHO) "Cannot determine the name of this makefile." |
| 851 |
endef |
| 852 |
|
| 853 |
# If they misspell gray, it should still work. |
| 854 |
GRAY ?= $(call get-default,$(GREY),) |
| 855 |
|
| 856 |
# |
| 857 |
# Utility Functions and Definitions |
| 858 |
# |
| 859 |
|
| 860 |
# Don't call this directly - it is here to avoid calling wildcard more than |
| 861 |
# once in remove-files. |
| 862 |
remove-files-helper = $(if $1,$(RM) $1,$(sh_true)) |
| 863 |
|
| 864 |
# $(call remove-files,file1 file2) |
| 865 |
remove-files = $(call remove-files-helper,$(wildcard $1)) |
| 866 |
|
| 867 |
# Removes all cleanable files in the given list |
| 868 |
# $(call clean-files,file1 file2 file3 ...) |
| 869 |
# Works exactly like remove-files, but filters out files in $(neverclean) |
| 870 |
clean-files = \ |
| 871 |
$(call remove-files-helper,$(call cleanable-files,$(wildcard $1))) |
| 872 |
|
| 873 |
# Outputs all generated files to STDOUT, along with some others that are |
| 874 |
# created by these (e.g., .idx files end up producing .ilg and .ind files). |
| 875 |
# Discovered by reading *.fls OUTPUT lines and producing corresponding .ind |
| 876 |
# filenames as needed. |
| 877 |
# |
| 878 |
# $(call get-generated-names,<source recorder file (*.fls)>) |
| 879 |
define get-generated-names |
| 880 |
[ -f '$1' ] && \ |
| 881 |
$(SED) \ |
| 882 |
-e '/^OUTPUT /{' \ |
| 883 |
-e ' s///' \ |
| 884 |
-e ' p' \ |
| 885 |
-e ' s/\.idx/\.ind/p' \ |
| 886 |
-e ' s/\.ind/\.ilg/p' \ |
| 887 |
-e '}' \ |
| 888 |
-e 'd' \ |
| 889 |
'$1' \ |
| 890 |
| $(SORT) | $(UNIQ) |
| 891 |
endef |
| 892 |
|
| 893 |
# This removes files without checking whether they are there or not. This |
| 894 |
# sometimes has to be used when the file is created by a series of shell |
| 895 |
# commands, but there ends up being a race condition: make doesn't know about |
| 896 |
# the file generation as quickly as the system does, so $(wildcard ...) doesn't |
| 897 |
# work right. Blech. |
| 898 |
# $(call remove-temporary-files,filenames) |
| 899 |
remove-temporary-files = $(if $(KEEP_TEMP),:,$(if $1,$(RM) $1,:)) |
| 900 |
|
| 901 |
# Create an identifier from a file name |
| 902 |
# $(call cleanse-filename,filename) |
| 903 |
cleanse-filename = $(subst .,_,$(subst /,__,$1)) |
| 904 |
|
| 905 |
# Escape dots |
| 906 |
# $(call escape-fname-regex,str) |
| 907 |
escape-fname-regex = $(subst /,\\/,$(subst .,\\.,$1)) |
| 908 |
|
| 909 |
# Test that a file exists |
| 910 |
# $(call test-exists,file) |
| 911 |
test-exists = [ -e '$1' ] |
| 912 |
|
| 913 |
# $(call move-files,source,destination) |
| 914 |
move-if-exists = $(call test-exists,$1) && $(MV) '$1' '$2' |
| 915 |
|
| 916 |
# Copy file1 to file2 only if file2 doesn't exist or they are different |
| 917 |
# $(call copy-if-different,sfile,dfile) |
| 918 |
copy-if-different = $(call test-different,$1,$2) && $(CP) '$1' '$2' |
| 919 |
copy-if-exists = $(call test-exists,$1) && $(CP) '$1' '$2' |
| 920 |
move-if-different = $(call test-different,$1,$2) && $(MV) '$1' '$2' |
| 921 |
replace-if-different-and-remove = \ |
| 922 |
$(call test-different,$1,$2) \ |
| 923 |
&& $(MV) '$1' '$2' \ |
| 924 |
|| $(call remove-files,'$1') |
| 925 |
|
| 926 |
# Note that $(DIFF) returns success when the files are the SAME.... |
| 927 |
# $(call test-different,sfile,dfile) |
| 928 |
test-different = ! $(DIFF) -q '$1' '$2' >/dev/null 2>&1 |
| 929 |
test-exists-and-different = \ |
| 930 |
$(call test-exists,$2) && $(call test-different,$1,$2) |
| 931 |
|
| 932 |
# Return value 1, or value 2 if value 1 is empty |
| 933 |
# $(call get-default,<possibly empty arg>,<default value if empty>) |
| 934 |
get-default = $(if $1,$1,$2) |
| 935 |
|
| 936 |
# Copy a file and log what's going on |
| 937 |
# $(call copy-with-logging,<source>,<target>) |
| 938 |
define copy-with-logging |
| 939 |
if [ -d '$2/' ]; then \ |
| 940 |
if $(CP) '$1' '$2/'; then \ |
| 941 |
$(ECHO) "$(C_INFO)Copied '$1' to '$2/'$(C_RESET)"; \ |
| 942 |
else \ |
| 943 |
$(ECHO) "$(C_ERROR)Failed to copy '$1' to '$2/'$(C_RESET)"; \ |
| 944 |
fi; \ |
| 945 |
fi |
| 946 |
endef |
| 947 |
|
| 948 |
# Gives a reassuring message about the failure to find include files |
| 949 |
# $(call include-message,<list of include files>) |
| 950 |
define include-message |
| 951 |
$(strip \ |
| 952 |
$(if $(filter-out $(wildcard $1),$1),\ |
| 953 |
$(shell $(ECHO) \ |
| 954 |
"$(C_INFO)NOTE: You may ignore warnings about the"\ |
| 955 |
"following files:" >&2;\ |
| 956 |
$(ECHO) >&2; \ |
| 957 |
$(foreach s,$(filter-out $(wildcard $1),$1),$(ECHO) ' $s' >&2;)\ |
| 958 |
$(ECHO) "$(C_RESET)" >&2) |
| 959 |
)) |
| 960 |
endef |
| 961 |
# Characters that are hard to specify in certain places |
| 962 |
space := $(empty) $(empty) |
| 963 |
colon := \: |
| 964 |
comma := , |
| 965 |
|
| 966 |
# Useful shell definitions |
| 967 |
sh_true := : |
| 968 |
sh_false := ! : |
| 969 |
|
| 970 |
# Clear out the standard interfering make suffixes |
| 971 |
.SUFFIXES: |
| 972 |
|
| 973 |
# Turn off forceful rm (RM is usually mapped to rm -f) |
| 974 |
ifdef SAFE_RM |
| 975 |
RM := rm |
| 976 |
endif |
| 977 |
|
| 978 |
# Turn command echoing back on with VERBOSE=1 |
| 979 |
ifndef VERBOSE |
| 980 |
QUIET := @ |
| 981 |
endif |
| 982 |
|
| 983 |
# Turn on shell debugging with SHELL_DEBUG=1 |
| 984 |
# (EVERYTHING is echoed, even $(shell ...) invocations) |
| 985 |
ifdef SHELL_DEBUG |
| 986 |
SHELL += -x |
| 987 |
endif |
| 988 |
|
| 989 |
# Get the name of this makefile (always right in 3.80, often right in 3.79) |
| 990 |
# This is only really used for documentation, so it isn't too serious. |
| 991 |
ifdef MAKEFILE_LIST |
| 992 |
this_file := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) |
| 993 |
else |
| 994 |
this_file := $(wildcard GNUmakefile makefile Makefile) |
| 995 |
endif |
| 996 |
|
| 997 |
# Terminal color definitions |
| 998 |
|
| 999 |
REAL_TPUT := $(if $(NO_COLOR),,$(shell $(WHICH) $(TPUT))) |
| 1000 |
|
| 1001 |
# $(call get-term-code,codeinfo) |
| 1002 |
# e.g., |
| 1003 |
# $(call get-term-code,setaf 0) |
| 1004 |
get-term-code = $(if $(REAL_TPUT),$(shell $(REAL_TPUT) $1),) |
| 1005 |
|
| 1006 |
black := $(call get-term-code,setaf 0) |
| 1007 |
red := $(call get-term-code,setaf 1) |
| 1008 |
green := $(call get-term-code,setaf 2) |
| 1009 |
yellow := $(call get-term-code,setaf 3) |
| 1010 |
blue := $(call get-term-code,setaf 4) |
| 1011 |
magenta := $(call get-term-code,setaf 5) |
| 1012 |
cyan := $(call get-term-code,setaf 6) |
| 1013 |
white := $(call get-term-code,setaf 7) |
| 1014 |
bold := $(call get-term-code,bold) |
| 1015 |
uline := $(call get-term-code,smul) |
| 1016 |
reset := $(call get-term-code,sgr0) |
| 1017 |
|
| 1018 |
# |
| 1019 |
# User-settable definitions |
| 1020 |
# |
| 1021 |
LATEX_COLOR_WARNING ?= magenta |
| 1022 |
LATEX_COLOR_ERROR ?= red |
| 1023 |
LATEX_COLOR_INFO ?= green |
| 1024 |
LATEX_COLOR_UNDERFULL ?= magenta |
| 1025 |
LATEX_COLOR_OVERFULL ?= red bold |
| 1026 |
LATEX_COLOR_PAGES ?= bold |
| 1027 |
LATEX_COLOR_BUILD ?= cyan |
| 1028 |
LATEX_COLOR_GRAPHIC ?= yellow |
| 1029 |
LATEX_COLOR_DEP ?= green |
| 1030 |
LATEX_COLOR_SUCCESS ?= green bold |
| 1031 |
LATEX_COLOR_FAILURE ?= red bold |
| 1032 |
|
| 1033 |
# Gets the real color from a simple textual definition like those above |
| 1034 |
# $(call get-color,ALL_CAPS_COLOR_NAME) |
| 1035 |
# e.g., $(call get-color,WARNING) |
| 1036 |
get-color = $(subst $(space),,$(foreach c,$(LATEX_COLOR_$1),$($c))) |
| 1037 |
|
| 1038 |
# |
| 1039 |
# STANDARD COLORS |
| 1040 |
# |
| 1041 |
C_WARNING := $(call get-color,WARNING) |
| 1042 |
C_ERROR := $(call get-color,ERROR) |
| 1043 |
C_INFO := $(call get-color,INFO) |
| 1044 |
C_UNDERFULL := $(call get-color,UNDERFULL) |
| 1045 |
C_OVERFULL := $(call get-color,OVERFULL) |
| 1046 |
C_PAGES := $(call get-color,PAGES) |
| 1047 |
C_BUILD := $(call get-color,BUILD) |
| 1048 |
C_GRAPHIC := $(call get-color,GRAPHIC) |
| 1049 |
C_DEP := $(call get-color,DEP) |
| 1050 |
C_SUCCESS := $(call get-color,SUCCESS) |
| 1051 |
C_FAILURE := $(call get-color,FAILURE) |
| 1052 |
C_RESET := $(reset) |
| 1053 |
|
| 1054 |
# |
| 1055 |
# PRE-BUILD TESTS |
| 1056 |
# |
| 1057 |
|
| 1058 |
# Check that clean targets are not combined with other targets (weird things |
| 1059 |
# happen, and it's not easy to fix them) |
| 1060 |
hascleangoals := $(if $(sort $(filter clean clean-%,$(MAKECMDGOALS))),1) |
| 1061 |
hasbuildgoals := $(if $(sort $(filter-out clean clean-%,$(MAKECMDGOALS))),1) |
| 1062 |
ifneq "$(hasbuildgoals)" "" |
| 1063 |
ifneq "$(hascleangoals)" "" |
| 1064 |
$(error $(C_ERROR)Clean and build targets specified together$(C_RESET))) |
| 1065 |
endif |
| 1066 |
endif |
| 1067 |
|
| 1068 |
# |
| 1069 |
# VARIABLE DECLARATIONS |
| 1070 |
# |
| 1071 |
|
| 1072 |
# Names of sed scripts that morph gnuplot files -- only the first found is used |
| 1073 |
GNUPLOT_SED := global-gpi.sed gnuplot.sed |
| 1074 |
GNUPLOT_GLOBAL := global._include_.gpi gnuplot.global |
| 1075 |
|
| 1076 |
ifeq "$(strip $(BUILD_STRATEGY))" "latex" |
| 1077 |
default_graphic_extension ?= eps |
| 1078 |
latex_build_program ?= $(LATEX) |
| 1079 |
build_target_extension ?= dvi |
| 1080 |
hyperref_driver_pattern ?= hdvips |
| 1081 |
hyperref_driver_error ?= Using dvips: specify ps2pdf in the hyperref options. |
| 1082 |
endif |
| 1083 |
|
| 1084 |
ifeq "$(strip $(BUILD_STRATEGY))" "pdflatex" |
| 1085 |
default_graphic_extension ?= pdf |
| 1086 |
latex_build_program ?= $(PDFLATEX) |
| 1087 |
build_target_extension ?= pdf |
| 1088 |
hyperref_driver_pattern ?= hpdf.* |
| 1089 |
hyperref_driver_error ?= Using pdflatex: specify pdftex in the hyperref options (or leave it blank). |
| 1090 |
endif |
| 1091 |
|
| 1092 |
ifeq "$(strip $(BUILD_STRATEGY))" "xelatex" |
| 1093 |
default_graphic_extension ?= pdf |
| 1094 |
latex_build_program ?= $(XELATEX) |
| 1095 |
build_target_extension ?= pdf |
| 1096 |
hyperref_driver_pattern ?= hdvipdf.* |
| 1097 |
hyperref_driver_error ?= Using pdflatex: specify pdftex in the hyperref options (or leave it blank). |
| 1098 |
endif |
| 1099 |
|
| 1100 |
# Files of interest |
| 1101 |
all_files.tex ?= $(wildcard *.tex) |
| 1102 |
all_files.tex.sh ?= $(wildcard *.tex.sh) |
| 1103 |
all_files.tex.pl ?= $(wildcard *.tex.pl) |
| 1104 |
all_files.tex.py ?= $(wildcard *.tex.py) |
| 1105 |
all_files.rst ?= $(wildcard *.rst) |
| 1106 |
all_files.fig ?= $(wildcard *.fig) |
| 1107 |
all_files.gpi ?= $(wildcard *.gpi) |
| 1108 |
all_files.dot ?= $(wildcard *.dot) |
| 1109 |
all_files.xvg ?= $(wildcard *.xvg) |
| 1110 |
all_files.svg ?= $(wildcard *.svg) |
| 1111 |
all_files.png ?= $(wildcard *.png) |
| 1112 |
all_files.jpg ?= $(wildcard *.jpg) |
| 1113 |
all_files.jpeg ?= $(wildcard *.jpeg) |
| 1114 |
all_files.eps.gz ?= $(wildcard *.eps.gz) |
| 1115 |
all_files.eps ?= $(wildcard *.eps) |
| 1116 |
|
| 1117 |
# Utility function for obtaining all files not specified in $(neverclean) |
| 1118 |
# $(call cleanable-files,file1 file2 file3 ...) |
| 1119 |
# Returns the list of files that is not in $(wildcard $(neverclean)) |
| 1120 |
cleanable-files = $(filter-out $(wildcard $(neverclean)), $1) |
| 1121 |
|
| 1122 |
# Utility function for getting all .$1 files that are to be ignored |
| 1123 |
# * files listed in $(includes.$1) |
| 1124 |
# * files not listed in $(onlysources.$1) if it is defined |
| 1125 |
ignore_files = \ |
| 1126 |
$(includes.$1) \ |
| 1127 |
$(if $(onlysources.$1),$(filter-out $(onlysources.$1), $(all_files.$1))) |
| 1128 |
|
| 1129 |
# Patterns to never be allowed as source targets |
| 1130 |
ignore_patterns := %._include_ |
| 1131 |
|
| 1132 |
# Patterns allowed as source targets but not included in 'all' builds |
| 1133 |
nodefault_patterns := %._nobuild_ $(ignore_patterns) |
| 1134 |
|
| 1135 |
# Utility function for getting targets suitable building |
| 1136 |
# $(call filter-buildable,suffix) |
| 1137 |
filter-buildable = \ |
| 1138 |
$(filter-out $(call ignore_files,$1) \ |
| 1139 |
$(addsuffix .$1,$(ignore_patterns)),$(all_files.$1)) |
| 1140 |
|
| 1141 |
# Utility function for getting targets suitable for 'all' builds |
| 1142 |
# $(call filter-default,suffix) |
| 1143 |
filter-default = \ |
| 1144 |
$(filter-out $(call ignore_files,$1) \ |
| 1145 |
$(addsuffix .$1,$(nodefault_patterns)),$(all_files.$1)) |
| 1146 |
|
| 1147 |
# Top level sources that can be built even when they are not by default |
| 1148 |
files.tex := $(call filter-buildable,tex) |
| 1149 |
files.tex.sh := $(call filter-buildable,tex.sh) |
| 1150 |
files.tex.pl := $(call filter-buildable,tex.pl) |
| 1151 |
files.tex.py := $(call filter-buildable,tex.py) |
| 1152 |
files.rst := $(call filter-buildable,rst) |
| 1153 |
files.gpi := $(call filter-buildable,gpi) |
| 1154 |
files.dot := $(call filter-buildable,dot) |
| 1155 |
files.fig := $(call filter-buildable,fig) |
| 1156 |
files.xvg := $(call filter-buildable,xvg) |
| 1157 |
files.svg := $(call filter-buildable,svg) |
| 1158 |
files.png := $(call filter-buildable,png) |
| 1159 |
files.jpg := $(call filter-buildable,jpg) |
| 1160 |
files.jpeg := $(call filter-buildable,jpeg) |
| 1161 |
files.eps.gz := $(call filter-buildable,eps.gz) |
| 1162 |
files.eps := $(call filter-buildable,eps) |
| 1163 |
|
| 1164 |
# Make all pstex targets secondary. The pstex_t target requires the pstex |
| 1165 |
# target, and nothing else really depends on it, so it often gets deleted. |
| 1166 |
# This avoids that by allowing *all* fig files to be pstex targets, which is |
| 1167 |
# perfectly valid and causes no problems even if they're going to become eps |
| 1168 |
# files in the end. |
| 1169 |
.SECONDARY: $(patsubst %.fig,%.pstex,$(files.fig)) |
| 1170 |
|
| 1171 |
# Top level sources that are built by default targets |
| 1172 |
default_files.tex := $(call filter-default,tex) |
| 1173 |
default_files.tex.sh := $(call filter-default,tex.sh) |
| 1174 |
default_files.tex.pl := $(call filter-default,tex.pl) |
| 1175 |
default_files.tex.py := $(call filter-default,tex.py) |
| 1176 |
default_files.rst := $(call filter-default,rst) |
| 1177 |
default_files.gpi := $(call filter-default,gpi) |
| 1178 |
default_files.dot := $(call filter-default,dot) |
| 1179 |
default_files.fig := $(call filter-default,fig) |
| 1180 |
default_files.xvg := $(call filter-default,xvg) |
| 1181 |
default_files.svg := $(call filter-default,svg) |
| 1182 |
default_files.png := $(call filter-default,png) |
| 1183 |
default_files.jpg := $(call filter-default,jpg) |
| 1184 |
default_files.jpeg := $(call filter-default,jpeg) |
| 1185 |
default_files.eps.gz := $(call filter-default,eps.gz) |
| 1186 |
default_files.eps := $(call filter-default,eps) |
| 1187 |
|
| 1188 |
# Utility function for creating larger lists of files |
| 1189 |
# $(call concat-files,suffixes,[prefix]) |
| 1190 |
concat-files = $(foreach s,$1,$($(if $2,$2_,)files.$s)) |
| 1191 |
|
| 1192 |
# Useful file groupings |
| 1193 |
all_files_source := $(call concat-files,tex,all) |
| 1194 |
all_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,all) |
| 1195 |
|
| 1196 |
.PHONY: $(all_files_scripts) |
| 1197 |
|
| 1198 |
default_files_source := $(call concat-files,tex,default) |
| 1199 |
default_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,default) |
| 1200 |
|
| 1201 |
files_source := $(call concat-files,tex) |
| 1202 |
files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst) |
| 1203 |
|
| 1204 |
# Utility function for obtaining stems |
| 1205 |
# $(call get-stems,suffix,[prefix]) |
| 1206 |
get-stems = $(sort $($(if $2,$2_,)files.$1:%.$1=%)) |
| 1207 |
|
| 1208 |
# List of all stems (including ._include_ and ._nobuild_ file stems) |
| 1209 |
all_stems.tex := $(call get-stems,tex,all) |
| 1210 |
all_stems.tex.sh := $(call get-stems,tex.sh,all) |
| 1211 |
all_stems.tex.pl := $(call get-stems,tex.pl,all) |
| 1212 |
all_stems.tex.py := $(call get-stems,tex.py,all) |
| 1213 |
all_stems.rst := $(call get-stems,rst,all) |
| 1214 |
all_stems.fig := $(call get-stems,fig,all) |
| 1215 |
all_stems.gpi := $(call get-stems,gpi,all) |
| 1216 |
all_stems.dot := $(call get-stems,dot,all) |
| 1217 |
all_stems.xvg := $(call get-stems,xvg,all) |
| 1218 |
all_stems.svg := $(call get-stems,svg,all) |
| 1219 |
all_stems.png := $(call get-stems,png,all) |
| 1220 |
all_stems.jpg := $(call get-stems,jpg,all) |
| 1221 |
all_stems.jpeg := $(call get-stems,jpeg,all) |
| 1222 |
all_stems.eps.gz := $(call get-stems,eps.gz,all) |
| 1223 |
all_stems.eps := $(call get-stems,eps,all) |
| 1224 |
|
| 1225 |
# List of all default stems (all default PDF targets): |
| 1226 |
default_stems.tex := $(call get-stems,tex,default) |
| 1227 |
default_stems.tex.sh := $(call get-stems,tex.sh,default) |
| 1228 |
default_stems.tex.pl := $(call get-stems,tex.pl,default) |
| 1229 |
default_stems.tex.py := $(call get-stems,tex.py,default) |
| 1230 |
default_stems.rst := $(call get-stems,rst,default) |
| 1231 |
default_stems.fig := $(call get-stems,fig,default) |
| 1232 |
default_stems.gpi := $(call get-stems,gpi,default) |
| 1233 |
default_stems.dot := $(call get-stems,dot,default) |
| 1234 |
default_stems.xvg := $(call get-stems,xvg,default) |
| 1235 |
default_stems.svg := $(call get-stems,svg,default) |
| 1236 |
default_stems.png := $(call get-stems,png,default) |
| 1237 |
default_stems.jpg := $(call get-stems,jpg,default) |
| 1238 |
default_stems.jpeg := $(call get-stems,jpeg,default) |
| 1239 |
default_stems.eps.gz := $(call get-stems,eps.gz,default) |
| 1240 |
default_stems.eps := $(call get-stems,eps,default) |
| 1241 |
|
| 1242 |
# List of all stems (all possible bare PDF targets created here): |
| 1243 |
stems.tex := $(call get-stems,tex) |
| 1244 |
stems.tex.sh := $(call get-stems,tex.sh) |
| 1245 |
stems.tex.pl := $(call get-stems,tex.pl) |
| 1246 |
stems.tex.py := $(call get-stems,tex.py) |
| 1247 |
stems.rst := $(call get-stems,rst) |
| 1248 |
stems.fig := $(call get-stems,fig) |
| 1249 |
stems.gpi := $(call get-stems,gpi) |
| 1250 |
stems.dot := $(call get-stems,dot) |
| 1251 |
stems.xvg := $(call get-stems,xvg) |
| 1252 |
stems.svg := $(call get-stems,svg) |
| 1253 |
stems.png := $(call get-stems,png) |
| 1254 |
stems.jpg := $(call get-stems,jpg) |
| 1255 |
stems.jpeg := $(call get-stems,jpeg) |
| 1256 |
stems.eps.gz := $(call get-stems,eps.gz) |
| 1257 |
stems.eps := $(call get-stems,eps) |
| 1258 |
|
| 1259 |
# Utility function for creating larger lists of stems |
| 1260 |
# $(call concat-stems,suffixes,[prefix]) |
| 1261 |
concat-stems = $(sort $(foreach s,$1,$($(if $2,$2_,)stems.$s))) |
| 1262 |
|
| 1263 |
# The most likely to be source but not finished product go first |
| 1264 |
graphic_source_extensions := fig \ |
| 1265 |
gpi \ |
| 1266 |
xvg \ |
| 1267 |
svg \ |
| 1268 |
dot \ |
| 1269 |
eps.gz |
| 1270 |
|
| 1271 |
ifeq "$(strip $(BUILD_STRATEGY))" "latex" |
| 1272 |
graphic_source_extensions += png jpg jpeg |
| 1273 |
graphic_target_extensions := eps ps |
| 1274 |
endif |
| 1275 |
|
| 1276 |
ifeq "$(strip $(BUILD_STRATEGY))" "pdflatex" |
| 1277 |
graphic_source_extensions += eps |
| 1278 |
graphic_target_extensions := pdf png jpg jpeg mps tif |
| 1279 |
endif |
| 1280 |
|
| 1281 |
ifeq "$(strip $(BUILD_STRATEGY))" "xelatex" |
| 1282 |
graphic_source_extensions += eps |
| 1283 |
graphic_target_extensions := pdf png jpg jpeg mps tif |
| 1284 |
endif |
| 1285 |
|
| 1286 |
all_stems_source := $(call concat-stems,tex,all) |
| 1287 |
all_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,all) |
| 1288 |
all_stems_graphic := $(call concat-stems,$(graphic_source_extensions),all) |
| 1289 |
all_stems_ss := $(sort $(all_stems_source) $(all_stems_script)) |
| 1290 |
all_stems_sg := $(sort $(all_stems_script)) |
| 1291 |
all_stems_ssg := $(sort $(all_stems_ss)) |
| 1292 |
|
| 1293 |
default_stems_source := $(call concat-stems,tex,default) |
| 1294 |
default_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,default) |
| 1295 |
default_stems_ss := $(sort $(default_stems_source) $(default_stems_script)) |
| 1296 |
default_stems_sg := $(sort $(default_stems_script)) |
| 1297 |
default_stems_ssg := $(sort $(default_stems_ss)) |
| 1298 |
|
| 1299 |
stems_source := $(call concat-stems,tex) |
| 1300 |
stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst) |
| 1301 |
stems_graphic := $(call concat-stems,$(graphic_source_extensions)) |
| 1302 |
stems_gg := $(sort $(stems_graphic)) |
| 1303 |
stems_ss := $(sort $(stems_source) $(stems_script)) |
| 1304 |
stems_sg := $(sort $(stems_script)) |
| 1305 |
stems_ssg := $(sort $(stems_ss)) |
| 1306 |
|
| 1307 |
# Calculate names that can generate the need for an include file. We can't |
| 1308 |
# really do this with patterns because it's too easy to screw up, so we create |
| 1309 |
# an exhaustive list. |
| 1310 |
allowed_source_suffixes := \ |
| 1311 |
pdf \ |
| 1312 |
ps \ |
| 1313 |
dvi \ |
| 1314 |
ind \ |
| 1315 |
nls \ |
| 1316 |
bbl \ |
| 1317 |
aux \ |
| 1318 |
aux.make \ |
| 1319 |
d \ |
| 1320 |
auxbbl.make \ |
| 1321 |
_graphics \ |
| 1322 |
_show |
| 1323 |
allowed_source_patterns := $(addprefix %.,$(allowed_source_suffixes)) |
| 1324 |
|
| 1325 |
allowed_graphic_suffixes := \ |
| 1326 |
pdf \ |
| 1327 |
eps \ |
| 1328 |
gpihead.make \ |
| 1329 |
gpi.d |
| 1330 |
allowed_graphic_patterns := $(addprefix %.,$(allowed_graphic_suffixes)) |
| 1331 |
|
| 1332 |
# All targets allowed to build documents |
| 1333 |
allowed_source_targets := \ |
| 1334 |
$(foreach suff,$(allowed_source_suffixes),\ |
| 1335 |
$(addsuffix .$(suff),$(stems_ssg))) |
| 1336 |
|
| 1337 |
# All targets allowed to build graphics |
| 1338 |
allowed_graphic_targets := \ |
| 1339 |
$(foreach suff,$(allowed_graphic_suffixes),\ |
| 1340 |
$(addsuffix .$(suff),$(stems_gg))) |
| 1341 |
|
| 1342 |
# All targets that build multiple documents (like 'all') |
| 1343 |
allowed_batch_source_targets := \ |
| 1344 |
all \ |
| 1345 |
all-pdf \ |
| 1346 |
all-ps \ |
| 1347 |
all-dvi \ |
| 1348 |
all-bbl \ |
| 1349 |
all-ind \ |
| 1350 |
all-gls \ |
| 1351 |
all-nls \ |
| 1352 |
show |
| 1353 |
|
| 1354 |
# All targets that build multiple graphics (independent of document) |
| 1355 |
allowed_batch_graphic_targets := \ |
| 1356 |
all-graphics \ |
| 1357 |
all-pstex \ |
| 1358 |
all-dot2tex \ |
| 1359 |
show-graphics |
| 1360 |
|
| 1361 |
# Now we figure out which stuff is available as a make target for THIS RUN. |
| 1362 |
real_goals := $(call get-default,$(filter-out _includes,$(MAKECMDGOALS)),\ |
| 1363 |
all) |
| 1364 |
|
| 1365 |
specified_source_targets := $(strip \ |
| 1366 |
$(filter $(allowed_source_targets) $(stems_ssg),$(real_goals)) \ |
| 1367 |
) |
| 1368 |
|
| 1369 |
specified_batch_source_targets := $(strip \ |
| 1370 |
$(filter $(allowed_batch_source_targets),$(real_goals)) \ |
| 1371 |
) |
| 1372 |
|
| 1373 |
specified_graphic_targets := $(strip \ |
| 1374 |
$(filter $(allowed_graphic_targets),$(real_goals)) \ |
| 1375 |
) |
| 1376 |
|
| 1377 |
specified_batch_graphic_targets := $(strip \ |
| 1378 |
$(filter $(allowed_batch_graphic_targets),$(real_goals)) \ |
| 1379 |
) |
| 1380 |
|
| 1381 |
specified_gpi_targets := $(patsubst %.gpi,%.$(default_graphic_extension),\ |
| 1382 |
$(filter $(patsubst %.$(default_graphic_extension),%.gpi,$(specified_graphic_targets)),\ |
| 1383 |
$(all_files.gpi)) \ |
| 1384 |
) |
| 1385 |
|
| 1386 |
# Determine which .d files need including from the information gained above. |
| 1387 |
# This is done by first checking whether a batch target exists. If it does, |
| 1388 |
# then all *default* stems are used to create possible includes (nobuild need |
| 1389 |
# not apply for batch status). If no batch targets exist, then the individual |
| 1390 |
# targets are considered and appropriate includes are taken from them. |
| 1391 |
source_stems_to_include := \ |
| 1392 |
$(sort\ |
| 1393 |
$(if $(specified_batch_source_targets),\ |
| 1394 |
$(default_stems_ss),\ |
| 1395 |
$(foreach t,$(specified_source_targets),\ |
| 1396 |
$(foreach p,$(allowed_source_patterns),\ |
| 1397 |
$(patsubst $p,%,$(filter $p $(stems_ssg),$t)) \ |
| 1398 |
)) \ |
| 1399 |
)) |
| 1400 |
|
| 1401 |
# Determine which .gpi.d files are needed using the above information. We |
| 1402 |
# first check whether a batch target is specified, then check individual |
| 1403 |
# graphics that may have been specified. |
| 1404 |
graphic_stems_to_include := \ |
| 1405 |
$(sort\ |
| 1406 |
$(if $(specified_batch_graphic_targets),\ |
| 1407 |
$(default_stems.gpi),\ |
| 1408 |
$(foreach t,$(specified_gpi_targets),\ |
| 1409 |
$(foreach p,$(allowed_graphic_patterns),\ |
| 1410 |
$(patsubst $p,%,$(filter $p,$t)) \ |
| 1411 |
)) \ |
| 1412 |
)) |
| 1413 |
|
| 1414 |
# All dependencies for the 'all' targets |
| 1415 |
all_pdf_targets := $(addsuffix .pdf,$(stems_ssg)) |
| 1416 |
all_ps_targets := $(addsuffix .ps,$(stems_ssg)) |
| 1417 |
all_dvi_targets := $(addsuffix .dvi,$(stems_ssg)) |
| 1418 |
all_tex_targets := $(addsuffix .tex,$(stems_sg)) |
| 1419 |
all_d_targets := $(addsuffix .d,$(stems_ssg)) |
| 1420 |
all_graphics_targets := $(addsuffix .$(default_graphic_extension),$(stems_gg)) |
| 1421 |
all_pstex_targets := $(addsuffix .pstex_t,$(stems.fig)) |
| 1422 |
all_dot2tex_targets := $(addsuffix .dot_t,$(stems.dot)) |
| 1423 |
|
| 1424 |
all_known_graphics := $(sort $(all_graphics_targets) $(wildcard *.$(default_graphic_extension))) |
| 1425 |
|
| 1426 |
default_pdf_targets := $(addsuffix .pdf,$(default_stems_ss)) |
| 1427 |
|
| 1428 |
ifeq "$(strip $(BUILD_STRATEGY))" "latex" |
| 1429 |
default_ps_targets := $(addsuffix .ps,$(default_stems_ss)) |
| 1430 |
default_dvi_targets := $(addsuffix .dvi,$(default_stems_ss)) |
| 1431 |
pre_pdf_extensions := dvi ps |
| 1432 |
endif |
| 1433 |
|
| 1434 |
# Extensions generated by LaTeX invocation that can be removed when complete |
| 1435 |
rm_ext := \ |
| 1436 |
log *.log aux $(pre_pdf_extensions) pdf blg bbl out nav snm toc lof lot lol pfg \ |
| 1437 |
fls vrb idx ind ilg glg glo gls lox nls nlo nlg brf mtc maf brf ist |
| 1438 |
backup_patterns := *~ *.bak *.backup body.tmp head.tmp |
| 1439 |
|
| 1440 |
graph_stem := _graph |
| 1441 |
|
| 1442 |
# All LaTeX-generated files that can be safely removed |
| 1443 |
|
| 1444 |
rm_tex := \ |
| 1445 |
$(foreach e,$(rm_ext),$(addsuffix .$e,$(all_stems_source))) \ |
| 1446 |
$(foreach e,$(rm_ext) tex,$(addsuffix .$e,$(all_stems_sg))) \ |
| 1447 |
$(addsuffix .log,$(all_ps_targets) $(all_pdf_targets)) \ |
| 1448 |
$(addsuffix .*.log,$(stems_graphic)) |
| 1449 |
|
| 1450 |
# These are the files that will affect .gpi transformation for all .gpi files. |
| 1451 |
# |
| 1452 |
# Use only the first one found. Backward compatible values are at the end. |
| 1453 |
# Note that we use foreach, even though wildcard also returns a list, to ensure |
| 1454 |
# that the order in the uppercase variables is preserved. Directory listings |
| 1455 |
# provide no such guarantee, so we avoid relying on them. |
| 1456 |
gpi_sed := $(strip \ |
| 1457 |
$(firstword $(foreach f,$(GNUPLOT_SED),$(wildcard $f)))) |
| 1458 |
gpi_global := $(strip \ |
| 1459 |
$(firstword $(foreach f,$(GNUPLOT_GLOBAL),$(wildcard $f)))) |
| 1460 |
|
| 1461 |
# |
| 1462 |
# Functions used in generating output |
| 1463 |
# |
| 1464 |
|
| 1465 |
# Outputs all source dependencies to stdout. The first argument is the file to |
| 1466 |
# be parsed, the second is a list of files that will show up as dependencies in |
| 1467 |
# the new .d file created here. |
| 1468 |
# |
| 1469 |
# $(call get-inputs,<parsed file>,<target files>) |
| 1470 |
define get-inputs |
| 1471 |
$(SED) \ |
| 1472 |
-e '/^INPUT/!d' \ |
| 1473 |
-e 's!^INPUT \(\./\)\{0,1\}!!' \ |
| 1474 |
-e 's/[[:space:]]/\\ /g' \ |
| 1475 |
-e 's/\(.*\)\.aux$$/\1.tex/' \ |
| 1476 |
-e '/\.tex$$/b addtargets' \ |
| 1477 |
-e '/\.cls$$/b addtargets' \ |
| 1478 |
-e '/\.sty$$/b addtargets' \ |
| 1479 |
-e '/\.pstex_t$$/b addtargets' \ |
| 1480 |
-e '/\.dot_t$$/b addtargets' \ |
| 1481 |
-e 'd' \ |
| 1482 |
-e ':addtargets' \ |
| 1483 |
-e 's!.*!$2: $$(call path-norm,&)!' \ |
| 1484 |
'$1' | $(SORT) | $(UNIQ) |
| 1485 |
endef |
| 1486 |
|
| 1487 |
# $(call get-missing-inputs,<log file>,<target files>) |
| 1488 |
define get-missing-inputs |
| 1489 |
$(SED) \ |
| 1490 |
-e '$${' \ |
| 1491 |
-e ' /^$$/!{' \ |
| 1492 |
-e ' H' \ |
| 1493 |
-e ' s/.*//' \ |
| 1494 |
-e ' }' \ |
| 1495 |
-e '}' \ |
| 1496 |
-e '/^$$/!{' \ |
| 1497 |
-e ' H' \ |
| 1498 |
-e ' d' \ |
| 1499 |
-e '}' \ |
| 1500 |
-e '/^$$/{' \ |
| 1501 |
-e ' x' \ |
| 1502 |
-e ' s/^\(\n\)\(.*\)/\2\1/' \ |
| 1503 |
-e '}' \ |
| 1504 |
-e '/^::P\(P\{1,\}\)::/{' \ |
| 1505 |
-e ' s//::\1::/' \ |
| 1506 |
-e ' G' \ |
| 1507 |
-e ' h' \ |
| 1508 |
-e ' d' \ |
| 1509 |
-e '}' \ |
| 1510 |
-e '/^::P::/{' \ |
| 1511 |
-e ' s//::0::/' \ |
| 1512 |
-e ' G' \ |
| 1513 |
-e '}' \ |
| 1514 |
-e 'b start' \ |
| 1515 |
-e ':needonemore' \ |
| 1516 |
-e 's/^/::P::/' \ |
| 1517 |
-e 'G' \ |
| 1518 |
-e 'h' \ |
| 1519 |
-e 'd' \ |
| 1520 |
-e ':needtwomore' \ |
| 1521 |
-e 's/^/::PP::/' \ |
| 1522 |
-e 'G' \ |
| 1523 |
-e 'h' \ |
| 1524 |
-e 'd' \ |
| 1525 |
-e ':needthreemore' \ |
| 1526 |
-e 's/^/::PPP::/' \ |
| 1527 |
-e 'G' \ |
| 1528 |
-e 'h' \ |
| 1529 |
-e 'd' \ |
| 1530 |
-e ':start' \ |
| 1531 |
-e '/^! LaTeX Error: File `/{' \ |
| 1532 |
-e ' b needtwomore' \ |
| 1533 |
-e '}' \ |
| 1534 |
-e '/^::0::\(.*\)/{' \ |
| 1535 |
-e ' s//\1/' \ |
| 1536 |
-e ' /Default extension: /!d' \ |
| 1537 |
-e ' s/.*File `\([^'"'"']*\)'"'"' not found.*/\1/' \ |
| 1538 |
-e ' s/[[:cntrl:]]//' \ |
| 1539 |
-e ' /\.tex/!s/$$/.tex/' \ |
| 1540 |
-e ' s/[[:space:]]/\\ /g' \ |
| 1541 |
-e ' h' \ |
| 1542 |
-e ' s/.*/# MISSING input "&" - (presence of comment affects build)/' \ |
| 1543 |
-e ' p' \ |
| 1544 |
-e ' s/.*//' \ |
| 1545 |
-e ' x' \ |
| 1546 |
-e ' s!^.*!$2: $$(call path-norm,&)!' \ |
| 1547 |
-e ' p' \ |
| 1548 |
-e '}' \ |
| 1549 |
-e 'd' \ |
| 1550 |
'$1' | $(SORT) | $(UNIQ) |
| 1551 |
endef |
| 1552 |
|
| 1553 |
# Get source file for specified graphics stem. |
| 1554 |
# |
| 1555 |
# $(call graphics-source,<stem>) |
| 1556 |
define graphics-source |
| 1557 |
$(strip $(firstword \ |
| 1558 |
$(wildcard \ |
| 1559 |
$(addprefix $1.,\ |
| 1560 |
$(graphic_source_extensions))) \ |
| 1561 |
$1 \ |
| 1562 |
)) |
| 1563 |
endef |
| 1564 |
|
| 1565 |
# Get the target file for the specified graphics file/stem |
| 1566 |
# |
| 1567 |
# $(call graphics-target,<stem>) |
| 1568 |
define graphics-target |
| 1569 |
$(strip $(if $(filter $(addprefix %.,$(graphic_target_extensions)),$1), $1, |
| 1570 |
$(firstword $(patsubst $(addprefix %.,$(graphic_source_extensions) $(graphic_target_extensions)), %, $1).$(default_graphic_extension) $1.$(default_graphic_extension)))) |
| 1571 |
endef |
| 1572 |
|
| 1573 |
# Outputs all of the graphical dependencies to stdout. The first argument is |
| 1574 |
# the stem of the source file being built, the second is a list of suffixes |
| 1575 |
# that will show up as dependencies in the generated .d file. |
| 1576 |
# |
| 1577 |
# Note that we try to escape spaces in filenames where possible. We have to do |
| 1578 |
# it with three backslashes so that as the name percolates through the makefile |
| 1579 |
# it eventually ends up with the proper escaping when the build rule is found. |
| 1580 |
# Ugly, but it appears to work. Note that graphicx doesn't allow filenames |
| 1581 |
# with spaces, so this could in many ways be moot unless you're using something |
| 1582 |
# like grffile. |
| 1583 |
# |
| 1584 |
# For pdflatex, we really need the missing file to be specified without an |
| 1585 |
# extension, otherwise compilation barfs on the first missing file. Truly |
| 1586 |
# annoying, but there you have it. |
| 1587 |
# |
| 1588 |
# It turns out that the graphics errors, although they have lines with empty |
| 1589 |
# space, are only made of two paragraphs. So, we just use some sed magic to |
| 1590 |
# get everything into paragraphs, detect when it's a paragraph that interests |
| 1591 |
# us, and double it up. Then we get the filename only if we're missing |
| 1592 |
# extensions (a sign that it's graphicx complaining). |
| 1593 |
# |
| 1594 |
# $(call get-graphics,<target file stem>) |
| 1595 |
#.log,$(addprefix $*.,d $(build_target_extension) _graphics) |
| 1596 |
define get-graphics |
| 1597 |
$(SED) \ |
| 1598 |
-e '/^File: \(.*\) Graphic file (type [^)]*)/{' \ |
| 1599 |
-e ' s//\1/' \ |
| 1600 |
-e ' b addtargets' \ |
| 1601 |
-e '}' \ |
| 1602 |
-e '$${' \ |
| 1603 |
-e ' /^$$/!{' \ |
| 1604 |
-e ' H' \ |
| 1605 |
-e ' s/.*//' \ |
| 1606 |
-e ' }' \ |
| 1607 |
-e '}' \ |
| 1608 |
-e '/^$$/!{' \ |
| 1609 |
-e ' H' \ |
| 1610 |
-e ' d' \ |
| 1611 |
-e '}' \ |
| 1612 |
-e '/^$$/{' \ |
| 1613 |
-e ' x' \ |
| 1614 |
-e ' s/^\(\n\)\(.*\)/\2\1/' \ |
| 1615 |
-e '}' \ |
| 1616 |
-e '/^::P\(P\{1,\}\)::/{' \ |
| 1617 |
-e ' s//::\1::/' \ |
| 1618 |
-e ' G' \ |
| 1619 |
-e ' h' \ |
| 1620 |
-e ' d' \ |
| 1621 |
-e '}' \ |
| 1622 |
-e '/^::P::/{' \ |
| 1623 |
-e ' s//::0::/' \ |
| 1624 |
-e ' G' \ |
| 1625 |
-e '}' \ |
| 1626 |
-e 'b start' \ |
| 1627 |
-e ':needonemore' \ |
| 1628 |
-e 's/^/::P::/' \ |
| 1629 |
-e 'G' \ |
| 1630 |
-e 'h' \ |
| 1631 |
-e 'd' \ |
| 1632 |
-e ':needtwomore' \ |
| 1633 |
-e 's/^/::PP::/' \ |
| 1634 |
-e 'G' \ |
| 1635 |
-e 'h' \ |
| 1636 |
-e 'd' \ |
| 1637 |
-e ':needthreemore' \ |
| 1638 |
-e 's/^/::PPP::/' \ |
| 1639 |
-e 'G' \ |
| 1640 |
-e 'h' \ |
| 1641 |
-e 'd' \ |
| 1642 |
-e ':start' \ |
| 1643 |
-e '/^[^[:cntrl:]:]*:[[:digit:]]\{1,\}: LaTeX Error: File `/{' \ |
| 1644 |
-e ' s/\n//g' \ |
| 1645 |
-e ' b needonemore' \ |
| 1646 |
-e '}' \ |
| 1647 |
-e '/^::0::.*: LaTeX Error: File `/{' \ |
| 1648 |
-e ' /\n\n$$/{' \ |
| 1649 |
-e ' s/^::0:://' \ |
| 1650 |
-e ' b needonemore' \ |
| 1651 |
-e ' }' \ |
| 1652 |
-e ' s/\n\{1,\}/ /g' \ |
| 1653 |
-e ' s/[[:space:]]\{1,\}/ /g' \ |
| 1654 |
-e ' s/^.*File `//' \ |
| 1655 |
-e ' s/'"'"' not found\..*extensions: \([^[:space:]]*\).*/::::\1/' \ |
| 1656 |
-e ' h' \ |
| 1657 |
-e ' s/\(.*\)::::\(.*\)/# MISSING stem "\1" - allowed extensions are "\2" - leave comment here - it affects the build/' \ |
| 1658 |
-e ' p' \ |
| 1659 |
-e ' g' \ |
| 1660 |
-e ' s/::::.*//' \ |
| 1661 |
-e ' b addtargets' \ |
| 1662 |
-e '}' \ |
| 1663 |
-e 'd' \ |
| 1664 |
-e ':addtargets' \ |
| 1665 |
-e 's/[[:space:]]/\\\\\\&/g' \ |
| 1666 |
-e 'h' \ |
| 1667 |
-e 's/.*/-include &.gpi.d/' \ |
| 1668 |
-e 'p' \ |
| 1669 |
-e 'g' \ |
| 1670 |
-e 's!.*!$1.d: $$$$(call graphics-source,&)!' \ |
| 1671 |
-e 'p' \ |
| 1672 |
-e 's/.*//' \ |
| 1673 |
-e 'x' \ |
| 1674 |
-e 's!.*!$1.$(build_target_extension) $1._graphics: $$$$(call graphics-target,&)!' \ |
| 1675 |
-e 'p' \ |
| 1676 |
-e 'd' \ |
| 1677 |
$1.log |
| 1678 |
endef |
| 1679 |
|
| 1680 |
# Checks for build failure due to pstex inclusion, and gives instructions. |
| 1681 |
# |
| 1682 |
# $(call die-on-pstexs,<parsed file>) |
| 1683 |
define die-on-pstexs |
| 1684 |
if $(EGREP) -q '^! LaTeX Error: File .*\.pstex.* not found' $1; then \ |
| 1685 |
$(ECHO) "$(C_ERROR)Missing pstex_t file(s)$(C_RESET)"; \ |
| 1686 |
$(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \ |
| 1687 |
$(ECHO) "$(C_ERROR) make all-pstex$(C_RESET)"; \ |
| 1688 |
$(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \ |
| 1689 |
exit 1; \ |
| 1690 |
fi |
| 1691 |
endef |
| 1692 |
|
| 1693 |
# Checks for the use of import.sty and bails - we don't support subdirectories |
| 1694 |
# |
| 1695 |
# $(call die-on-import-sty,<log file>) |
| 1696 |
define die-on-import-sty |
| 1697 |
if $(EGREP) -s '/import.sty\)' '$1'; then \ |
| 1698 |
$(ECHO) "$(C_ERROR)import.sty is not supported - included files must"; \ |
| 1699 |
$(ECHO) "$(C_ERROR)be in the same directory as the primary document$(C_RESET)"; \ |
| 1700 |
exit 1; \ |
| 1701 |
fi |
| 1702 |
endef |
| 1703 |
|
| 1704 |
# Checks for build failure due to dot2tex, and gives instructions. |
| 1705 |
# |
| 1706 |
# $(call die-on-dot2tex,<parsed file>) |
| 1707 |
define die-on-dot2tex |
| 1708 |
if $(EGREP) -q ' LaTeX Error: File .*\.dot_t.* not found' $1; then \ |
| 1709 |
$(ECHO) "$(C_ERROR)Missing dot_t file(s)$(C_RESET)"; \ |
| 1710 |
$(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \ |
| 1711 |
$(ECHO) "$(C_ERROR) make all-dot2tex$(C_RESET)"; \ |
| 1712 |
$(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \ |
| 1713 |
exit 1; \ |
| 1714 |
fi |
| 1715 |
endef |
| 1716 |
|
| 1717 |
# Checks for the existence of a .aux file, and dies with an error message if it |
| 1718 |
# isn't there. Note that we pass the file stem in, not the full filename, |
| 1719 |
# e.g., to check for foo.aux, we call it thus: $(call die-on-no-aux,foo) |
| 1720 |
# |
| 1721 |
# $(call die-on-no-aux,<aux stem>) |
| 1722 |
define die-on-no-aux |
| 1723 |
if [ ! -e '$1.aux' ]; then \ |
| 1724 |
$(call colorize-latex-errors,$1.log); \ |
| 1725 |
$(ECHO) "$(C_ERROR)Error: failed to create $1.aux$(C_RESET)"; \ |
| 1726 |
exit 1; \ |
| 1727 |
fi |
| 1728 |
endef |
| 1729 |
|
| 1730 |
# Outputs all index files to stdout. Arg 1 is the source file stem, arg 2 is |
| 1731 |
# the list of targets for the discovered dependency. |
| 1732 |
# |
| 1733 |
# $(call get-log-index,<log file stem>,<target files>) |
| 1734 |
define get-log-index |
| 1735 |
$(SED) \ |
| 1736 |
-e 's/^No file \(.*\.ind\)\.$$/TARGETS=\1/' \ |
| 1737 |
-e 's/^No file \(.*\.[gn]ls\)\.$$/TARGETS=\1/' \ |
| 1738 |
-e 's/[[:space:]]/\\&/g' \ |
| 1739 |
-e '/^TARGETS=/{' \ |
| 1740 |
-e ' h' \ |
| 1741 |
-e ' s!^TARGETS=!$2: !p' \ |
| 1742 |
-e ' g' \ |
| 1743 |
-e ' s!^TARGETS=\(.*\)!\1: $1.tex!p' \ |
| 1744 |
-e '}' \ |
| 1745 |
-e 'd' \ |
| 1746 |
'$1.log' | $(SORT) | $(UNIQ) |
| 1747 |
endef |
| 1748 |
|
| 1749 |
|
| 1750 |
# Outputs all bibliography files to stdout. Arg 1 is the source stem, arg 2 is |
| 1751 |
# a list of targets for each dependency found. |
| 1752 |
# |
| 1753 |
# The script kills all lines that do not contain bibdata. Remaining lines have |
| 1754 |
# the \bibdata macro and delimiters removed to create a dependency list. A |
| 1755 |
# trailing comma is added, then all adjacent commas are collapsed into a single |
| 1756 |
# comma. Then commas are replaced with the string .bib[space], and the |
| 1757 |
# trailing space is killed off. Finally, all filename spaces are escaped. |
| 1758 |
# This produces a list of space-delimited .bib filenames, which is what the |
| 1759 |
# make dep file expects to see. |
| 1760 |
# |
| 1761 |
# Note that we give kpsewhich a bogus argument so that a failure of sed to |
| 1762 |
# produce output will not cause an error. |
| 1763 |
# |
| 1764 |
# $(call get-bibs,<aux file>,<targets>) |
| 1765 |
define get-bibs |
| 1766 |
$(SED) \ |
| 1767 |
-e '/^\\bibdata/!d' \ |
| 1768 |
-e 's/\\bibdata{\([^}]*\)}/\1,/' \ |
| 1769 |
-e 's/,\{2,\}/,/g' \ |
| 1770 |
-e 's/[[:space:]]/\\&/g' \ |
| 1771 |
-e 's/,/.bib /g' \ |
| 1772 |
-e 's/ \{1,\}$$//' \ |
| 1773 |
$1 | $(XARGS) $(KPSEWHICH) '#######' | \ |
| 1774 |
$(SED) \ |
| 1775 |
-e 's!^!$2: !' | \ |
| 1776 |
$(SORT) | $(UNIQ) |
| 1777 |
endef |
| 1778 |
|
| 1779 |
# Makes a an aux file that only has stuff relevant to the target in it |
| 1780 |
# $(call make-auxtarget-file,<flattened-aux>,<new-aux>) |
| 1781 |
define make-auxtarget-file |
| 1782 |
$(SED) \ |
| 1783 |
-e '/^\\newlabel/!d' \ |
| 1784 |
$1 > $2 |
| 1785 |
endef |
| 1786 |
|
| 1787 |
# Makes an aux file that only has stuff relevant to the bbl in it |
| 1788 |
# $(call make-auxbbl-file,<flattened-aux>,<new-aux>) |
| 1789 |
define make-auxbbl-file |
| 1790 |
$(SED) \ |
| 1791 |
-e '/^\\newlabel/d' \ |
| 1792 |
$1 > $2 |
| 1793 |
endef |
| 1794 |
|
| 1795 |
# Makes a .gpi.d file from a .gpi file |
| 1796 |
# $(call make-gpi-d,<.gpi>,<.gpi.d>) |
| 1797 |
define make-gpi-d |
| 1798 |
$(ECHO) '# vim: ft=make' > $2; \ |
| 1799 |
$(ECHO) 'ifndef INCLUDED_$(call cleanse-filename,$2)' >> $2; \ |
| 1800 |
$(ECHO) 'INCLUDED_$(call cleanse-filename,$2) := 1' >> $2; \ |
| 1801 |
$(call get-gpi-deps,$1,$(addprefix $(2:%.gpi.d=%).,$(GPI_OUTPUT_EXTENSION) gpi.d)) >> $2; \ |
| 1802 |
$(ECHO) 'endif' >> $2; |
| 1803 |
endef |
| 1804 |
|
| 1805 |
# Parse .gpi files for data and loaded dependencies, output to stdout |
| 1806 |
# |
| 1807 |
# The sed script here tries to be clever about obtaining valid |
| 1808 |
# filenames from the gpi file. It assumes that the plot command starts its own |
| 1809 |
# line, which is not too difficult a constraint to satisfy. |
| 1810 |
# |
| 1811 |
# This command script also generates 'include' directives for every 'load' |
| 1812 |
# command in the .gpi file. The load command must appear on a line by itself |
| 1813 |
# and the file it loads must have the suffix .gpi. If you don't want it to be |
| 1814 |
# compiled when running make graphics, then give it a suffix of ._include_.gpi. |
| 1815 |
# |
| 1816 |
# $(call get-gpi-deps,<gpi file>,<targets>) |
| 1817 |
define get-gpi-deps |
| 1818 |
$(SED) \ |
| 1819 |
-e '/^[[:space:]]*s\{0,1\}plot/,/[^\\]$$/{' \ |
| 1820 |
-e ' H' \ |
| 1821 |
-e ' /[^\\]$$/{' \ |
| 1822 |
-e ' s/.*//' \ |
| 1823 |
-e ' x' \ |
| 1824 |
-e ' s/\\\{0,1\}\n//g' \ |
| 1825 |
-e ' s/^[[:space:]]*s\{0,1\}plot[[:space:]]*\(\[[^]]*\][[:space:]]*\)*/,/' \ |
| 1826 |
-e ' s/[[:space:]]*\(['"'"'\'"'"''"'"'"][^'"'"'\'"'"''"'"'"]*['"'"'\'"'"''"'"'"]\)\{0,1\}[^,]*/\1/g' \ |
| 1827 |
-e ' s/,['"'"'\'"'"''"'"'"]-\{0,1\}['"'"'\'"'"''"'"'"]//g' \ |
| 1828 |
-e ' s/[,'"'"'\'"'"''"'"'"]\{1,\}/ /g' \ |
| 1829 |
-e ' s/.*:.*/$$(error Error: Filenames with colons are not allowed: &)/' \ |
| 1830 |
-e ' s!.*!$2: &!' \ |
| 1831 |
-e ' p' \ |
| 1832 |
-e ' }' \ |
| 1833 |
-e ' d' \ |
| 1834 |
-e '}' \ |
| 1835 |
-e 's/^[[:space:]]*load[[:space:]]*['"'"'\'"'"''"'"'"]\([^'"'"'\'"'"''"'"'"]*\.gpi\)['"'"'\'"'"''"'"'"].*$$/-include \1.d/p' \ |
| 1836 |
-e 'd' \ |
| 1837 |
'$1' |
| 1838 |
endef |
| 1839 |
|
| 1840 |
# Colorizes real, honest-to-goodness LaTeX errors that can't be overcome with |
| 1841 |
# recompilation. |
| 1842 |
# |
| 1843 |
# Note that we only ignore file not found errors for things that we know how to |
| 1844 |
# build, like graphics files. |
| 1845 |
# |
| 1846 |
# Also note that the output of this is piped through sed again to escape any |
| 1847 |
# backslashes that might have made it through. This is to avoid sending things |
| 1848 |
# like "\right" to echo, which interprets \r as LF. In bash, we could just do |
| 1849 |
# ${var//\\/\\\\}, but in other popular sh variants (like dash), this doesn't |
| 1850 |
# work. |
| 1851 |
# |
| 1852 |
# $(call colorize-latex-errors,<log file>) |
| 1853 |
define colorize-latex-errors |
| 1854 |
$(SED) \ |
| 1855 |
-e '$${' \ |
| 1856 |
-e ' /^$$/!{' \ |
| 1857 |
-e ' H' \ |
| 1858 |
-e ' s/.*//' \ |
| 1859 |
-e ' }' \ |
| 1860 |
-e '}' \ |
| 1861 |
-e '/^$$/!{' \ |
| 1862 |
-e ' H' \ |
| 1863 |
-e ' d' \ |
| 1864 |
-e '}' \ |
| 1865 |
-e '/^$$/{' \ |
| 1866 |
-e ' x' \ |
| 1867 |
-e ' s/^\(\n\)\(.*\)/\2\1/' \ |
| 1868 |
-e '}' \ |
| 1869 |
-e '/^::P\(P\{1,\}\)::/{' \ |
| 1870 |
-e ' s//::\1::/' \ |
| 1871 |
-e ' G' \ |
| 1872 |
-e ' h' \ |
| 1873 |
-e ' d' \ |
| 1874 |
-e '}' \ |
| 1875 |
-e '/^::P::/{' \ |
| 1876 |
-e ' s//::0::/' \ |
| 1877 |
-e ' G' \ |
| 1878 |
-e '}' \ |
| 1879 |
-e 'b start' \ |
| 1880 |
-e ':needonemore' \ |
| 1881 |
-e 's/^/::P::/' \ |
| 1882 |
-e 'G' \ |
| 1883 |
-e 'h' \ |
| 1884 |
-e 'd' \ |
| 1885 |
-e ':needtwomore' \ |
| 1886 |
-e 's/^/::PP::/' \ |
| 1887 |
-e 'G' \ |
| 1888 |
-e 'h' \ |
| 1889 |
-e 'd' \ |
| 1890 |
-e ':needthreemore' \ |
| 1891 |
-e 's/^/::PPP::/' \ |
| 1892 |
-e 'G' \ |
| 1893 |
-e 'h' \ |
| 1894 |
-e 'd' \ |
| 1895 |
-e ':start' \ |
| 1896 |
-e '/^! LaTeX Error: File /{' \ |
| 1897 |
-e ' s/\n//g' \ |
| 1898 |
-e ' b needtwomore' \ |
| 1899 |
-e '}' \ |
| 1900 |
-e 's/^[^[:cntrl:]:]*:[[:digit:]]\{1,\}:/!!! &/' \ |
| 1901 |
-e 's/^\(.*\n\)\([^[:cntrl:]:]*:[[:digit:]]\{1,\}: .*\)/\1!!! \2/' \ |
| 1902 |
-e '/^!!! .* LaTeX Error: File /{' \ |
| 1903 |
-e ' s/\n//g' \ |
| 1904 |
-e ' b needonemore' \ |
| 1905 |
-e '}' \ |
| 1906 |
-e '/^::0::! LaTeX Error: File .*/{' \ |
| 1907 |
-e ' /\n\n$$/{' \ |
| 1908 |
-e ' s/^::0:://' \ |
| 1909 |
-e ' b needonemore' \ |
| 1910 |
-e ' }' \ |
| 1911 |
-e ' s/^::0::! //' \ |
| 1912 |
-e ' s/^\(.*not found.\).*Enter file name:.*\n\(.*[[:digit:]]\{1,\}\): Emergency stop.*/\2: \1/' \ |
| 1913 |
-e ' b error' \ |
| 1914 |
-e '}' \ |
| 1915 |
-e '/^::0::!!! .*LaTeX Error: File .*/{' \ |
| 1916 |
-e ' /\n\n$$/{' \ |
| 1917 |
-e ' s/^::0:://' \ |
| 1918 |
-e ' b needonemore' \ |
| 1919 |
-e ' }' \ |
| 1920 |
-e ' s/::0::!!! //' \ |
| 1921 |
-e ' /could not locate.*any of these extensions:/{' \ |
| 1922 |
-e ' d' \ |
| 1923 |
-e ' }' \ |
| 1924 |
-e ' s/\(not found\.\).*/\1/' \ |
| 1925 |
-e ' b error' \ |
| 1926 |
-e '}' \ |
| 1927 |
-e '/^\(.* LaTeX Error: Missing .begin.document.\.\).*/{' \ |
| 1928 |
-e ' s//\1 --- Are you trying to build an include file?/' \ |
| 1929 |
-e ' b error' \ |
| 1930 |
-e '}' \ |
| 1931 |
-e '/.*\(!!! .*Undefined control sequence\)[^[:cntrl:]]*\(.*\)/{' \ |
| 1932 |
-e ' s//\1: \2/' \ |
| 1933 |
-e ' s/\nl\.[[:digit:]][^[:cntrl:]]*\(\\[^\\[:cntrl:]]*\).*/\1/' \ |
| 1934 |
-e ' b error' \ |
| 1935 |
-e '}' \ |
| 1936 |
-e '/^\(!pdfTeX error:.*\)s*/{' \ |
| 1937 |
-e ' b error' \ |
| 1938 |
-e '}' \ |
| 1939 |
-e '/.*\(!!! .*\)/{' \ |
| 1940 |
-e ' s//\1/' \ |
| 1941 |
-e ' s/[[:cntrl:]]//' \ |
| 1942 |
-e ' s/[[:cntrl:]]$$//' \ |
| 1943 |
-e ' b error' \ |
| 1944 |
-e '}' \ |
| 1945 |
-e 'd' \ |
| 1946 |
-e ':error' \ |
| 1947 |
-e 's/^!\(!! \)\{0,1\}\(.*\)/$(C_ERROR)\2$(C_RESET)/' \ |
| 1948 |
-e 'p' \ |
| 1949 |
-e 'd' \ |
| 1950 |
'$1' | $(SED) -e 's/\\\\/\\\\\\\\/g' |
| 1951 |
endef |
| 1952 |
|
| 1953 |
# Colorize Makeindex errors |
| 1954 |
define colorize-makeindex-errors |
| 1955 |
$(SED) \ |
| 1956 |
-e '/^!! /{' \ |
| 1957 |
-e ' N' \ |
| 1958 |
-e ' s/^.*$$/$(C_ERROR)&$(C_RESET)/' \ |
| 1959 |
-e ' p' \ |
| 1960 |
-e '}' \ |
| 1961 |
-e 'd' \ |
| 1962 |
'$1' |
| 1963 |
endef |
| 1964 |
|
| 1965 |
# Colorize xindy errors |
| 1966 |
# $(call colorize-xindy-errors,<log file>) |
| 1967 |
define colorize-xindy-errors |
| 1968 |
$(SED) \ |
| 1969 |
-e 's/^xindy:.*/$(C_ERROR)&$(C_RESET)/p' \ |
| 1970 |
-e 'd' \ |
| 1971 |
'$1' |
| 1972 |
endef |
| 1973 |
|
| 1974 |
# Colorize epstopdf errors |
| 1975 |
# |
| 1976 |
# $(call colorize-epstopdf-errors,<log file>) |
| 1977 |
define colorize-epstopdf-errors |
| 1978 |
$(SED) \ |
| 1979 |
-e '/^Error:/,/^Execution stack:/{' \ |
| 1980 |
-e ' /^Execution stack:/d' \ |
| 1981 |
-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ |
| 1982 |
-e ' p' \ |
| 1983 |
-e '}' \ |
| 1984 |
-e 'd' \ |
| 1985 |
'$1' |
| 1986 |
endef |
| 1987 |
|
| 1988 |
# Colorize GNUplot errors |
| 1989 |
# |
| 1990 |
# $(call colorize-gnuplot-errors,<log file>) |
| 1991 |
define colorize-gnuplot-errors |
| 1992 |
$(SED) \ |
| 1993 |
-e '/, line [0-9]*:/!{' \ |
| 1994 |
-e ' H' \ |
| 1995 |
-e ' x' \ |
| 1996 |
-e ' s/.*\n\(.*\n.*\)$$/\1/' \ |
| 1997 |
-e ' x' \ |
| 1998 |
-e '}' \ |
| 1999 |
-e '/, line [0-9]*:/{' \ |
| 2000 |
-e ' H' \ |
| 2001 |
-e ' /unknown.*terminal type/{' \ |
| 2002 |
-e ' s/.*/--- Try changing the GNUPLOT_OUTPUT_EXTENSION variable to '"'"'eps'"'"'./' \ |
| 2003 |
-e ' H' \ |
| 2004 |
-e ' }' \ |
| 2005 |
-e ' /gpihead/{' \ |
| 2006 |
-e ' s/.*/--- This could be a Makefile bug - contact the maintainer./' \ |
| 2007 |
-e ' H' \ |
| 2008 |
-e ' }' \ |
| 2009 |
-e ' g' \ |
| 2010 |
-e ' s/.*/$(C_ERROR)&$(C_RESET)/' \ |
| 2011 |
-e ' p' \ |
| 2012 |
-e '}' \ |
| 2013 |
-e '/^gnuplot>/,/^$$/{' \ |
| 2014 |
-e ' s/^gnuplot.*/$(C_ERROR)&/' \ |
| 2015 |
-e ' s/^$$/$(C_RESET)/' \ |
| 2016 |
-e ' p' \ |
| 2017 |
-e '}' \ |
| 2018 |
-e 'd' \ |
| 2019 |
$1 |
| 2020 |
endef |
| 2021 |
|
| 2022 |
# Colorize GraphViz errors |
| 2023 |
# |
| 2024 |
# $(call colorize-dot-errors,<log file>) |
| 2025 |
define colorize-dot-errors |
| 2026 |
$(SED) \ |
| 2027 |
-e 's/.*not found.*/$(C_ERROR)&$(C_RESET)/p' \ |
| 2028 |
-e '/^Error:/,/context:/s/.*/$(C_ERROR)&$(C_RESET)/p' \ |
| 2029 |
-e 's/^Warning:.*/$(C_WARNING)&$(C_RESET)/p' \ |
| 2030 |
-e 'd' \ |
| 2031 |
'$1' |
| 2032 |
endef |
| 2033 |
|
| 2034 |
# Get all important .aux files from the top-level .aux file and merges them all |
| 2035 |
# into a single file, which it outputs to stdout. |
| 2036 |
# |
| 2037 |
# $(call flatten-aux,<toplevel aux>,<output file>) |
| 2038 |
define flatten-aux |
| 2039 |
$(SED) \ |
| 2040 |
-e '/\\@input{\(.*\)}/{' \ |
| 2041 |
-e 's//\1/' \ |
| 2042 |
-e 's![.:]!\\&!g' \ |
| 2043 |
-e 'h' \ |
| 2044 |
-e 's!.*!\\:\\\\@input{&}:{!' \ |
| 2045 |
-e 'p' \ |
| 2046 |
-e 'x' \ |
| 2047 |
-e 's/\\././g' \ |
| 2048 |
-e 's/.*/r &/p' \ |
| 2049 |
-e 's/.*/d/p' \ |
| 2050 |
-e 's/.*/}/p' \ |
| 2051 |
-e 'd' \ |
| 2052 |
-e '}' \ |
| 2053 |
-e 'd' \ |
| 2054 |
'$1' > "$1.$$$$.sed.make"; \ |
| 2055 |
$(SED) -f "$1.$$$$.sed.make" '$1' > "$1.$$$$.make"; \ |
| 2056 |
$(SED) \ |
| 2057 |
-e '/^\\relax/d' \ |
| 2058 |
-e '/^\\bibcite/d' \ |
| 2059 |
-e 's/^\(\\newlabel{[^}]\{1,\}}\).*/\1/' \ |
| 2060 |
"$1.$$$$.make" | $(SORT) > '$2'; \ |
| 2061 |
$(call remove-temporary-files,$1.$$$$.make $1.$$$$.sed.make) |
| 2062 |
endef |
| 2063 |
|
| 2064 |
# Generate pdf from postscript |
| 2065 |
# |
| 2066 |
# Note that we don't just call ps2pdf, since there are so many versions of that |
| 2067 |
# script on various systems. Instead, we call the postscript interpreter |
| 2068 |
# directly. |
| 2069 |
# |
| 2070 |
# $(call ps2pdf,infile,outfile,[embed fonts]) |
| 2071 |
define ps2pdf |
| 2072 |
$(GS) \ |
| 2073 |
-dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \ |
| 2074 |
$(if $3,$(PS_EMBED_OPTIONS)) \ |
| 2075 |
-q -dNOPAUSE -dBATCH \ |
| 2076 |
-sDEVICE=pdfwrite -sstdout=%stderr \ |
| 2077 |
'-sOutputFile=$2' \ |
| 2078 |
-dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \ |
| 2079 |
$(if $3,$(PS_EMBED_OPTIONS)) \ |
| 2080 |
-c .setpdfwrite \ |
| 2081 |
-f '$1' |
| 2082 |
endef |
| 2083 |
|
| 2084 |
# Colorize LaTeX output. |
| 2085 |
color_tex := \ |
| 2086 |
$(SED) \ |
| 2087 |
-e '$${' \ |
| 2088 |
-e ' /^$$/!{' \ |
| 2089 |
-e ' H' \ |
| 2090 |
-e ' s/.*//' \ |
| 2091 |
-e ' }' \ |
| 2092 |
-e '}' \ |
| 2093 |
-e '/^$$/!{' \ |
| 2094 |
-e ' H' \ |
| 2095 |
-e ' d' \ |
| 2096 |
-e '}' \ |
| 2097 |
-e '/^$$/{' \ |
| 2098 |
-e ' x' \ |
| 2099 |
-e ' s/^\n//' \ |
| 2100 |
-e ' /Output written on /{' \ |
| 2101 |
-e ' s/.*Output written on \([^(]*\) (\([^)]\{1,\}\)).*/Success! Wrote \2 to \1/' \ |
| 2102 |
-e ' s/[[:digit:]]\{1,\}/$(C_PAGES)&$(C_RESET)/g' \ |
| 2103 |
-e ' s/Success!/$(C_SUCCESS)&$(C_RESET)/g' \ |
| 2104 |
-e ' s/to \(.*\)$$/to $(C_SUCCESS)\1$(C_RESET)/' \ |
| 2105 |
-e ' b end' \ |
| 2106 |
-e ' }' \ |
| 2107 |
-e ' / *LaTeX Error:.*/{' \ |
| 2108 |
-e ' s/.*\( *LaTeX Error:.*\)/$(C_ERROR)\1$(C_RESET)/' \ |
| 2109 |
-e ' b end' \ |
| 2110 |
-e ' }' \ |
| 2111 |
-e ' /.*Warning:.*/{' \ |
| 2112 |
-e ' s//$(C_WARNING)&$(C_RESET)/' \ |
| 2113 |
-e ' b end' \ |
| 2114 |
-e ' }' \ |
| 2115 |
-e ' /Underfull.*/{' \ |
| 2116 |
-e ' s/.*\(Underfull.*\)/$(C_UNDERFULL)\1$(C_RESET)/' \ |
| 2117 |
-e ' b end' \ |
| 2118 |
-e ' }' \ |
| 2119 |
-e ' /Overfull.*/{' \ |
| 2120 |
-e ' s/.*\(Overfull.*\)/$(C_OVERFULL)\1$(C_RESET)/' \ |
| 2121 |
-e ' b end' \ |
| 2122 |
-e ' }' \ |
| 2123 |
-e ' d' \ |
| 2124 |
-e ' :end' \ |
| 2125 |
-e ' G' \ |
| 2126 |
-e '}' |
| 2127 |
|
| 2128 |
# Colorize BibTeX output. |
| 2129 |
color_bib := \ |
| 2130 |
$(SED) \ |
| 2131 |
-e 's/^Warning--.*/$(C_WARNING)&$(C_RESET)/' \ |
| 2132 |
-e 't' \ |
| 2133 |
-e '/---/,/^.[^:]/{' \ |
| 2134 |
-e ' H' \ |
| 2135 |
-e ' /^.[^:]/{' \ |
| 2136 |
-e ' x' \ |
| 2137 |
-e ' s/\n\(.*\)/$(C_ERROR)\1$(C_RESET)/' \ |
| 2138 |
-e ' p' \ |
| 2139 |
-e ' s/.*//' \ |
| 2140 |
-e ' h' \ |
| 2141 |
-e ' d' \ |
| 2142 |
-e ' }' \ |
| 2143 |
-e ' d' \ |
| 2144 |
-e '}' \ |
| 2145 |
-e '/(.*error.*)/s//$(C_ERROR)&$(C_RESET)/' \ |
| 2146 |
-e 'd' |
| 2147 |
|
| 2148 |
# Make beamer output big enough to print on a full page. Landscape doesn't |
| 2149 |
# seem to work correctly. |
| 2150 |
enlarge_beamer = $(PSNUP) -l -1 -W128mm -H96mm -pletter |
| 2151 |
|
| 2152 |
# $(call test-run-again,<source stem>) |
| 2153 |
test-run-again = $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.)$$' $1.log |
| 2154 |
|
| 2155 |
# This tests whether the build target commands should be run at all, from |
| 2156 |
# viewing the log file. |
| 2157 |
# $(call test-log-for-need-to-run,<source stem>) |
| 2158 |
define test-log-for-need-to-run |
| 2159 |
$(SED) \ |
| 2160 |
-e '/^No file $(call escape-fname-regex,$1)\.aux\./d' \ |
| 2161 |
$1.log \ |
| 2162 |
| $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.|No file .+\.tex\.|LaTeX Warning: File.*)$$' |
| 2163 |
endef |
| 2164 |
|
| 2165 |
# LaTeX invocations |
| 2166 |
# |
| 2167 |
# $(call latex,<tex file>,[<extra LaTeX args>]) |
| 2168 |
run-latex = $(latex_build_program) -interaction=batchmode -file-line-error $(if $2,$2,) $1 > /dev/null |
| 2169 |
|
| 2170 |
# $(call latex-color-log,<LaTeX stem>) |
| 2171 |
latex-color-log = $(color_tex) $1.log |
| 2172 |
|
| 2173 |
# $(call run-makeindex,<input>,<output>,<log>,[.ist style file]) |
| 2174 |
define run-makeindex |
| 2175 |
success=1; \ |
| 2176 |
if ! $(MAKEINDEX) -q $1 -t $3 -o $2 $(if $4,-s $4,) > /dev/null || $(EGREP) -q '^!!' $3; \ |
| 2177 |
then \ |
| 2178 |
$(call colorize-makeindex-errors,$3); \ |
| 2179 |
$(RM) -f '$2'; \ |
| 2180 |
success=0; \ |
| 2181 |
fi; \ |
| 2182 |
[ "$$success" = "1" ] && $(sh_true) || $(sh_false); |
| 2183 |
endef |
| 2184 |
|
| 2185 |
|
| 2186 |
# $(call run-xindy,<input>,<output>,<module>,<log>) |
| 2187 |
define run-xindy |
| 2188 |
success=1; \ |
| 2189 |
if ! $(XINDY) -q -o $2 -L $(XINDYLANG) -C $(XINDYENC) -I xindy -M $3 -t $4 $1 > /dev/null || $(EGREP) -q '^xindy:' $4; then \ |
| 2190 |
$(call colorize-xindy-errors,$4); \ |
| 2191 |
$(RM) -f '$2'; \ |
| 2192 |
success=0; \ |
| 2193 |
fi; \ |
| 2194 |
[ "$$success" = "1" ] && $(sh_true) || $(sh_false); |
| 2195 |
endef |
| 2196 |
|
| 2197 |
# This runs the given script to generate output, and it uses MAKE_RESTARTS to |
| 2198 |
# ensure that it never runs it more than once for a particular root make |
| 2199 |
# invocation. |
| 2200 |
# |
| 2201 |
# $(call run-script,<interpreter>,<input>,<output>) |
| 2202 |
define run-script |
| 2203 |
[ ! -e '$2.cookie' ] && $(ECHO) "restarts=$(RESTARTS)" > $2.cookie && $(ECHO) "level=$(MAKELEVEL)" >> $2.cookie; \ |
| 2204 |
restarts=`$(SED) -n -e 's/^restarts=//p' $2.cookie`; \ |
| 2205 |
level=`$(SED) -n -e 's/^level=//p' $2.cookie`; \ |
| 2206 |
if $(EXPR) $(MAKELEVEL) '<=' $$level '&' $(RESTARTS) '<=' $$restarts >/dev/null; then \ |
| 2207 |
$(call echo-build,$2,$3,$(RESTARTS)-$(MAKELEVEL)); \ |
| 2208 |
$1 '$2' '$3'; \ |
| 2209 |
$(ECHO) "restarts=$(RESTARTS)" > '$2.cookie'; \ |
| 2210 |
$(ECHO) "level=$(MAKELEVEL)" >> '$2.cookie'; \ |
| 2211 |
fi |
| 2212 |
endef |
| 2213 |
|
| 2214 |
# BibTeX invocations |
| 2215 |
# |
| 2216 |
# $(call run-bibtex,<tex stem>) |
| 2217 |
run-bibtex = $(BIBTEX) $1 | $(color_bib) |
| 2218 |
|
| 2219 |
|
| 2220 |
# $(call convert-eps-to-pdf,<eps file>,<pdf file>,[gray]) |
| 2221 |
# Note that we don't use the --filter flag because it has trouble with bounding boxes that way. |
| 2222 |
define convert-eps-to-pdf |
| 2223 |
$(if $3,$(CAT) '$1' | $(call kill-ps-color) > '$1.cookie',$(CP) '$1' '$1.cookie'); \ |
| 2224 |
$(EPSTOPDF) '$1.cookie' --outfile='$2' > $1.log; \ |
| 2225 |
$(call colorize-epstopdf-errors,$1.log); |
| 2226 |
endef |
| 2227 |
|
| 2228 |
# $(call default-gpi-fontsize,<output file>) |
| 2229 |
# |
| 2230 |
# Find the default fontsize given the *output* file (it is based on the output extension) |
| 2231 |
# |
| 2232 |
default-gpi-fontsize = $(if $(filter %.pdf,$1),$(DEFAULT_GPI_PDF_FONTSIZE),$(DEFAULT_GPI_EPS_FONTSIZE)) |
| 2233 |
|
| 2234 |
# $(call gpi-fontsize,<gpi file>,<output file>) |
| 2235 |
# |
| 2236 |
# Find out what the gnuplot fontsize should be. Tries, in this order: |
| 2237 |
# - ##FONTSIZE comment in gpi file |
| 2238 |
# - ##FONTSIZE comment in global gpi file |
| 2239 |
# - default fontsize based on output type |
| 2240 |
define gpi-fontsize |
| 2241 |
$(strip $(firstword \ |
| 2242 |
$(shell $(SED) -e 's/^\#\#FONTSIZE=\([[:digit:]]\{1,\}\)/\1/p' -e 'd' $1 $(strip $(gpi_global))) \ |
| 2243 |
$(call default-gpi-fontsize,$2))) |
| 2244 |
endef |
| 2245 |
|
| 2246 |
# $(call gpi-monochrome,<gpi file>,[gray]) |
| 2247 |
define gpi-monochrome |
| 2248 |
$(strip $(if $2,monochrome,$(if $(shell $(EGREP) '^\#\#[[:space:]]*GRAY[[:space:]]*$$' $1 $(gpi_global)),monochrome,color))) |
| 2249 |
endef |
| 2250 |
|
| 2251 |
# $(call gpi-font-entry,<output file>,<fontsize>) |
| 2252 |
# |
| 2253 |
# Get the font entry given the output file (type) and the font size. For PDF |
| 2254 |
# it uses fsize or font, for eps it just uses the bare number. |
| 2255 |
gpi-font-entry = $(if $(filter %.pdf,$1),$(subst FONTSIZE,$2,$(GPI_FSIZE_SYNTAX)),$2) |
| 2256 |
|
| 2257 |
# $(call gpi-terminal,<gpi file><output file>,[gray]) |
| 2258 |
# |
| 2259 |
# Get the terminal settings for a given gpi and its intended output file |
| 2260 |
define gpi-terminal |
| 2261 |
$(if $(filter %.pdf,$2),pdf enhanced,postscript enhanced eps) \ |
| 2262 |
$(call gpi-font-entry,$2,$(call gpi-fontsize,$1,$2)) \ |
| 2263 |
$(call gpi-monochrome,$1,$3) |
| 2264 |
endef |
| 2265 |
|
| 2266 |
# $(call gpi-embed-pdf-fonts,<input file>,<output file>) |
| 2267 |
# |
| 2268 |
define gpi-embed-pdf-fonts |
| 2269 |
$(GS) \ |
| 2270 |
-q \ |
| 2271 |
-dSAFER \ |
| 2272 |
-dNOPAUSE \ |
| 2273 |
-dBATCH \ |
| 2274 |
-sDEVICE=$(if $(filter pdf,$(GPI_OUTPUT_EXTENSION)),pdfwrite,pswrite) \ |
| 2275 |
-sOutputFile='$2' \ |
| 2276 |
-sstdout=%stderr \ |
| 2277 |
-dCompatibilityLevel=1.5 \ |
| 2278 |
-dPDFSETTINGS=/prepress \ |
| 2279 |
-c .setpdfwrite \ |
| 2280 |
-f '$1' |
| 2281 |
endef |
| 2282 |
|
| 2283 |
# $(call convert-gpi,<gpi file>,<output file>,[gray]) |
| 2284 |
# |
| 2285 |
define convert-gpi |
| 2286 |
$(ECHO) 'set terminal $(call gpi-terminal,$1,$2,$3)' > $1head.make; \ |
| 2287 |
$(ECHO) 'set output "$2"' >> $1head.make; \ |
| 2288 |
$(if $(gpi_global),$(CAT) $(gpi_global) >> $1head.make;,) \ |
| 2289 |
fnames='$1head.make $1';\ |
| 2290 |
$(if $(gpi_sed),\ |
| 2291 |
$(SED) -f '$(gpi_sed)' $$fnames > $1.temp.make; \ |
| 2292 |
fnames=$1.temp.make;,\ |
| 2293 |
) \ |
| 2294 |
success=1; \ |
| 2295 |
if ! $(GNUPLOT) $$fnames 2>$1.log; then \ |
| 2296 |
$(call colorize-gnuplot-errors,$1.log); \ |
| 2297 |
success=0; \ |
| 2298 |
else \ |
| 2299 |
if ! $(call gpi-embed-pdf-fonts,$2,$2.embed.make); then \ |
| 2300 |
success = 0; \ |
| 2301 |
else \ |
| 2302 |
$(call move-if-exists,$2.embed.make,$2); \ |
| 2303 |
fi; \ |
| 2304 |
fi; \ |
| 2305 |
$(if $(gpi_sed),$(call remove-temporary-files,$1.temp.make);,) \ |
| 2306 |
$(call remove-temporary-files,$1head.make); \ |
| 2307 |
[ "$$success" = "1" ] && $(sh_true) || $(sh_false); |
| 2308 |
endef |
| 2309 |
|
| 2310 |
# Creation of .eps files from .png files |
| 2311 |
# |
| 2312 |
# The intermediate step of PNM (using NetPBM) produces much nicer output than |
| 2313 |
# ImageMagick's "convert" binary. I couldn't get the right combination of |
| 2314 |
# flags to make it look nice, anyway. |
| 2315 |
# |
| 2316 |
# To handle gray scale conversion, we pipe things through ppmtopgm in the |
| 2317 |
# middle. |
| 2318 |
# |
| 2319 |
# $(call convert-png,<png file>,<eps file>) |
| 2320 |
define convert-png |
| 2321 |
$(PNGTOPNM) "$1" \ |
| 2322 |
$(if $3,| $(PPMTOPGM),) \ |
| 2323 |
| $(PNMTOPS) -noturn \ |
| 2324 |
> "$2" |
| 2325 |
endef |
| 2326 |
|
| 2327 |
# Creation of .eps files from .jpg/.jpeg files |
| 2328 |
# |
| 2329 |
# Thanks to brubakee for this solution. |
| 2330 |
# |
| 2331 |
# Uses Postscript level 2 to avoid file size bloat |
| 2332 |
# $(call convert-jpg,<jpg file>,<eps file>) |
| 2333 |
define convert-jpg |
| 2334 |
$(CONVERT) $(if $3,-type Grayscale,) '$1' eps2:'$2' |
| 2335 |
endef |
| 2336 |
|
| 2337 |
# Creation of .eps files from .fig files |
| 2338 |
# $(call convert-fig,<fig file>,<output file>,[gray]) |
| 2339 |
convert-fig = $(FIG2DEV) -L $(if $(filter %.pdf,$2),pdf,eps) $(if $3,-N,) $1 $2 |
| 2340 |
|
| 2341 |
# Creation of .pstex files from .fig files |
| 2342 |
# $(call convert-fig-pstex,<fig file>,<pstex file>) |
| 2343 |
convert-fig-pstex = $(FIG2DEV) -L pstex $1 $2 > /dev/null 2>&1 |
| 2344 |
|
| 2345 |
# Creation of .pstex_t files from .fig files |
| 2346 |
# $(call convert-fig-pstex-t,<fig file>,<pstex file>,<pstex_t file>) |
| 2347 |
convert-fig-pstex-t = $(FIG2DEV) -L pstex_t -p $3 $1 $2 > /dev/null 2>&1 |
| 2348 |
|
| 2349 |
# Creation of .dot_t files from .dot files |
| 2350 |
# #(call convert-dot-tex,<dot file>,<dot_t file>) |
| 2351 |
convert-dot-tex = $(DOT2TEX) '$1' > '$2' |
| 2352 |
|
| 2353 |
# Converts svg files into .eps files |
| 2354 |
# |
| 2355 |
# $(call convert-svg,<svg file>,<eps/pdf file>,[gray]) |
| 2356 |
convert-svg = $(INKSCAPE) --without-gui $(if $(filter %.pdf,$2),--export-pdf,--export-eps)='$2' '$1' |
| 2357 |
|
| 2358 |
# Converts xvg files into .eps files |
| 2359 |
# |
| 2360 |
# $(call convert-xvg,<xvg file>,<eps file>,[gray]) |
| 2361 |
convert-xvg = $(XMGRACE) '$1' -printfile - -hardcopy -hdevice $(if $3,-mono,) EPS > '$2' |
| 2362 |
|
| 2363 |
# Converts .eps.gz files into .eps files |
| 2364 |
# |
| 2365 |
# $(call convert-epsgz,<eps.gz file>,<eps file>,[gray]) |
| 2366 |
convert-epsgz = $(GUNZIP) -c '$1' $(if $3,| $(call kill-ps-color)) > '$2' |
| 2367 |
|
| 2368 |
# Converts .eps files into .eps files (usually a no-op, but can make grayscale) |
| 2369 |
# |
| 2370 |
# $(call convert-eps,<in file>,<out file>,[gray]) |
| 2371 |
convert-eps = $(if $3,$(call kill-ps-color) $1 > $2) |
| 2372 |
|
| 2373 |
# The name of the file containing special postscript commands for grayscale |
| 2374 |
gray_eps_file := gray.eps.make |
| 2375 |
|
| 2376 |
# Changes sethsbcolor and setrgbcolor calls in postscript to always produce |
| 2377 |
# grayscale. In general, this is accomplished by writing new versions of those |
| 2378 |
# functions into the user dictionary space, which is looked up before the |
| 2379 |
# global or system dictionaries (userdict is one of the permanent dictionaries |
| 2380 |
# in postscript and is not read-only like systemdict). |
| 2381 |
# |
| 2382 |
# For setrgbcolor, the weighted average of the triple is computed and the |
| 2383 |
# triple is replaced with three copies of that average before the original |
| 2384 |
# procedure is called: .299R + .587G + .114B |
| 2385 |
# |
| 2386 |
# For sethsbcolor, the color is first converted to RGB, then to grayscale by |
| 2387 |
# the new setrgbcolor operator as described above. Why is this done? |
| 2388 |
# Because simply using the value component will tend to make pure colors |
| 2389 |
# white, a very undesirable thing. Pure blue should not translate to white, |
| 2390 |
# but to some level of gray. Conversion to RGB does the right thing. It's |
| 2391 |
# messy, but it works. |
| 2392 |
# |
| 2393 |
# From |
| 2394 |
# http://en.wikipedia.org/wiki/HSV_color_space#Transformation_from_HSV_to_RGB, |
| 2395 |
# HSB = HSV (Value = Brightness), and the formula used to convert to RGB is |
| 2396 |
# as follows: |
| 2397 |
# |
| 2398 |
# Hi = int(floor(6 * H)) mod 6 |
| 2399 |
# f = 6 * H - Hi |
| 2400 |
# p = V(1-S) |
| 2401 |
# q = V(1-fS) |
| 2402 |
# t = V(1-(1-f)S) |
| 2403 |
# if Hi = 0: R G B <-- V t p |
| 2404 |
# if Hi = 1: R G B <-- q V p |
| 2405 |
# if Hi = 2: R G B <-- p V t |
| 2406 |
# if Hi = 3: R G B <-- p q V |
| 2407 |
# if Hi = 4: R G B <-- t p V |
| 2408 |
# if Hi = 5: R G B <-- V p q |
| 2409 |
# |
| 2410 |
# The messy stack-based implementation is below |
| 2411 |
# $(call create-gray-eps-file,filename) |
| 2412 |
define create-gray-eps-file |
| 2413 |
$(ECHO) -n -e '\ |
| 2414 |
/OLDRGB /setrgbcolor load def\n\ |
| 2415 |
/setrgbcolor {\n\ |
| 2416 |
.114 mul exch\n\ |
| 2417 |
.587 mul add exch\n\ |
| 2418 |
.299 mul add\n\ |
| 2419 |
dup dup\n\ |
| 2420 |
OLDRGB\n\ |
| 2421 |
} bind def\n\ |
| 2422 |
/OLDHSB /sethsbcolor load def\n\ |
| 2423 |
/sethsbcolor {\n\ |
| 2424 |
2 index % H V S H\n\ |
| 2425 |
6 mul floor cvi 6 mod % Hi V S H\n\ |
| 2426 |
3 index % H Hi V S H\n\ |
| 2427 |
6 mul % 6H Hi V S H\n\ |
| 2428 |
1 index % Hi 6H Hi V S H\n\ |
| 2429 |
sub % f Hi V S H\n\ |
| 2430 |
2 index 1 % 1 V f Hi V S H\n\ |
| 2431 |
4 index % S 1 V f Hi V S H\n\ |
| 2432 |
sub mul % p f Hi V S H\n\ |
| 2433 |
3 index 1 % 1 V p f Hi V S H\n\ |
| 2434 |
6 index % S 1 V p f Hi V S H\n\ |
| 2435 |
4 index % f S 1 V p f Hi V S H\n\ |
| 2436 |
mul sub mul % q p f Hi V S H\n\ |
| 2437 |
4 index 1 1 % 1 1 V q p f Hi V S H\n\ |
| 2438 |
5 index % f 1 1 V q p f Hi V S H\n\ |
| 2439 |
sub % (1-f) 1 V q p f Hi V S H\n\ |
| 2440 |
8 index % S (1-f) 1 V q p f Hi V S H\n\ |
| 2441 |
mul sub mul % t q p f Hi V S H\n\ |
| 2442 |
4 -1 roll pop % t q p Hi V S H\n\ |
| 2443 |
7 -2 roll pop pop % t q p Hi V\n\ |
| 2444 |
5 -2 roll % Hi V t q p\n\ |
| 2445 |
dup 0 eq\n\ |
| 2446 |
{1 index 3 index 6 index}\n\ |
| 2447 |
{\n\ |
| 2448 |
dup 1 eq\n\ |
| 2449 |
{3 index 2 index 6 index}\n\ |
| 2450 |
{\n\ |
| 2451 |
dup 2 eq\n\ |
| 2452 |
{4 index 2 index 4 index}\n\ |
| 2453 |
{\n\ |
| 2454 |
dup 3 eq\n\ |
| 2455 |
{4 index 4 index 3 index}\n\ |
| 2456 |
{\n\ |
| 2457 |
dup 4 eq\n\ |
| 2458 |
{2 index 5 index 3 index}\n\ |
| 2459 |
{\n\ |
| 2460 |
dup 5 eq\n\ |
| 2461 |
{1 index 5 index 5 index}\n\ |
| 2462 |
{0 0 0}\n\ |
| 2463 |
ifelse\n\ |
| 2464 |
}\n\ |
| 2465 |
ifelse\n\ |
| 2466 |
}\n\ |
| 2467 |
ifelse\n\ |
| 2468 |
}\n\ |
| 2469 |
ifelse\n\ |
| 2470 |
}\n\ |
| 2471 |
ifelse\n\ |
| 2472 |
}\n\ |
| 2473 |
ifelse % B G R Hi V t q p\n\ |
| 2474 |
setrgbcolor\n\ |
| 2475 |
5 {pop} repeat\n\ |
| 2476 |
} bind def\n'\ |
| 2477 |
> $1 |
| 2478 |
endef |
| 2479 |
|
| 2480 |
# This actually inserts the color-killing code into a postscript file |
| 2481 |
# $(call kill-ps-color) |
| 2482 |
define kill-ps-color |
| 2483 |
$(SED) -e '/%%EndComments/r $(gray_eps_file)' |
| 2484 |
endef |
| 2485 |
|
| 2486 |
# Converts graphviz .dot files into .eps files |
| 2487 |
# Grayscale is not directly supported by dot, so we pipe it through fig2dev in |
| 2488 |
# that case. |
| 2489 |
# $(call convert-dot,<dot file>,<eps file>,<log file>,[gray]) |
| 2490 |
define convert-dot |
| 2491 |
$(DOT) -Tps '$1' 2>'$3' $(if $4,| $(call kill-ps-color)) > $2; \ |
| 2492 |
$(call colorize-dot-errors,$3) |
| 2493 |
endef |
| 2494 |
|
| 2495 |
# Convert DVI to Postscript |
| 2496 |
# $(call make-ps,<dvi file>,<ps file>,<log file>,[<paper size>]) |
| 2497 |
make-ps = \ |
| 2498 |
$(DVIPS) -z -o '$2' $(if $(filter-out BEAMER,$4),-t$(firstword $4),) '$1' \ |
| 2499 |
$(if $(filter BEAMER,$4),| $(enlarge_beamer)) > $3 2>&1 |
| 2500 |
|
| 2501 |
# Convert Postscript to PDF |
| 2502 |
# $(call make-pdf,<ps file>,<pdf file>,<log file>,<embed file>) |
| 2503 |
make-pdf = \ |
| 2504 |
$(call ps2pdf,$1,$2,$(filter 1,$(shell $(CAT) '$4'))) > '$3' 2>&1 |
| 2505 |
|
| 2506 |
# Display information about what is being done |
| 2507 |
# $(call echo-build,<input file>,<output file>,[<run number>]) |
| 2508 |
echo-build = $(ECHO) "$(C_BUILD)= $1 --> $2$(if $3, ($3),) =$(C_RESET)" |
| 2509 |
echo-graphic = $(ECHO) "$(C_GRAPHIC)= $1 --> $2 =$(C_RESET)" |
| 2510 |
echo-dep = $(ECHO) "$(C_DEP)= $1 --> $2 =$(C_RESET)" |
| 2511 |
|
| 2512 |
# Display a list of something |
| 2513 |
# $(call echo-list,<values>) |
| 2514 |
echo-list = for x in $1; do $(ECHO) "$$x"; done |
| 2515 |
|
| 2516 |
# |
| 2517 |
# DEFAULT TARGET |
| 2518 |
# |
| 2519 |
|
| 2520 |
.PHONY: all |
| 2521 |
all: $(default_pdf_targets) ; |
| 2522 |
|
| 2523 |
.PHONY: all-pdf |
| 2524 |
all-pdf: $(default_pdf_targets) ; |
| 2525 |
|
| 2526 |
ifeq "$(strip $(BUILD_STRATEGY))" "latex" |
| 2527 |
.PHONY: all-ps |
| 2528 |
all-ps: $(default_ps_targets) ; |
| 2529 |
|
| 2530 |
.PHONY: all-dvi |
| 2531 |
all-dvi: $(default_dvi_targets) ; |
| 2532 |
endif |
| 2533 |
|
| 2534 |
# |
| 2535 |
# VIEWING TARGET |
| 2536 |
# |
| 2537 |
.PHONY: show |
| 2538 |
show: all |
| 2539 |
$(QUIET)for x in $(default_pdf_targets); do \ |
| 2540 |
[ -e "$$x" ] && $(VIEW_PDF) $$x & \ |
| 2541 |
done |
| 2542 |
|
| 2543 |
# |
| 2544 |
# INCLUDES |
| 2545 |
# |
| 2546 |
source_includes := $(addsuffix .d,$(source_stems_to_include)) |
| 2547 |
graphic_includes := $(addsuffix .gpi.d,$(graphic_stems_to_include)) |
| 2548 |
|
| 2549 |
# Check the version of the makefile |
| 2550 |
ifneq "" "$(filter 3.79 3.80,$(MAKE_VERSION))" |
| 2551 |
$(warning $(C_WARNING)Your version of make is too old. Please upgrade.$(C_RESET)) |
| 2552 |
endif |
| 2553 |
|
| 2554 |
# Include only the dependencies used |
| 2555 |
ifneq "" "$(source_includes)" |
| 2556 |
include $(source_includes)$(call include-message,$(source_includes)) |
| 2557 |
endif |
| 2558 |
ifneq "" "$(graphic_includes)" |
| 2559 |
include $(graphic_includes)$(call include-message,$(graphic_includes)) |
| 2560 |
endif |
| 2561 |
|
| 2562 |
# |
| 2563 |
# MAIN TARGETS |
| 2564 |
# |
| 2565 |
|
| 2566 |
# Note that we don't just say %: %.pdf here - this can tend to mess up our |
| 2567 |
# includes, which detect what kind of file we are asking for. For example, |
| 2568 |
# asking to build foo.pdf is much different than asking to build foo when |
| 2569 |
# foo.gpi exists, because we look through all of the goals for *.pdf that |
| 2570 |
# matches *.gpi, then use that to determine which include files we need to |
| 2571 |
# build. |
| 2572 |
# |
| 2573 |
# Thus, we invoke make recursively with better arugments instead, restarting |
| 2574 |
# all of the appropriate machinery. |
| 2575 |
.PHONY: $(default_stems_ss) |
| 2576 |
$(default_stems_ss): %: %.pdf ; |
| 2577 |
|
| 2578 |
# This builds and displays the wanted file. |
| 2579 |
.PHONY: $(addsuffix ._show,$(stems_ssg)) |
| 2580 |
$(addsuffix ._show,$(stems_ssg)): %._show: %.pdf |
| 2581 |
$(QUIET)$(VIEW_PDF) $< & |
| 2582 |
|
| 2583 |
ifeq "$(strip $(BUILD_STRATEGY))" "latex" |
| 2584 |
.SECONDARY: $(all_pdf_targets) |
| 2585 |
%.pdf: %.ps %.embed.make |
| 2586 |
$(QUIET)$(call echo-build,$<,$@) |
| 2587 |
$(QUIET)$(call make-pdf,$<,[email protected],[email protected],$*.embed.make); \ |
| 2588 |
if [ x"$$?" = x"0" ]; then \ |
| 2589 |
$(if $(VERBOSE),$(CAT) [email protected],:); \ |
| 2590 |
$(RM) -f '$@'; \ |
| 2591 |
$(MV) '[email protected]' '$@'; \ |
| 2592 |
$(TOUCH) '$@'; \ |
| 2593 |
$(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ |
| 2594 |
else \ |
| 2595 |
$(CAT) [email protected]; \ |
| 2596 |
$(call remove-temporary-files,'[email protected]'); \ |
| 2597 |
$(sh_false); \ |
| 2598 |
fi |
| 2599 |
|
| 2600 |
.SECONDARY: $(all_ps_targets) |
| 2601 |
%.ps: %.dvi %.paper.make |
| 2602 |
$(QUIET)$(call echo-build,$<,$@) |
| 2603 |
$(QUIET)$(call make-ps,$<,[email protected],[email protected],\ |
| 2604 |
$(firstword $(shell $(CAT) $*.paper.make))); \ |
| 2605 |
if [ x"$$?" = x"0" ]; then \ |
| 2606 |
$(if $(VERBOSE),$(CAT) [email protected],:); \ |
| 2607 |
$(RM) -f '$@'; \ |
| 2608 |
$(MV) '[email protected]' '$@'; \ |
| 2609 |
$(TOUCH) '$@'; \ |
| 2610 |
$(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ |
| 2611 |
else \ |
| 2612 |
$(CAT) [email protected]; \ |
| 2613 |
$(call remove-temporary-files,'[email protected]'); \ |
| 2614 |
$(sh_false); \ |
| 2615 |
fi |
| 2616 |
endif |
| 2617 |
|
| 2618 |
# Build the final target (dvi or pdf) file. This is a very tricky rule because |
| 2619 |
# of the way that latex runs multiple times, needs graphics after the first run |
| 2620 |
# (or maybe already has them), and relies on bibliographies or indices that may |
| 2621 |
# not exist. |
| 2622 |
# |
| 2623 |
# Check the log for fatal errors. If they exist, colorize and bail. |
| 2624 |
# |
| 2625 |
# Create the .auxtarget.cookie file. (Needed for next time if not present) |
| 2626 |
# |
| 2627 |
# If any of the following are true, we must rebuild at least one time: |
| 2628 |
# |
| 2629 |
# * the .bbl was recently rebuilt |
| 2630 |
# |
| 2631 |
# check a cookie, then delete it |
| 2632 |
# |
| 2633 |
# * any of several output files was created or changed: |
| 2634 |
# |
| 2635 |
# check $*.run.cookie, then delete it |
| 2636 |
# |
| 2637 |
# * the .aux file changed in a way that necessitates attention |
| 2638 |
# |
| 2639 |
# Note that if the .auxtarget.make file doesn't exist, this means |
| 2640 |
# that we are doing a clean build, so it doesn't figure into the |
| 2641 |
# test for running again. |
| 2642 |
# |
| 2643 |
# compare against .auxtarget.make |
| 2644 |
# |
| 2645 |
# move if different, remove if not |
| 2646 |
# |
| 2647 |
# * the .log file has errors or warnings requiring at least one more run |
| 2648 |
# |
| 2649 |
# We use a loop over a single item to simplify the process of breaking |
| 2650 |
# out when we find one of the conditions to be true. |
| 2651 |
# |
| 2652 |
# If we do NOT need to run latex here, then we move the [email protected] file |
| 2653 |
# over to $@ because the target file has already been built by the first |
| 2654 |
# dependency run and is valid. |
| 2655 |
# |
| 2656 |
# If we do, we delete that cookie file and do the normal multiple-runs |
| 2657 |
# routine. |
| 2658 |
# |
| 2659 |
ifeq "$(strip $(BUILD_STRATEGY))" "latex" |
| 2660 |
.SECONDARY: $(all_dvi_targets) |
| 2661 |
endif |
| 2662 |
%.$(build_target_extension): %.bbl %.aux %.$(build_target_extension).1st.make |
| 2663 |
$(QUIET)\ |
| 2664 |
fatal=`$(call colorize-latex-errors,$*.log)`; \ |
| 2665 |
if [ x"$$fatal" != x"" ]; then \ |
| 2666 |
$(ECHO) "$$fatal"; \ |
| 2667 |
exit 1; \ |
| 2668 |
fi; \ |
| 2669 |
$(call make-auxtarget-file,$*.aux.make,$*.auxtarget.cookie); \ |
| 2670 |
run=0; \ |
| 2671 |
for i in 1; do \ |
| 2672 |
if $(call test-exists,$*.bbl.cookie); then \ |
| 2673 |
run=1; \ |
| 2674 |
break; \ |
| 2675 |
fi; \ |
| 2676 |
if $(call test-exists,$*.run.cookie); then \ |
| 2677 |
run=1; \ |
| 2678 |
break; \ |
| 2679 |
fi; \ |
| 2680 |
if $(call \ |
| 2681 |
test-exists-and-different,$*.auxtarget.cookie,$*.auxtarget.make);\ |
| 2682 |
then \ |
| 2683 |
run=1; \ |
| 2684 |
break; \ |
| 2685 |
fi; \ |
| 2686 |
if $(call test-log-for-need-to-run,$*); then \ |
| 2687 |
run=1; \ |
| 2688 |
break; \ |
| 2689 |
fi; \ |
| 2690 |
if [ ! -e $*.1st.*.make ]; then \ |
| 2691 |
run=1; \ |
| 2692 |
break; \ |
| 2693 |
fi; \ |
| 2694 |
done; \ |
| 2695 |
$(call remove-temporary-files,$*.bbl.cookie $*.run.cookie); \ |
| 2696 |
$(MV) $*.auxtarget.cookie $*.auxtarget.make; \ |
| 2697 |
if [ x"$$run" = x"1" ]; then \ |
| 2698 |
$(call remove-files,[email protected]); \ |
| 2699 |
for i in 2 3 4 5; do \ |
| 2700 |
$(if $(findstring 3.79,$(MAKE_VERSION)),\ |
| 2701 |
$(call echo-build,$*.tex,$@,$(RESTARTS)-$$$$i),\ |
| 2702 |
$(call echo-build,$*.tex,$@,$(RESTARTS)-$$i)\ |
| 2703 |
); \ |
| 2704 |
$(call run-latex,$*); \ |
| 2705 |
$(CP) '$*.log' '$*.'$(RESTARTS)-$$i'.log'; \ |
| 2706 |
$(call test-run-again,$*) || break; \ |
| 2707 |
done; \ |
| 2708 |
else \ |
| 2709 |
$(MV) '[email protected]' '$@'; \ |
| 2710 |
fi; \ |
| 2711 |
$(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \ |
| 2712 |
$(call latex-color-log,$*) |
| 2713 |
|
| 2714 |
# Build the .bbl file. When dependencies are included, this will (or will |
| 2715 |
# not!) depend on something.bib, which we detect, acting accordingly. The |
| 2716 |
# dependency creation also produces the %.auxbbl.make file. BibTeX is a bit |
| 2717 |
# finicky about what you call the actual files, but we can rest assured that if |
| 2718 |
# a .auxbbl.make file exists, then the .aux file does, as well. The |
| 2719 |
# .auxbbl.make file is a cookie indicating whether the .bbl needs to be |
| 2720 |
# rewritten. It only changes if the .aux file changes in ways relevant to .bbl |
| 2721 |
# creation. |
| 2722 |
# |
| 2723 |
# Note that we do NOT touch the .bbl file if there is no need to |
| 2724 |
# create/recreate it. We would like to leave existing files alone if they |
| 2725 |
# don't need to be changed, thus possibly avoiding a rebuild trigger. |
| 2726 |
%.bbl: %.auxbbl.make |
| 2727 |
$(QUIET)\ |
| 2728 |
$(if $(filter %.bib,$^),\ |
| 2729 |
$(call echo-build,$(filter %.bib,$?) $*.aux,$@); \ |
| 2730 |
$(call run-bibtex,$*); \ |
| 2731 |
$(TOUCH) [email protected]; \ |
| 2732 |
) \ |
| 2733 |
if $(EGREP) -q 'bibstyle.(apacite|apacann|chcagoa|[^}]*annot)' '$*.aux'; then \ |
| 2734 |
$(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-1); \ |
| 2735 |
$(call run-latex,$*); \ |
| 2736 |
$(CP) '$*.log' '$*.$(RESTARTS)-annotated.log'; \ |
| 2737 |
$(if $(filter %.bib,$^),\ |
| 2738 |
$(call echo-build,** annotated extra bibtex ** $(filter %.bib,$?) $*.aux,$@); \ |
| 2739 |
$(call run-bibtex,$*); \ |
| 2740 |
$(TOUCH) [email protected]; \ |
| 2741 |
) \ |
| 2742 |
$(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-2); \ |
| 2743 |
$(call run-latex,$*); \ |
| 2744 |
fi |
| 2745 |
|
| 2746 |
# Create the index file - note that we do *not* depend on %.tex here, since |
| 2747 |
# that unnecessarily restricts the kinds of indices that we can build to those |
| 2748 |
# with exactly the same stem as the source file. Things like splitidx create |
| 2749 |
# idx files with other names. |
| 2750 |
# |
| 2751 |
# Therefore, we add the .tex dependency in the sourcestem.d file in the call to |
| 2752 |
# get index file dependencies from the logs. |
| 2753 |
%.ind: %.idx |
| 2754 |
$(QUIET)$(call echo-build,$<,$@) |
| 2755 |
$(QUIET)$(call run-makeindex,$<,$@,$*.ilg) |
| 2756 |
|
| 2757 |
# Create a glossary file from a .ist file |
| 2758 |
%.gls: %.glo %.tex %.ist |
| 2759 |
$(QUIET)$(call echo-build,$<,$@) |
| 2760 |
$(QUIET)$(call run-makeindex,$<,$@,$*.glg,$*.ist) |
| 2761 |
|
| 2762 |
# Create a glossary file from a glossary input formatted for xindy |
| 2763 |
%.gls: %.glo %.tex %.xdy |
| 2764 |
$(QUIET)$(call echo-build,$<,$@) |
| 2765 |
$(QUIET)$(call run-xindy,$<,$@,$*,$*.glg) |
| 2766 |
|
| 2767 |
# Create the glossary file from a nomenclature file |
| 2768 |
%.gls: %.glo %.tex nomencl.ist |
| 2769 |
$(QUIET)$(call echo-build,$<,$@) |
| 2770 |
$(QUIET)$(call run-makeindex,$<,$@,$*.glg,nomencl.ist) |
| 2771 |
|
| 2772 |
# Create the nomenclature file |
| 2773 |
%.nls: %.nlo %.tex nomencl.ist |
| 2774 |
$(QUIET)$(call echo-build,$<,$@) |
| 2775 |
$(QUIET)$(call run-makeindex,$<,$@,$*.nlg,nomencl.ist) |
| 2776 |
|
| 2777 |
# SCRIPTED LaTeX TARGETS |
| 2778 |
# |
| 2779 |
# Keep the generated .tex files around for debugging if needed. |
| 2780 |
.SECONDARY: $(all_tex_targets) |
| 2781 |
|
| 2782 |
%.tex:: %.tex.sh |
| 2783 |
$(QUIET)$(call run-script,$(SHELL),$<,$@) |
| 2784 |
|
| 2785 |
%.tex:: %.tex.py |
| 2786 |
$(QUIET)$(call run-script,$(PYTHON),$<,$@) |
| 2787 |
|
| 2788 |
%.tex:: %.tex.pl |
| 2789 |
$(QUIET)$(call run-script,$(PERL),$<,$@) |
| 2790 |
|
| 2791 |
%.tex:: %.rst $(RST_STYLE_FILE) |
| 2792 |
$(QUIET)\ |
| 2793 |
$(call run-script,$(RST2LATEX)\ |
| 2794 |
--documentoptions=letterpaper\ |
| 2795 |
$(if $(RST_STYLE_FILE),--stylesheet=$(RST_STYLE_FILE),),$<,$@) |
| 2796 |
|
| 2797 |
# |
| 2798 |
# GRAPHICS TARGETS |
| 2799 |
# |
| 2800 |
.PHONY: all-graphics |
| 2801 |
all-graphics: $(all_graphics_targets); |
| 2802 |
|
| 2803 |
ifeq "$(strip $(BUILD_STRATEGY))" "latex" |
| 2804 |
.PHONY: all-pstex |
| 2805 |
all-pstex: $(all_pstex_targets); |
| 2806 |
endif |
| 2807 |
|
| 2808 |
.PHONY: all-dot2tex |
| 2809 |
all-dot2tex: $(all_dot2tex_targets); |
| 2810 |
|
| 2811 |
.PHONY: show-graphics |
| 2812 |
show-graphics: all-graphics |
| 2813 |
$(VIEW_GRAPHICS) $(all_known_graphics) |
| 2814 |
|
| 2815 |
$(gray_eps_file): |
| 2816 |
$(QUIET)$(call echo-build,$^,$@) |
| 2817 |
$(QUIET)$(call create-gray-eps-file,$@) |
| 2818 |
|
| 2819 |
ifeq "$(strip $(BUILD_STRATEGY))" "pdflatex" |
| 2820 |
%.pdf: %.eps $(if $(GRAY),$(gray_eps_file)) |
| 2821 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2822 |
$(QUIET)$(call convert-eps-to-pdf,$<,$@,$(GRAY)) |
| 2823 |
|
| 2824 |
ifeq "$(strip $(GPI_OUTPUT_EXTENSION))" "pdf" |
| 2825 |
%.pdf: %.gpi %.gpi.d $(gpi_sed) $(gpi_global) |
| 2826 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2827 |
$(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) |
| 2828 |
endif |
| 2829 |
|
| 2830 |
%.pdf: %.fig |
| 2831 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2832 |
$(QUIET)$(call convert-fig,$<,$@,$(GRAY)) |
| 2833 |
|
| 2834 |
%.pdf: %.svg |
| 2835 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2836 |
$(QUIET)$(call convert-svg,$<,$@,$(GRAY)) |
| 2837 |
endif |
| 2838 |
|
| 2839 |
ifeq "$(strip $(BUILD_STRATEGY))" "xelatex" |
| 2840 |
%.pdf: %.eps $(if $(GRAY),$(gray_eps_file)) |
| 2841 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2842 |
$(QUIET)$(call convert-eps-to-pdf,$<,$@,$(GRAY)) |
| 2843 |
|
| 2844 |
ifeq "$(strip $(GPI_OUTPUT_EXTENSION))" "pdf" |
| 2845 |
%.pdf: %.gpi %.gpi.d $(gpi_sed) $(gpi_global) |
| 2846 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2847 |
$(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) |
| 2848 |
endif |
| 2849 |
|
| 2850 |
%.pdf: %.fig |
| 2851 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2852 |
$(QUIET)$(call convert-fig,$<,$@,$(GRAY)) |
| 2853 |
|
| 2854 |
endif |
| 2855 |
|
| 2856 |
|
| 2857 |
%.eps: %.gpi %.gpi.d $(gpi_sed) $(gpi_global) |
| 2858 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2859 |
$(QUIET)$(call convert-gpi,$<,$@,$(GRAY)) |
| 2860 |
|
| 2861 |
%.eps: %.fig |
| 2862 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2863 |
$(QUIET)$(call convert-fig,$<,$@,$(GRAY)) |
| 2864 |
|
| 2865 |
%.eps: %.dot $(if $(GRAY),$(gray_eps_file)) |
| 2866 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2867 |
$(QUIET)$(call convert-dot,$<,$@,$<.log,$(GRAY)) |
| 2868 |
|
| 2869 |
%.eps: %.xvg $(if $(GRAY),$(gray_eps_file)) |
| 2870 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2871 |
$(QUIET)$(call convert-xvg,$<,$@,$(GRAY)) |
| 2872 |
|
| 2873 |
ifneq "$(default_graphic_extension)" "pdf" |
| 2874 |
# We have a perfectly good build rule for svg to pdf, so we eliminate this to |
| 2875 |
# avoid confusing make (it sometimes chooses to go svg -> eps -> pdf). |
| 2876 |
%.eps: %.svg $(if $(GRAY),$(gray_eps_file)) |
| 2877 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2878 |
$(QUIET)$(call convert-svg,$<,$@,$(GRAY)) |
| 2879 |
|
| 2880 |
# Similarly for these, we don't need eps if we have supported extensions |
| 2881 |
# already. |
| 2882 |
%.eps: %.jpg $(if $(GRAY),$(gray_eps_file)) |
| 2883 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2884 |
$(QUIET)$(call convert-jpg,$<,$@,$(GRAY)) |
| 2885 |
|
| 2886 |
%.eps: %.jpeg $(if $(GRAY),$(gray_eps_file)) |
| 2887 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2888 |
$(QUIET)$(call convert-jpg,$<,$@,$(GRAY)) |
| 2889 |
|
| 2890 |
%.eps: %.png $(if $(GRAY),$(gray_eps_file)) |
| 2891 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2892 |
$(QUIET)$(call convert-png,$<,$@,$(GRAY)) |
| 2893 |
endif |
| 2894 |
|
| 2895 |
%.eps: %.eps.gz $(if $(GRAY),$(gray_eps_file)) |
| 2896 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2897 |
$(QUIET)$(call convert-epsgz,$<,$@,$(GRAY)) |
| 2898 |
|
| 2899 |
%.pstex: %.fig |
| 2900 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2901 |
$(QUIET)$(call convert-fig-pstex,$<,$@,$(GRAY)) |
| 2902 |
|
| 2903 |
%.pstex_t: %.fig %.pstex |
| 2904 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2905 |
$(QUIET)$(call convert-fig-pstex-t,$<,$@,$*.pstex,$(GRAY)) |
| 2906 |
|
| 2907 |
%.dot_t: %.dot |
| 2908 |
$(QUIET)$(call echo-graphic,$^,$@) |
| 2909 |
$(QUIET)$(call convert-dot-tex,$<,$@) |
| 2910 |
|
| 2911 |
# |
| 2912 |
# DEPENDENCY-RELATED TARGETS. |
| 2913 |
# |
| 2914 |
|
| 2915 |
# Generate all of the information needed to get dependencies |
| 2916 |
# As a side effect, this creates a .dvi or .pdf file (depending on the build |
| 2917 |
# strategy). We need to be sure to remove it if there are errors. Errors can |
| 2918 |
# take several forms and all of them are found within the log file: |
| 2919 |
# * There was a LaTeX error |
| 2920 |
# * A needed file was not found |
| 2921 |
# * Cross references need adjustment |
| 2922 |
# |
| 2923 |
# Behavior: |
| 2924 |
# This rule is responsible for generating the following: |
| 2925 |
# %.aux |
| 2926 |
# %.d |
| 2927 |
# %.aux.make |
| 2928 |
# %.(pdf|dvi).1st.make (the .pdf or .dvi output file, moved) |
| 2929 |
# |
| 2930 |
# Steps: |
| 2931 |
# |
| 2932 |
# Run latex |
| 2933 |
# Move .pdf or .dvi somewhere else (make no judgements about success) |
| 2934 |
# Flatten the .aux file into another file |
| 2935 |
# Add source dependencies |
| 2936 |
# Add graphic dependencies |
| 2937 |
# Add bib dependencies |
| 2938 |
# |
| 2939 |
# Create cookies for various suffixes that may represent files that |
| 2940 |
# need to be read by LaTeX in order for it to function properly. |
| 2941 |
# |
| 2942 |
# Note that if some of the dependencies are discovered because they turn |
| 2943 |
# up missing in the log file, we really need the .d file to be reloaded. |
| 2944 |
# Adding a sleep command helps with this. Otherwise make is extremely |
| 2945 |
# nondeterministic, sometimes working, sometimes not. |
| 2946 |
# |
| 2947 |
# Usually we can force this by simply removing the generated pdf file and |
| 2948 |
# not creating a .1st.make file.. |
| 2949 |
# |
| 2950 |
%.$(build_target_extension).1st.make %.d %.aux %.aux.make %.fls: %.tex |
| 2951 |
$(QUIET)$(call echo-build,$<,$*.d $*.$(build_target_extension).1st.make,$(RESTARTS)-1) |
| 2952 |
$(QUIET)\ |
| 2953 |
$(call run-latex,$<,-recorder) || $(sh_true); \ |
| 2954 |
$(CP) '$*.log' '$*.$(RESTARTS)-1.log'; \ |
| 2955 |
$(call die-on-import-sty,$*.log); \ |
| 2956 |
$(call die-on-dot2tex,$*.log); \ |
| 2957 |
$(call die-on-no-aux,$*); \ |
| 2958 |
$(call flatten-aux,$*.aux,$*.aux.make); \ |
| 2959 |
$(ECHO) "# vim: ft=make" > $*.d; \ |
| 2960 |
$(ECHO) ".PHONY: $*._graphics" >> $*.d; \ |
| 2961 |
$(call get-inputs,$*.fls,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \ |
| 2962 |
$(call get-missing-inputs,$*.log,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \ |
| 2963 |
$(ECHO) ".SECONDEXPANSION:" >> $*.d; \ |
| 2964 |
$(call get-graphics,$*) >> $*.d; \ |
| 2965 |
$(call get-log-index,$*,$(addprefix $*.,aux aux.make)) >> $*.d; \ |
| 2966 |
$(call get-bibs,$*.aux.make,$(addprefix $*.,bbl aux aux.make)) >> $*.d; \ |
| 2967 |
$(EGREP) -q "# MISSING" $*.d && $(SLEEP) 1 && $(RM) $*.pdf; \ |
| 2968 |
$(call move-if-exists,$*.$(build_target_extension),$*.$(build_target_extension).1st.make); \ |
| 2969 |
for s in toc out lot lof lol nav; do \ |
| 2970 |
if [ -e "$*.$$s" ]; then \ |
| 2971 |
if ! $(DIFF) -q $*.$$s $*.$$s.make >/dev/null 2>&1; then \ |
| 2972 |
$(TOUCH) $*.run.cookie; \ |
| 2973 |
fi; \ |
| 2974 |
$(CP) $*.$$s $*.$$s.make; \ |
| 2975 |
fi; \ |
| 2976 |
done |
| 2977 |
|
| 2978 |
# This is a cookie that is updated if the flattened aux file has changed in a |
| 2979 |
# way that affects the bibliography generation. |
| 2980 |
.SECONDARY: $(addsuffix .auxbbl.make,$(stems_ssg)) |
| 2981 |
%.auxbbl.make: %.aux.make |
| 2982 |
$(QUIET)\ |
| 2983 |
$(call make-auxbbl-file,$<,[email protected]); \ |
| 2984 |
$(call replace-if-different-and-remove,[email protected],$@) |
| 2985 |
|
| 2986 |
# Build a dependency file for .gpi files. These often plot data files that |
| 2987 |
# also reside in the directory, so if a data file changes, it's nice to know |
| 2988 |
# about it. This also handles loaded .gpi files, whose filename should have |
| 2989 |
# _include_. in it. |
| 2990 |
%.gpi.d: %.gpi |
| 2991 |
$(QUIET)$(call echo-build,$<,$@) |
| 2992 |
$(QUIET)$(call make-gpi-d,$<,$@) |
| 2993 |
|
| 2994 |
# Store the paper size for this document -- note that if beamer is used we set |
| 2995 |
# it to the special BEAMER paper size. We only do this, however, if the |
| 2996 |
# special comment exists, in which case we enlarge the output with psnup. |
| 2997 |
# |
| 2998 |
# The paper size is extracted from a documentclass attribute. |
| 2999 |
%.paper.make: %.tex |
| 3000 |
$(QUIET)$(SED) \ |
| 3001 |
-e '/\\documentclass/,/}/{' \ |
| 3002 |
-e ' s/%.*//' \ |
| 3003 |
-e ' H' \ |
| 3004 |
-e ' /}/{' \ |
| 3005 |
-e ' s/.*//' \ |
| 3006 |
-e ' x' \ |
| 3007 |
-e ' /\\documentclass/!d' \ |
| 3008 |
-e ' s/[\n[:space:]]*//g' \ |
| 3009 |
-e ' s/\([,{[]\)\([[:alnum:]]\{1,\}\)paper\([],}]\)/\1%-\2-%\3/g' \ |
| 3010 |
-e ' s/\([,{[]\)\(landscape\)\([],}]\)/\1%-\2-%\3/g' \ |
| 3011 |
-e ' s/^[^%]*%-//' \ |
| 3012 |
-e ' s/-%[^%]*$$//' \ |
| 3013 |
-e ' s/-%[^%]%-/ /g' \ |
| 3014 |
-e ' p' \ |
| 3015 |
-e ' }' \ |
| 3016 |
-e ' d' \ |
| 3017 |
-e '}' \ |
| 3018 |
-e 'd' \ |
| 3019 |
$< > $@; \ |
| 3020 |
$(EGREP) -q '^[^%]*\\documentclass[^{]*{beamer}' $< && \ |
| 3021 |
(\ |
| 3022 |
$(EGREP) -q '^%%[[:space:]]*BEAMER[[:space:]]*LARGE$$' $< && \ |
| 3023 |
$(ECHO) "BEAMER" > $@ || \ |
| 3024 |
: > $@ \ |
| 3025 |
) || $(sh_true) |
| 3026 |
|
| 3027 |
# Store embedding instructions for this document using a special comment |
| 3028 |
%.embed.make: %.tex |
| 3029 |
$(QUIET)$(EGREP) '^%%[[:space:]]*NO[[:space:]]*EMBED[[:space:]]*$$' $< \ |
| 3030 |
&& $(ECHO) '' > $@ \ |
| 3031 |
|| $(ECHO) '1' > $@; |
| 3032 |
|
| 3033 |
# |
| 3034 |
# HELPFUL PHONY TARGETS |
| 3035 |
# |
| 3036 |
|
| 3037 |
.PHONY: _all_programs |
| 3038 |
_all_programs: |
| 3039 |
$(QUIET)$(ECHO) "== All External Programs Used ==" |
| 3040 |
$(QUIET)$(call output-all-programs) |
| 3041 |
|
| 3042 |
.PHONY: _check_programs |
| 3043 |
_check_programs: |
| 3044 |
$(QUIET)$(ECHO) "== Checking Makefile Dependencies =="; $(ECHO) |
| 3045 |
$(QUIET) \ |
| 3046 |
allprogs=`\ |
| 3047 |
($(call output-all-programs)) | \ |
| 3048 |
$(SED) \ |
| 3049 |
-e 's/^[[:space:]]*//' \ |
| 3050 |
-e '/^#/d' \ |
| 3051 |
-e 's/[[:space:]]*#.*//' \ |
| 3052 |
-e '/^=/s/[[:space:]]/_/g' \ |
| 3053 |
-e '/^[[:space:]]*$$/d' \ |
| 3054 |
-e 's/^[^=].*=[[:space:]]*\([^[:space:]]\{1,\}\).*$$/\\1/' \ |
| 3055 |
`; \ |
| 3056 |
spaces=' '; \ |
| 3057 |
for p in $${allprogs}; do \ |
| 3058 |
case $$p in \ |
| 3059 |
=*) $(ECHO); $(ECHO) "$$p";; \ |
| 3060 |
*) \ |
| 3061 |
$(ECHO) -n "$$p:$$spaces" | $(SED) -e 's/^\(.\{0,20\}\).*$$/\1/'; \ |
| 3062 |
loc=`$(WHICH) $$p`; \ |
| 3063 |
if [ x"$$?" = x"0" ]; then \ |
| 3064 |
$(ECHO) "$(C_SUCCESS)Found:$(C_RESET) $$loc"; \ |
| 3065 |
else \ |
| 3066 |
$(ECHO) "$(C_FAILURE)Not Found$(C_RESET)"; \ |
| 3067 |
fi; \ |
| 3068 |
;; \ |
| 3069 |
esac; \ |
| 3070 |
done |
| 3071 |
|
| 3072 |
.PHONY: _check_gpi_files |
| 3073 |
_check_gpi_files: |
| 3074 |
$(QUIET)$(ECHO) "== Checking all .gpi files for common errors =="; \ |
| 3075 |
$(ECHO); \ |
| 3076 |
for f in $(files.gpi); do \ |
| 3077 |
result=`$(EGREP) '^([^#]*set terminal |set output )' $$f`; \ |
| 3078 |
$(ECHO) -n "$$f: "; \ |
| 3079 |
if [ x"$$result" = x"" ]; then \ |
| 3080 |
$(ECHO) "$(C_SUCCESS)Okay$(C_RESET)"; \ |
| 3081 |
else \ |
| 3082 |
$(ECHO) "$(C_FAILURE)Warning: Problematic commands:$(C_RESET)";\ |
| 3083 |
$(ECHO) "$(C_ERROR)$$result$(C_RESET)"; \ |
| 3084 |
fi; \ |
| 3085 |
done; \ |
| 3086 |
$(ECHO) |
| 3087 |
|
| 3088 |
.PHONY: _all_stems |
| 3089 |
_all_stems: |
| 3090 |
$(QUIET)$(ECHO) "== All Stems ==" |
| 3091 |
$(QUIET)$(call echo-list,$(sort $(default_stems_ss))) |
| 3092 |
|
| 3093 |
.PHONY: _includes |
| 3094 |
_includes: |
| 3095 |
$(QUIET)$(ECHO) "== Include Stems ==" |
| 3096 |
$(QUIET)$(ECHO) "=== Sources ===" |
| 3097 |
$(QUIET)$(call echo-list,$(sort $(source_includes))) |
| 3098 |
$(QUIET)$(ECHO) "=== Graphics ===" |
| 3099 |
$(QUIET)$(call echo-list,$(sort $(graphic_includes))) |
| 3100 |
|
| 3101 |
.PHONY: _all_sources |
| 3102 |
_all_sources: |
| 3103 |
$(QUIET)$(ECHO) "== All Sources ==" |
| 3104 |
$(QUIET)$(call echo-list,$(sort $(all_files.tex))) |
| 3105 |
|
| 3106 |
.PHONY: _dependency_graph |
| 3107 |
_dependency_graph: |
| 3108 |
$(QUIET)$(ECHO) "/* LaTeX Dependency Graph */" |
| 3109 |
$(QUIET)$(call output-dependency-graph) |
| 3110 |
|
| 3111 |
.PHONY: _show_dependency_graph |
| 3112 |
_show_dependency_graph: |
| 3113 |
$(QUIET)$(call output-dependency-graph,$(graph_stem).dot) |
| 3114 |
$(QUIET)$(DOT) -Tps -o $(graph_stem).eps $(graph_stem).dot |
| 3115 |
$(QUIET)$(VIEW_POSTSCRIPT) $(graph_stem).eps |
| 3116 |
$(QUIET)$(call remove-temporary-files,$(graph_stem).*) |
| 3117 |
|
| 3118 |
.PHONY: _sources |
| 3119 |
_sources: |
| 3120 |
$(QUIET)$(ECHO) "== Sources ==" |
| 3121 |
$(QUIET)$(call echo-list,$(sort $(files.tex))) |
| 3122 |
|
| 3123 |
.PHONY: _scripts |
| 3124 |
_scripts: |
| 3125 |
$(QUIET)$(ECHO) "== Scripts ==" |
| 3126 |
$(QUIET)$(call echo-list,$(sort $(files_scripts))) |
| 3127 |
|
| 3128 |
.PHONY: _graphic_outputs |
| 3129 |
_graphic_outputs: |
| 3130 |
$(QUIET)$(ECHO) "== Graphic Outputs ==" |
| 3131 |
$(QUIET)$(call echo-list,$(sort $(all_graphics_targets))) |
| 3132 |
|
| 3133 |
.PHONY: _env |
| 3134 |
_env: |
| 3135 |
ifdef .VARIABLES |
| 3136 |
$(QUIET)$(ECHO) "== MAKE VARIABLES ==" |
| 3137 |
$(QUIET)$(call echo-list,$(foreach var,$(sort $(.VARIABLES)),'$(var)')) |
| 3138 |
endif |
| 3139 |
$(QUIET)$(ECHO) "== ENVIRONMENT ==" |
| 3140 |
$(QUIET)$(ENV) |
| 3141 |
|
| 3142 |
# |
| 3143 |
# CLEAN TARGETS |
| 3144 |
# |
| 3145 |
# clean-generated is somewhat unique - it relies on the .fls file being |
| 3146 |
# properly built so that it can determine which of the files was generated, and |
| 3147 |
# which was not. Expect it to silently fail if the .fls file is missing. |
| 3148 |
# |
| 3149 |
# This is used to, e.g., clean up index files that are generated by the LaTeX. |
| 3150 |
.PHONY: clean-generated |
| 3151 |
clean-generated: |
| 3152 |
$(QUIET)$(call clean-files,$(foreach e,$(addsuffix .fls,$(all_stems_source)),\ |
| 3153 |
$(shell $(call get-generated-names,$e)))) |
| 3154 |
|
| 3155 |
.PHONY: clean-deps |
| 3156 |
clean-deps: |
| 3157 |
$(QUIET)$(call clean-files,$(all_d_targets) *.make *.make.temp *.cookie) |
| 3158 |
|
| 3159 |
.PHONY: clean-tex |
| 3160 |
clean-tex: clean-deps |
| 3161 |
$(QUIET)$(call clean-files,$(rm_tex)) |
| 3162 |
|
| 3163 |
.PHONY: clean-graphics |
| 3164 |
# TODO: This *always* deletes pstex files, even if they were not generated by |
| 3165 |
# anything.... In other words, if you create a pstex and pstex_t pair by hand |
| 3166 |
# an drop them in here without the generating fig file, they will be deleted |
| 3167 |
# and you won't get them back. It's a hack put in here because I'm not sure we |
| 3168 |
# even want to keep pstex functionality, so my motivation is not terribly high |
| 3169 |
# for doing it right. |
| 3170 |
clean-graphics: |
| 3171 |
$(QUIET)$(call clean-files,$(all_graphics_targets) *.gpi.d *.pstex *.pstex_t *.dot_t) |
| 3172 |
|
| 3173 |
.PHONY: clean-backups |
| 3174 |
clean-backups: |
| 3175 |
$(QUIET)$(call clean-files,$(backup_patterns) *.temp) |
| 3176 |
|
| 3177 |
.PHONY: clean-auxiliary |
| 3178 |
clean-auxiliary: |
| 3179 |
$(QUIET)$(call clean-files,$(graph_stem).*) |
| 3180 |
|
| 3181 |
.PHONY: clean-nographics |
| 3182 |
clean-nographics: clean-tex clean-deps clean-backups clean-auxiliary ; |
| 3183 |
|
| 3184 |
.PHONY: clean |
| 3185 |
clean: clean-generated clean-tex clean-graphics clean-deps clean-backups clean-auxiliary ; |
| 3186 |
|
| 3187 |
# |
| 3188 |
# HELP TARGETS |
| 3189 |
# |
| 3190 |
|
| 3191 |
.PHONY: help |
| 3192 |
help: |
| 3193 |
$(help_text) |
| 3194 |
|
| 3195 |
.PHONY: version |
| 3196 |
version: |
| 3197 |
$(QUIET)\ |
| 3198 |
$(ECHO) "$(fileinfo) Version $(version)"; \ |
| 3199 |
$(ECHO) "by $(author)"; \ |
| 3200 |
|
| 3201 |
# |
| 3202 |
# HELP TEXT |
| 3203 |
# |
| 3204 |
|
| 3205 |
define help_text |
| 3206 |
# $(fileinfo) Version $(version) |
| 3207 |
# |
| 3208 |
# by $(author) |
| 3209 |
# |
| 3210 |
# Generates a number of possible output files from a LaTeX document and its |
| 3211 |
# various dependencies. Handles .bib files, \include and \input, and .eps |
| 3212 |
# graphics. All dependencies are handled automatically by running LaTeX over |
| 3213 |
# the source. |
| 3214 |
# |
| 3215 |
# USAGE: |
| 3216 |
# |
| 3217 |
# make [GRAY=1] [VERBOSE=1] [SHELL_DEBUG=1] <target(s)> |
| 3218 |
# |
| 3219 |
# STANDARD OPTIONS: |
| 3220 |
# GRAY: |
| 3221 |
# Setting this variable forces all recompiled graphics to be grayscale. |
| 3222 |
# It is useful when creating a document for printing. The default is |
| 3223 |
# to allow colors. Note that it only changes graphics that need to be |
| 3224 |
# rebuilt! It is usually a good idea to do a 'make clean' first. |
| 3225 |
# |
| 3226 |
# VERBOSE: |
| 3227 |
# This turns off all @ prefixes for commands invoked by make. Thus, |
| 3228 |
# you get to see all of the gory details of what is going on. |
| 3229 |
# |
| 3230 |
# SHELL_DEBUG: |
| 3231 |
# This enables the -x option for sh, meaning that everything it does is |
| 3232 |
# echoed to stderr. This is particularly useful for debugging |
| 3233 |
# what is going on in $$(shell ...) invocations. One of my favorite |
| 3234 |
# debugging tricks is to do this: |
| 3235 |
# |
| 3236 |
# make -d SHELL_DEBUG=1 VERBOSE=1 2>&1 | less |
| 3237 |
# |
| 3238 |
# KEEP_TEMP: |
| 3239 |
# When set, this allows .make and other temporary files to stick around |
| 3240 |
# long enough to do some debugging. This can be useful when trying to |
| 3241 |
# figure out why gnuplot is not doing the right things, for example |
| 3242 |
# (e.g., look for *head.make). |
| 3243 |
# |
| 3244 |
# STANDARD AUXILIARY FILES: |
| 3245 |
# |
| 3246 |
# Variables.ini (formerly Makefile.ini, which still works) |
| 3247 |
# |
| 3248 |
# This file can contain variable declarations that override various |
| 3249 |
# aspects of the makefile. For example, one might specify |
| 3250 |
# |
| 3251 |
# neverclean := *.pdf *.ps |
| 3252 |
# onlysources.tex := main.tex |
| 3253 |
# LATEX_COLOR_WARNING := 'bold red uline' |
| 3254 |
# |
| 3255 |
# And this would override the neverclean setting to ensure that pdf |
| 3256 |
# and ps files always remain behind, set the makefile to treat all |
| 3257 |
# .tex files that are not "main.tex" as includes (and therefore not |
| 3258 |
# default targets). It also changes the LaTeX warning output to be |
| 3259 |
# red, bold, and underlined. |
| 3260 |
# |
| 3261 |
# There are numerous variables in this file that can be overridden in |
| 3262 |
# this way. Search for '?=' to find them all. |
| 3263 |
# |
| 3264 |
# The Variables.ini is imported before *anything else* is done, so go |
| 3265 |
# wild with your ideas for changes to this makefile in there. It |
| 3266 |
# makes it easy to test them before submitting patches. |
| 3267 |
# |
| 3268 |
# If you're adding rules or targets, however, see Targets.ini below. |
| 3269 |
# |
| 3270 |
# Targets.ini |
| 3271 |
# |
| 3272 |
# This is included much later in the makefile, after all variables and |
| 3273 |
# targets are defined. This is where you would put new make rules, |
| 3274 |
# e.g., |
| 3275 |
# |
| 3276 |
# generated.tex: generating_script.weird_lang depA depB |
| 3277 |
# ./generating_script.weird_lang > $$@ |
| 3278 |
# |
| 3279 |
# In this file, you have access to all of the variables that the |
| 3280 |
# makefile creates, like $(onlysources.tex). While accessing those can |
| 3281 |
# be somewhat brittle (they are implementation details and may change), |
| 3282 |
# it is a great way to test your ideas when submitting feature requests. |
| 3283 |
# |
| 3284 |
# STANDARD ENVIRONMENT VARIABLES: |
| 3285 |
# |
| 3286 |
# LATEX_COLOR_WARNING '$(LATEX_COLOR_WARNING)' |
| 3287 |
# LATEX_COLOR_ERROR '$(LATEX_COLOR_ERROR)' |
| 3288 |
# LATEX_COLOR_UNDERFULL '$(LATEX_COLOR_UNDERFULL)' |
| 3289 |
# LATEX_COLOR_OVERFULL '$(LATEX_COLOR_OVERFULL)' |
| 3290 |
# LATEX_COLOR_PAGES '$(LATEX_COLOR_PAGES)' |
| 3291 |
# LATEX_COLOR_BUILD '$(LATEX_COLOR_BUILD)' |
| 3292 |
# LATEX_COLOR_GRAPHIC '$(LATEX_COLOR_GRAPHIC)' |
| 3293 |
# LATEX_COLOR_DEP '$(LATEX_COLOR_DEP)' |
| 3294 |
# LATEX_COLOR_SUCCESS '$(LATEX_COLOR_SUCCESS)' |
| 3295 |
# LATEX_COLOR_FAILURE '$(LATEX_COLOR_FAILURE)' |
| 3296 |
# |
| 3297 |
# These may be redefined in your environment to be any of the following: |
| 3298 |
# |
| 3299 |
# black |
| 3300 |
# red |
| 3301 |
# green |
| 3302 |
# yellow |
| 3303 |
# blue |
| 3304 |
# magenta |
| 3305 |
# cyan |
| 3306 |
# white |
| 3307 |
# |
| 3308 |
# Bold or underline may be used, as well, either alone or in combination |
| 3309 |
# with colors: |
| 3310 |
# |
| 3311 |
# bold |
| 3312 |
# uline |
| 3313 |
# |
| 3314 |
# Order is not important. You may want, for example, to specify: |
| 3315 |
# |
| 3316 |
# export LATEX_COLOR_SUCCESS='bold blue uline' |
| 3317 |
# |
| 3318 |
# in your .bashrc file. I don't know why, but you may want to. |
| 3319 |
# |
| 3320 |
# STANDARD TARGETS: |
| 3321 |
# |
| 3322 |
# all: |
| 3323 |
# Make all possible documents in this directory. The documents are |
| 3324 |
# determined by scanning for .tex and .tex.sh (described in more detail |
| 3325 |
# later) and omitting any file that ends in ._include_.tex or |
| 3326 |
# ._nobuild_.tex. The output is a set of .pdf files. |
| 3327 |
# |
| 3328 |
# If you wish to omit files without naming them with the special |
| 3329 |
# underscore names, set the following near the top of the Makefile, |
| 3330 |
# or (this is recommended) within a Makefile.ini in the same directory: |
| 3331 |
# |
| 3332 |
# includes.tex := file1.tex file2.tex |
| 3333 |
# |
| 3334 |
# This will cause the files listed to be considered as include files. |
| 3335 |
# |
| 3336 |
# If you have only few source files, you can set |
| 3337 |
# |
| 3338 |
# onlysources.tex := main.tex |
| 3339 |
# |
| 3340 |
# This will cause only the source files listed to be considered in |
| 3341 |
# dependency detection. All other .tex files will be considered as |
| 3342 |
# include files. Note that these options work for *any* source type, |
| 3343 |
# so you could do something similar with includes.gpi, for example. |
| 3344 |
# Note that this works for *any valid source* target. All of the |
| 3345 |
# onlysources.* variables are commented out in the shipping version of |
| 3346 |
# this file, so it does the right thing when they simply don't exist. |
| 3347 |
# The comments are purely documentation. If you know, for example, that |
| 3348 |
# file.mycoolformat is supported by this Makefile, but don't see the |
| 3349 |
# "onlysources.mycoolformat" declared in the comments, that doesn't mean |
| 3350 |
# you can't use it. Go ahead and set "onlysources.mycoolformat" and it |
| 3351 |
# should do the right thing. |
| 3352 |
# |
| 3353 |
# show: |
| 3354 |
# Builds and displays all documents in this directory. It uses the |
| 3355 |
# environment-overridable value of VIEW_PDF (currently $(VIEW_PDF)) to |
| 3356 |
# do its work. |
| 3357 |
# |
| 3358 |
# all-graphics: |
| 3359 |
# Make all of the graphics in this directory. |
| 3360 |
# |
| 3361 |
# all-pstex (only for BUILD_STRATEGY=latex): |
| 3362 |
# Build all fig files into pstex and pstex_t files. Gray DOES NOT WORK. |
| 3363 |
# |
| 3364 |
# all-gray-pstex (only for BUILD_STRATEGY=latex): |
| 3365 |
# Build all fig files into grayscale pstex and pstex_t files. |
| 3366 |
# |
| 3367 |
# all-dot2tex: |
| 3368 |
# Build all dot files into tex files. |
| 3369 |
# |
| 3370 |
# show-graphics: |
| 3371 |
# Builds and displays all graphics in this directory. Uses the |
| 3372 |
# environment-overridable value of VIEW_GRAPHICS (currently |
| 3373 |
# $(VIEW_GRAPHICS)) to do its work. |
| 3374 |
# |
| 3375 |
# clean: |
| 3376 |
# Remove ALL generated files, leaving only source intact. |
| 3377 |
# This will *always* skip files mentioned in the "neverclean" variable, |
| 3378 |
# either in this file or specified in Makefile.ini: |
| 3379 |
# |
| 3380 |
# neverclean := *.pdf *.ps |
| 3381 |
# |
| 3382 |
# The neverclean variable works on all "clean" targets below, as well. |
| 3383 |
# |
| 3384 |
# clean-graphics: |
| 3385 |
# Remove all generated graphics files. |
| 3386 |
# |
| 3387 |
# clean-backups: |
| 3388 |
# Remove all backup files: $(backup_patterns) |
| 3389 |
# (XFig and other editors have a nasty habit of leaving them around) |
| 3390 |
# Also removes Makefile-generated .temp files |
| 3391 |
# |
| 3392 |
# clean-tex: |
| 3393 |
# Remove all files generated from LaTeX invocations except dependency |
| 3394 |
# information. Leaves graphics alone. |
| 3395 |
# |
| 3396 |
# clean-deps: |
| 3397 |
# Removes all auto-generated dependency information. |
| 3398 |
# |
| 3399 |
# clean-auxiliary: |
| 3400 |
# Removes extra files created by various targets (like the dependency |
| 3401 |
# graph output). |
| 3402 |
# |
| 3403 |
# clean-nographics: |
| 3404 |
# Cleans everything *except* the graphics files. |
| 3405 |
# |
| 3406 |
# help: |
| 3407 |
# This help text. |
| 3408 |
# |
| 3409 |
# version: |
| 3410 |
# Version information about this LaTeX makefile. |
| 3411 |
# |
| 3412 |
# DEBUG TARGETS: |
| 3413 |
# |
| 3414 |
# _all_programs: |
| 3415 |
# A list of the programs used by this makefile. |
| 3416 |
# |
| 3417 |
# _check_programs: |
| 3418 |
# Checks your system for the needed software and reports what it finds. |
| 3419 |
# |
| 3420 |
# _check_gpi_files: |
| 3421 |
# Checks the .gpi files in the current directory for common errors, such |
| 3422 |
# as specification of the terminal or output file inside of the gpi file |
| 3423 |
# itself. |
| 3424 |
# |
| 3425 |
# _dependency_graph: |
| 3426 |
# Outputs a .dot file to stdout that represents a graph of LaTeX |
| 3427 |
# dependencies. To see it, use the _show_dependency_graph target or |
| 3428 |
# direct the output to a file, run dot on it, and view the output, e.g.: |
| 3429 |
# |
| 3430 |
# make _dependency_graph > graph.dot |
| 3431 |
# dot -T ps -o graph.eps graph.dot |
| 3432 |
# gv graph.eps |
| 3433 |
# |
| 3434 |
# _show_dependency_graph: |
| 3435 |
# Makes viewing the graph simple: extracts, builds and displays the |
| 3436 |
# dependency graph given in the _dependency_graph target using the value |
| 3437 |
# of the environment-overridable VIEW_POSTSCRIPT variable (currently set |
| 3438 |
# to $(VIEW_POSTSCRIPT)). The postscript viewer is used because it |
| 3439 |
# makes it easier to zoom in on the graph, a critical ability for |
| 3440 |
# something so dense and mysterious. |
| 3441 |
# |
| 3442 |
# _all_sources: |
| 3443 |
# List all .tex files in this directory. |
| 3444 |
# |
| 3445 |
# _sources: |
| 3446 |
# Print out a list of all compilable sources in this directory. This is |
| 3447 |
# useful for determining what make thinks it will be using as the |
| 3448 |
# primary source for 'make all'. |
| 3449 |
# |
| 3450 |
# _scripts: |
| 3451 |
# Print out a list of scripts that make knows can be used to generate |
| 3452 |
# .tex files (described later). |
| 3453 |
# |
| 3454 |
# _all_stems: |
| 3455 |
# Print a list of stems. These represent bare targets that can be |
| 3456 |
# executed. Listing <stem> as a bare target will produce <stem>.pdf. |
| 3457 |
# |
| 3458 |
# _includes: |
| 3459 |
# A list of .d files that would be included in this run if _includes |
| 3460 |
# weren't specified. This target may be used alone or in conjunction |
| 3461 |
# with other targets. |
| 3462 |
# |
| 3463 |
# _graphic_outputs: |
| 3464 |
# A list of all generated .eps files |
| 3465 |
# |
| 3466 |
# _env: |
| 3467 |
# A list of environment variables and their values. If supported by |
| 3468 |
# your version of make, also a list of variables known to make. |
| 3469 |
# |
| 3470 |
# FILE TARGETS: |
| 3471 |
# |
| 3472 |
# %, %.pdf: |
| 3473 |
# Build a PDF file from the corresponding %.tex file. |
| 3474 |
# |
| 3475 |
# If BUILD_STRATEGY=pdflatex, then this builds the pdf directly. |
| 3476 |
# Otherwise, it uses this old-school but effective approach: |
| 3477 |
# |
| 3478 |
# latex -> dvips -> ps2pdf |
| 3479 |
# |
| 3480 |
# The BUILD_STRATEGY can be overridden in Makefile.ini in the same |
| 3481 |
# directory. The default is pdflatex. |
| 3482 |
# |
| 3483 |
# Reasons for using latex -> dvips include the "psfrag" package, and the |
| 3484 |
# generation of postscript instead of PDF. Arguments for using pdflatex |
| 3485 |
# include "new and shiny" and "better supported." I can't argue with |
| 3486 |
# either of those, and supporting them both didn't turn out to be that |
| 3487 |
# difficult, so there you have it. Choices. |
| 3488 |
# |
| 3489 |
# %._show: |
| 3490 |
# A phony target that builds the pdf file and then displays it using the |
| 3491 |
# environment-overridable value of VIEW_PDF ($(VIEW_PDF)). |
| 3492 |
# |
| 3493 |
# %._graphics: |
| 3494 |
# A phony target that generates all graphics on which %.pdf (or %.dvi) |
| 3495 |
# depends. |
| 3496 |
# |
| 3497 |
# %.ps (only for BUILD_STRATEGY=latex): |
| 3498 |
# Build a Postscript file from the corresponding %.tex file. |
| 3499 |
# This is done using dvips. Paper size is automatically |
| 3500 |
# extracted from the declaration |
| 3501 |
# |
| 3502 |
# \documentclass[<something>paper] |
| 3503 |
# |
| 3504 |
# or it is the system default. |
| 3505 |
# |
| 3506 |
# If using beamer (an excellent presentation class), the paper |
| 3507 |
# size is ignored. More on this later. |
| 3508 |
# |
| 3509 |
# %.dvi (only for BUILD_STRATEGY=latex): |
| 3510 |
# Build the DVI file from the corresponding %.tex file. |
| 3511 |
# |
| 3512 |
# %.ind: |
| 3513 |
# Build the index for this %.tex file. |
| 3514 |
# |
| 3515 |
# %.gls: |
| 3516 |
# Build the nomenclature glossary for this %.tex file. |
| 3517 |
# |
| 3518 |
# %.nls: |
| 3519 |
# Build the (newer) nomenclature file for this %.tex file. |
| 3520 |
# |
| 3521 |
# %.eps: |
| 3522 |
# Build an eps file from one of the following file types: |
| 3523 |
# |
| 3524 |
# .dot : graphviz |
| 3525 |
# .gpi : gnuplot |
| 3526 |
# .fig : xfig |
| 3527 |
# .xvg : xmgrace |
| 3528 |
# .svg : scalable vector graphics (goes through inkscape) |
| 3529 |
# .png : png (goes through NetPBM) |
| 3530 |
# .jpg : jpeg (goes through ImageMagick) |
| 3531 |
# .eps.gz : gzipped eps |
| 3532 |
# |
| 3533 |
# The behavior of this makefile with each type is described in |
| 3534 |
# its own section below. |
| 3535 |
# |
| 3536 |
# %.pstex{,_t} (only for BUILD_STRATEGY=latex): |
| 3537 |
# Build a .pstex_t file from a .fig file. |
| 3538 |
# |
| 3539 |
# FEATURES: |
| 3540 |
# |
| 3541 |
# Optional Binary Directory: |
| 3542 |
# If you create the _out_ directory in the same place as the makefile, |
| 3543 |
# it will automatically be used as a dumping ground for .pdf (or .dvi, |
| 3544 |
# .ps, and .pdf) output files. |
| 3545 |
# |
| 3546 |
# Alternatively, you can set the BINARY_TARGET_DIR variable, either as a |
| 3547 |
# make argument or in Makefile.ini, to point to your directory of |
| 3548 |
# choice. Note that no pathname wildcard expansion is done in the |
| 3549 |
# makefile, so make sure that the path is complete before going in |
| 3550 |
# there. E.g., if you want to specify something in your home directory, |
| 3551 |
# use $$HOME/ instead of ~/ so that the shell expands it before it gets |
| 3552 |
# to the makefile. |
| 3553 |
# |
| 3554 |
# External Program Dependencies: |
| 3555 |
# Every external program used by the makefile is represented by an |
| 3556 |
# ALLCAPS variable at the top of this file. This should allow you to |
| 3557 |
# make judgments about whether your system supports the use of this |
| 3558 |
# makefile. The list is available in the ALL_PROGRAMS variable and, |
| 3559 |
# provided that you are using GNU make 3.80 or later (or you haven't |
| 3560 |
# renamed this file to something weird like "mylatexmakefile" and like |
| 3561 |
# invoking it with make -f) can be viewed using |
| 3562 |
# |
| 3563 |
# make _all_programs |
| 3564 |
# |
| 3565 |
# Additionally, the availability of these programs can be checked |
| 3566 |
# automatically for you by running |
| 3567 |
# |
| 3568 |
# make _check_programs |
| 3569 |
# |
| 3570 |
# The programs are categorized according to how important they are and |
| 3571 |
# what function they perform to help you decide which ones you really |
| 3572 |
# need. |
| 3573 |
# |
| 3574 |
# Colorized Output: |
| 3575 |
# The output of commands is colorized to highlight things that are often |
| 3576 |
# important to developers. This includes {underfull,overfull} |
| 3577 |
# {h,v}boxes, general LaTeX Errors, each stage of document building, and |
| 3578 |
# the number of pages in the final document. The colors are obtained |
| 3579 |
# using 'tput', so colorization should work pretty well on any terminal. |
| 3580 |
# |
| 3581 |
# The colors can be customized very simply by setting any of the |
| 3582 |
# LATEX_COLOR_<CONTEXT> variables in your environment (see above). |
| 3583 |
# |
| 3584 |
# Predecessors to TeX Files: |
| 3585 |
# Given a target <target>, if no <target>.tex file exists but a |
| 3586 |
# corresponding script or predecessor file exists, then appropriate |
| 3587 |
# action will be taken to generate the tex file. |
| 3588 |
# |
| 3589 |
# Currently supported script or predecessor languages are: |
| 3590 |
# |
| 3591 |
# sh: %.tex.sh |
| 3592 |
# perl: %.tex.pl |
| 3593 |
# python: %.tex.py |
| 3594 |
# |
| 3595 |
# Calls the script using the appropriate interpreter, assuming that |
| 3596 |
# its output is a .tex file. |
| 3597 |
# |
| 3598 |
# The script is called thus: |
| 3599 |
# |
| 3600 |
# <interpreter> <script file name> <target tex file> |
| 3601 |
# |
| 3602 |
# and therefore sees exactly one parameter: the name of the .tex |
| 3603 |
# file that it is to create. |
| 3604 |
# |
| 3605 |
# Why does this feature exist? I ran into this while working on |
| 3606 |
# my paper dissertation. I wrote a huge bash script that used a |
| 3607 |
# lot of sed to bring together existing papers in LaTeX. It |
| 3608 |
# would have been nice had I had something like this to make my |
| 3609 |
# life easier, since as it stands I have to run the script and |
| 3610 |
# then build the document with make. This feature provides hooks |
| 3611 |
# for complicated stuff that you may want to do, but that I have |
| 3612 |
# not considered. It should work fine with included dependencies, |
| 3613 |
# too. |
| 3614 |
# |
| 3615 |
# Scripts are run every time make is invoked. Some trickery is |
| 3616 |
# employed to make sure that multiple restarts of make don't cause |
| 3617 |
# them to be run again. |
| 3618 |
# |
| 3619 |
# reST: %.rst |
| 3620 |
# |
| 3621 |
# Runs the reST to LaTeX converter to generate a .tex file |
| 3622 |
# If it finds a file names _rststyle_._include_.tex, uses it as |
| 3623 |
# the "stylesheet" option to rst2latex. |
| 3624 |
# |
| 3625 |
# Note that this does not track sub-dependencies in rst files. It |
| 3626 |
# assumes that the top-level rst file will change if you want a |
| 3627 |
# rebuild. |
| 3628 |
# |
| 3629 |
# Dependencies: |
| 3630 |
# |
| 3631 |
# In general, dependencies are extracted directly from LaTeX output on |
| 3632 |
# your document. This includes |
| 3633 |
# |
| 3634 |
# * Bibliography information |
| 3635 |
# * \include or \input files (honoring \includeonly, too) |
| 3636 |
# * Graphics files inserted by the graphicx package |
| 3637 |
# |
| 3638 |
# Where possible, all of these are built correctly and automatically. |
| 3639 |
# In the case of graphics files, these are generated from the following |
| 3640 |
# file types: |
| 3641 |
# |
| 3642 |
# GraphViz: .dot |
| 3643 |
# GNUPlot: .gpi |
| 3644 |
# XFig: .fig |
| 3645 |
# XMgrace: .xvg |
| 3646 |
# SVG: .svg |
| 3647 |
# PNG: .png |
| 3648 |
# JPEG: .jpg |
| 3649 |
# GZipped EPS: .eps.gz |
| 3650 |
# |
| 3651 |
# If the file exists as a .eps already, it is merely used (and will not |
| 3652 |
# be deleted by 'clean'!). |
| 3653 |
# |
| 3654 |
# LaTeX and BibTeX are invoked correctly and the "Rerun to get |
| 3655 |
# cross-references right" warning is heeded a reasonable number of |
| 3656 |
# times. In my experience this is enough for even the most troublesome |
| 3657 |
# documents, but it can be easily changed (if LaTeX has to be run after |
| 3658 |
# BibTeX more than three times, it is likely that something is moving |
| 3659 |
# back and forth between pages, and no amount of LaTeXing will fix |
| 3660 |
# that). |
| 3661 |
# |
| 3662 |
# \includeonly is honored by this system, so files that are not |
| 3663 |
# specified there will not trigger a rebuild when changed. |
| 3664 |
# |
| 3665 |
# Beamer: |
| 3666 |
# A special TeX source comment is recognized by this makefile (only when |
| 3667 |
# BUILD_STRATEGY=latex, since this invokes psnup): |
| 3668 |
# |
| 3669 |
# %%[[:space:]]*BEAMER[[:space:]]*LARGE |
| 3670 |
# |
| 3671 |
# The presence of this comment forces the output of dvips through psnup |
| 3672 |
# to enlarge beamer slides to take up an entire letter-sized page. This |
| 3673 |
# is particularly useful when printing transparencies or paper versions |
| 3674 |
# of the slides. For some reason landscape orientation doesn't appear |
| 3675 |
# to work, though. |
| 3676 |
# |
| 3677 |
# If you want to put multiple slides on a page, use this option and then |
| 3678 |
# print using mpage, a2ps, or psnup to consolidate slides. My personal |
| 3679 |
# favorite is a2ps, but your mileage may vary. |
| 3680 |
# |
| 3681 |
# When beamer is the document class, dvips does NOT receive a paper size |
| 3682 |
# command line attribute, since beamer does special things with sizes. |
| 3683 |
# |
| 3684 |
# GNUPlot Graphics: |
| 3685 |
# When creating a .gpi file, DO NOT INCLUDE the "set terminal" or "set |
| 3686 |
# output" commands! The makefile will include terminal information for |
| 3687 |
# you. Besides being unnecessary and potentially harmful, including the |
| 3688 |
# terminal definition in the .gpi file makes it harder for you, the one |
| 3689 |
# writing the document, to preview your graphics, e.g., with |
| 3690 |
# |
| 3691 |
# gnuplot -persist myfile.gpi |
| 3692 |
# |
| 3693 |
# so don't do specify a terminal or an output file in your .gpi files. |
| 3694 |
# |
| 3695 |
# When building a gpi file into an eps file, there are several features |
| 3696 |
# available to the document designer: |
| 3697 |
# |
| 3698 |
# Global Header: |
| 3699 |
# The makefile searches for the files in the variable GNUPLOT_GLOBAL |
| 3700 |
# in order: |
| 3701 |
# |
| 3702 |
# ($(GNUPLOT_GLOBAL)) |
| 3703 |
# |
| 3704 |
# Only the first found is used. All .gpi files in the directory are |
| 3705 |
# treated as though the contents of GNUPLOT_GLOBAL were directly |
| 3706 |
# included at the top of the file. |
| 3707 |
# |
| 3708 |
# NOTE: This includes special comments! (see below) |
| 3709 |
# |
| 3710 |
# Font Size: |
| 3711 |
# A special comment in a .gpi file (or a globally included file) of |
| 3712 |
# the form |
| 3713 |
# |
| 3714 |
# ## FONTSIZE=<number> |
| 3715 |
# |
| 3716 |
# will change the font size of the GPI output. If font size is |
| 3717 |
# specified in both the global file and the GPI file, the |
| 3718 |
# specification in the individual GPI file is used. |
| 3719 |
# |
| 3720 |
# Grayscale Output: |
| 3721 |
# GNUplot files also support a special comment to force them to be |
| 3722 |
# output in grayscale *no matter what*: |
| 3723 |
# |
| 3724 |
# ## GRAY |
| 3725 |
# |
| 3726 |
# This is not generally advisable, since you can always create a |
| 3727 |
# grayscale document using the forms mentioned above. But, if your |
| 3728 |
# plot simply must be grayscale even in a document that allows |
| 3729 |
# colors, this is how you do it. |
| 3730 |
# |
| 3731 |
# XFig Graphics: |
| 3732 |
# No special handling is done with XFig, except when a global |
| 3733 |
# grayscale method is used, e.g. |
| 3734 |
# |
| 3735 |
# make GRAY=1 document |
| 3736 |
# |
| 3737 |
# In these cases the .eps files is created using the -N switch to |
| 3738 |
# fig2dev to turn off color output. (Only works with eps, not pstex |
| 3739 |
# output) |
| 3740 |
# |
| 3741 |
# GraphVis Graphics: |
| 3742 |
# Color settings are simply ignored here. The 'dot' program is used |
| 3743 |
# to transform a .dot file into a .eps file. |
| 3744 |
# |
| 3745 |
# If you want, you can use the dot2tex program to convert dot files |
| 3746 |
# to tex graphics. The default is to just call dot2tex with no |
| 3747 |
# arguments, but you can change the DOT2TEX definition to include |
| 3748 |
# options as needed (in your Makefile.ini). |
| 3749 |
# |
| 3750 |
# Note that, as with pstex, the makefile cannot use latex's own |
| 3751 |
# output to discover all missing dot_t (output) files, since anytime |
| 3752 |
# TeX includes TeX, it has to bail when it can't find the include |
| 3753 |
# file. It can therefore only stop on the first missing file it |
| 3754 |
# discovers, and we can't get a large list of them out easily. |
| 3755 |
# |
| 3756 |
# So, the makefile errors out if it's missing an included dot_t |
| 3757 |
# file, then prompts the user to run this command manually: |
| 3758 |
# |
| 3759 |
# make all-dot2tex |
| 3760 |
# |
| 3761 |
# GZipped EPS Graphics: |
| 3762 |
# |
| 3763 |
# A .eps.gz file is sometimes a nice thing to have. EPS files can get |
| 3764 |
# very large, especially when created from bitmaps (don't do this if you |
| 3765 |
# don't have to). This makefile will unzip them (not in place) to |
| 3766 |
# create the appropriate EPS file. |
| 3767 |
# |
| 3768 |
# |
| 3769 |
endef |
| 3770 |
|
| 3771 |
# |
| 3772 |
# DEPENDENCY CHART: |
| 3773 |
# |
| 3774 |
# digraph "g" { |
| 3775 |
# rankdir=TB |
| 3776 |
# size="9,9" |
| 3777 |
# edge [fontsize=12 weight=10] |
| 3778 |
# node [shape=box fontsize=14 style=rounded] |
| 3779 |
# |
| 3780 |
# eps [ |
| 3781 |
# shape=Mrecord |
| 3782 |
# label="{{<gpi> GNUplot|<epsgz> GZip|<dot> Dot|<fig> XFig}|<eps> eps}" |
| 3783 |
# ] |
| 3784 |
# pstex [label="%.pstex"] |
| 3785 |
# pstex_t [label="%.pstex_t"] |
| 3786 |
# tex_outputs [shape=point] |
| 3787 |
# extra_tex_files [shape=point] |
| 3788 |
# gpi_data [label="<data>"] |
| 3789 |
# gpi_includes [label="_include_.gpi"] |
| 3790 |
# aux [label="%.aux"] |
| 3791 |
# fls [label="%.fls"] |
| 3792 |
# idx [label="%.idx"] |
| 3793 |
# glo [label="%.glo"] |
| 3794 |
# ind [label="%.ind"] |
| 3795 |
# log [label="%.log"] |
| 3796 |
# tex_sh [label="%.tex.sh"] |
| 3797 |
# rst [label="%.rst"] |
| 3798 |
# tex [ |
| 3799 |
# shape=record |
| 3800 |
# label="<tex> %.tex|<include> _include_.tex" |
| 3801 |
# ] |
| 3802 |
# include_aux [label="_include_.aux"] |
| 3803 |
# file_bib [label=".bib"] |
| 3804 |
# bbl [label="%.bbl"] |
| 3805 |
# dvi [label="%.dvi"] |
| 3806 |
# ps [label="%.ps"] |
| 3807 |
# pdf [label="%.pdf"] |
| 3808 |
# fig [label=".fig"] |
| 3809 |
# dot [label=".dot"] |
| 3810 |
# gpi [label=".gpi"] |
| 3811 |
# eps_gz [label=".eps.gz"] |
| 3812 |
# |
| 3813 |
# gpi_files [shape=point] |
| 3814 |
# |
| 3815 |
# rst -> tex:tex [label="reST"] |
| 3816 |
# tex_sh -> tex:tex [label="sh"] |
| 3817 |
# tex_pl -> tex:tex [label="perl"] |
| 3818 |
# tex_py -> tex:tex [label="python"] |
| 3819 |
# tex -> tex_outputs [label="latex"] |
| 3820 |
# tex_outputs -> dvi |
| 3821 |
# tex_outputs -> aux |
| 3822 |
# tex_outputs -> log |
| 3823 |
# tex_outputs -> fls |
| 3824 |
# tex_outputs -> idx |
| 3825 |
# tex_outputs -> include_aux |
| 3826 |
# aux -> bbl [label="bibtex"] |
| 3827 |
# file_bib -> bbl [label="bibtex"] |
| 3828 |
# idx -> ind [label="makeindex"] |
| 3829 |
# glo -> gls [label="makeindex"] |
| 3830 |
# nlo -> nls [label="makeindex"] |
| 3831 |
# gls -> extra_tex_files |
| 3832 |
# nls -> extra_tex_files |
| 3833 |
# ind -> extra_tex_files |
| 3834 |
# bbl -> extra_tex_files |
| 3835 |
# eps -> extra_tex_files |
| 3836 |
# extra_tex_files -> dvi [label="latex"] |
| 3837 |
# gpi_files -> eps:gpi [label="gnuplot"] |
| 3838 |
# gpi -> gpi_files |
| 3839 |
# gpi_data -> gpi_files |
| 3840 |
# gpi_includes -> gpi_files |
| 3841 |
# eps_gz -> eps:epsgz [label="gunzip"] |
| 3842 |
# fig -> eps:fig [label="fig2dev"] |
| 3843 |
# fig -> pstex [label="fig2dev"] |
| 3844 |
# fig -> pstex_t [label="fig2dev"] |
| 3845 |
# pstex -> pstex_t [label="fig2dev"] |
| 3846 |
# dot -> eps:dot [label="dot"] |
| 3847 |
# dvi -> ps [label="dvips"] |
| 3848 |
# include_aux -> bbl [label="bibtex"] |
| 3849 |
# ps -> pdf [label="ps2pdf"] |
| 3850 |
# |
| 3851 |
# edge [ color=blue label="" style=dotted weight=1 fontcolor=blue] |
| 3852 |
# fls -> tex:include [label="INPUT: *.tex"] |
| 3853 |
# fls -> file_bib [label="INPUT: *.aux"] |
| 3854 |
# aux -> file_bib [label="\\bibdata{...}"] |
| 3855 |
# include_aux -> file_bib [label="\\bibdata{...}"] |
| 3856 |
# log -> gpi [label="Graphic file"] |
| 3857 |
# log -> fig [label="Graphic file"] |
| 3858 |
# log -> eps_gz [label="Graphic file"] |
| 3859 |
# log -> dot [label="Graphic file"] |
| 3860 |
# log -> idx [label="No file *.ind"] |
| 3861 |
# log -> glo [label="No file *.gls"] |
| 3862 |
# log -> nlo [label="No file *.nls"] |
| 3863 |
# gpi -> gpi_data [label="plot '...'"] |
| 3864 |
# gpi -> gpi_includes [label="load '...'"] |
| 3865 |
# tex:tex -> ps [label="paper"] |
| 3866 |
# tex:tex -> pdf [label="embedding"] |
| 3867 |
# } |
| 3868 |
# |
| 3869 |
|
| 3870 |
# |
| 3871 |
# DEPENDENCY CHART SCRIPT |
| 3872 |
# |
| 3873 |
# $(call output_dependency_graph,[<output file>]) |
| 3874 |
define output-dependency-graph |
| 3875 |
if [ -f '$(this_file)' ]; then \ |
| 3876 |
$(SED) \ |
| 3877 |
-e '/^[[:space:]]*#[[:space:]]*DEPENDENCY CHART:/,/^$$/!d' \ |
| 3878 |
-e '/DEPENDENCY CHART/d' \ |
| 3879 |
-e '/^$$/d' \ |
| 3880 |
-e 's/^[[:space:]]*#//' \ |
| 3881 |
$(this_file) $(if $1,> '$1',); \ |
| 3882 |
else \ |
| 3883 |
$(ECHO) "Cannot determine the name of this makefile."; \ |
| 3884 |
fi |
| 3885 |
endef |
| 3886 |
# |
| 3887 |
.PHONY: Targets.ini $(HOME)/.latex-makefile/Targets.ini |
| 3888 |
-include Targets.ini |
| 3889 |
-include $(HOME)/.latex-makefile/Targets.ini |
| 3890 |
# |
| 3891 |
# vim: noet sts=0 sw=8 ts=8 |
| 3892 |
|