/sparse_autoencoder/matlab/doc/Makefile
Makefile | 1275 lines | 434 code | 88 blank | 753 comment | 13 complexity | 31d06a2bd8f55c40b7faeb43af4011c2 MD5 | raw file
- # Copyright 2004 Chris Monson (shiblon@gmail.com)
- # Latest version available at http://www.bouncingchairs.net/oss
- #
- # This file is part of ``Chris Monson's Free Software''.
- #
- # ``Chris Monson's Free Software'' is free software; you can redistribute it
- # and/or modify it under the terms of the GNU General Public License as
- # published by the Free Software Foundation, Version 2.
- #
- # ``Chris Monson's Free Software'' is distributed in the hope that it will
- # be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
- # Public License for more details.
- #
- # You should have received a copy of the GNU General Public License along
- # with ``Chris Monson's Free Software''; if not, write to the Free Software
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- #
- # It is also available on the web at http://www.gnu.org/copyleft/gpl.html
- #
- # Note that using this makefile to build your documents does NOT place them
- # under the GPL unless you, the author, specifically do so. In other words,
- # I, Chris Monson, the copyright holder and author of this makefile,
- # consider it impossible to ``link'' to this makefile in any way covered by
- # the GPL.
- #
- # TO OBTAIN INSTRUCTIONS FOR USING THIS FILE, RUN:
- # make help
- #
- fileinfo := LaTeX Makefile
- author := Chris Monson
- version := 2.2.0-rc2
- #
- # Note that the user-global version is imported *after* the source directory,
- # so that you can use stuff like ?= to get proper override behavior.
- .PHONY: Makefile GNUmakefile Makefile.ini $(HOME)/.latex-makefile/Makefile.ini
- -include Makefile.ini
- -include $(HOME)/.latex-makefile/Makefile.ini
- #
- # This can be pdflatex or latex - you can change this by adding the following line to your Makefile.ini:
- # BUILD_STRATEGY := latex
- BUILD_STRATEGY ?= pdflatex
- #
- # Sets LC_ALL=C, by default, so that the locale-aware tools, like sort, be
- # # immune to changes to the locale in the user environment.
- export LC_ALL ?= C
- #
- #
- # If you specify sources here, all other files with the same suffix
- # will be treated as if they were _include_ files.
- #onlysources.tex ?= main.tex
- #onlysources.tex.sh ?=
- #onlysources.tex.pl ?=
- #onlysources.tex.py ?=
- #onlysources.rst ?=
- #onlysources.fig ?=
- #onlysources.gpi ?=
- #onlysources.dot ?=
- #onlysources.xvg ?=
- #onlysources.svg ?=
- #onlysources.eps.gz ?=
- #onlysources.eps ?=
- #
- # If you list files here, they will be treated as _include_ files
- #includes.tex ?= file1.tex file2.tex
- #includes.tex.sh ?=
- #includes.tex.pl ?=
- #includes.tex.py ?=
- #includes.rst ?=
- #includes.fig ?=
- #includes.gpi ?=
- #includes.dot ?=
- #includes.xvg ?=
- #includes.svg ?=
- #includes.eps.gz ?=
- #includes.eps ?=
- #
- # If you list files or wildcards here, they will *not* be cleaned - default is
- # to allow everything to be cleaned.
- #neverclean ?= *.pdf
- #
- # Alternatively (recommended), you can add those lines to a Makefile.ini file
- # and it will get picked up automatically without your having to edit this
- # Makefile.
- #
- # KNOWN ISSUES:
- # * The following occurs:
- # file with: \usepackage{named}\bibliographystyle{named}
- # Compile
- # change to: \usepackage{apalike}\bibliographystyle{apalike}
- # Compile again -- BARF!
- #
- # The workaround: make clean-nographics; make
- #
- # Note that we may not be able to fix this. LaTeX itself barfs
- # on this, not the makefile. The very first invocation of LaTeX
- # (when something like this has happened) reads the existing .aux
- # file and discovers invalid commands like \citeauthoryear that
- # are only valid in the package that was just removed. It then
- # tries to parse them and explodes. It's not at all clear to me
- # how to fix this. I tried removing the .aux files on the first
- # run of LaTeX, but that necessarily requires more subsequent
- # rebuilds on common edits. There does not appear to be a
- # graceful solution to this issue.
- #
- # CHANGES:
- # Chris Monson (2010-04-28):
- # * Bumped version to 2.2.0-rc2
- # * Fixed %._show target
- # Chris Monson (2010-04-08):
- # * Bumped version to 2.2.0-rc1
- # * Added back in the rst_style_file stuff that got broken when switching
- # rst -> tex to use the script mechanism
- # Chris Monson (2010-03-23):
- # * Bumped version to 2.2.0-beta8
- # * Work on issue 76: bad backtick escape for some sed versions, failure
- # to clear out the hold buffer when outputting MISSING comment.
- # - Backed out 2>&1 to &> (doesn't work in sh)
- # - Backed out using . to source variables
- # Chris Monson (2010-03-22):
- # * Bumped version to 2.2.0-beta7
- # * Issue 72: Fix latex/bibtex invocation order for annotated bib styles
- # * Fixed informational output to reflect which LaTeX run we're on
- # * Fixed graphic detection to include graphics that are already there in
- # .d files
- # * Tightened up the .d file output to only make .d depend on graphic
- # *source* files. This means that building foo.d no longer
- # builds all of the graphics files on which foo.tex depends.
- # Had to use .SECONDEXPANSION trickery to make it work.
- # * Changed get-graphics to only accept a stem.
- # * Fixed build-once logic for scripted .tex to work better
- # * Made get-inputs sed script more maintainable.
- # * Moved Makefile.ini import up higher.
- # * Changed bare stems to not recursively invoke make
- # * Updated diff output to be more silent everywhere
- # * Added a MISSING comment to the .d file if stuff isn't found - forces
- # removal of .1st.make file, which often forces it to try again.
- # * Fixed broken graphics-target function
- # * Added sleep to .d file generation when stuff is missing - if it
- # builds too fast, make doesn't realize it needs to be reloaded,
- # and thus never discovers some deeper dependencies (especially
- # evident when graphics are included from scripted include
- # files).
- # Chris Monson (2010-03-17):
- # * Bumped version to 2.2.0-beta6
- # * Fixed bareword builds to actually work (requires static patterns)
- # * Fixed colorization to work with new paragraph stuff
- # Chris Monson (2010-03-17):
- # * Bumped version to 2.2.0-beta5
- # * Fixed graphic detection to be much more focused - splits log file
- # into paragraphs before doing pattern matching.
- # * Fixed make foo to work properly (recursively calls make foo.pdf)
- # * Fixed gpi -> pdf generation to not waste time building .eps *after*
- # the pdf already exists.
- # * Changed log copies to include MAKE_RESTARTS as part of the name.
- # * Fixed missing include file detection (also makes use of the paragraph
- # stuff) to detect missing scripted include files.
- # Chris Monson (2010-03-16):
- # * Bumped version to 2.2.0-beta4
- # * issue 70: .pdf not moved out of the way properly on first
- # compilation, resulting in early error detection failure.
- # * issue 74: fixed broken error on missing .aux files: the
- # implementation was masking real errors.
- # Chris Monson (2010-03-15):
- # * Bumped version to 2.2.0-beta3
- # * issue 71: Made the tput dependency optional
- # * issue 73: Made .tex targets not pull in .d files (building them from
- # scripts should not require a .d)
- # * issue 74: Output a much saner error when a .aux file is not produced
- # (e.g., when you are typing "make" without arguments in a
- # directory with included .tex files that are not named with
- # ._include_.)
- # Chris Monson (2010-03-11):
- # * Bumped version to 2.2.0-beta2
- # * Fixed clean-graphics to get rid of intermediate .eps files that may
- # be hanging around
- # * Added an automatic setting to use eps terminals in pdflatex mode for
- # gnuplot if it doesn't understand pdf.
- # * issue 66: Removed grayscale generation via magic suffix. Grayscale
- # generation is now only available via GRAY=1
- # * issue 68: Added explicit handling of LC_ALL for locale-aware tools
- # like "sort"
- # Chris Monson (2010-03-10):
- # * Bumped version to 2.2.0-beta1
- # * Fixed success message to handle output message in different places
- # * Added name of produced file to success message
- # Chris Monson (2010-03-10):
- # * Bumped version to 2.2.0-alpha3
- # * Added meaningful error message for wrong hyperref options
- # * Added meaningful error message for incorrect graphics extensions
- # Chris Monson (2010-03-09):
- # * Bumped version to 2.2.0-alpha2
- # * Updated graphics handling (gnuplot and fig generate pdf natively)
- # * Changed xmgrace to output monochrome natively
- # Chris Monson (2010-03-09):
- # * Bumped version to 2.2.0-alpha1 - major change!
- # * Support pdflatex natively and by default (issue 6 - a long time coming)
- # * Add ability to have a single $HOME/.latex-makefile/Makefile.ini for
- # all invocations
- # * Reworked graphic inclusion detection so that extensions need not be
- # specified for either build strategy (e.g.,
- # \includegraphics{test1.eps} -> \includegrahpics{test1})
- # * Changed log format to include filenames and line numbers
- # Chris Monson (2010-02-04):
- # * Bumped version to 2.1.43
- # * All of the following are for issue 63 (thanks to mojoh81):
- # * Added documentation about fixing Makefile.ini default target
- # * Added perl and python script targets
- # * Fixed run logic to allow included .tex files to be scripted (the
- # run-again logic now detects missing .tex files, and the MV
- # command has been switched out for a command that only invokes
- # MV if the files exist)
- # * Changed scripted generation to only run once per make invocation
- # * Added dependency on expr
- # Chris Monson (2010-01-19):
- # * Bumped version to 2.1.42
- # * issue 62: Added .brf extension to cleanable files (backrefs)
- # Chris Monson (2010-01-07):
- # * Bumped version to 2.1.41
- # * issue 60: bad makeindex runs now error out on subsequent tries
- # Chris Monson (2009-12-01):
- # * Bumped version to 2.1.40
- # * issue 36: build all indices (for e.g., splitidx usage)
- # * issue 59: clean up all generated files (including indices)
- # Chris Monson (2009-11-23):
- # * Bumped version to 2.1.39
- # * issue 57: change ps2pdf invocations to just use gs directly
- # Chris Monson (2009-11-19):
- # * Bumped version to 2.1.38
- # * issue 57: Added some limited support for Cygwin (spaces in filenames)
- # Chris Monson (2009-11-15):
- # * Bumped version to 2.1.37
- # * Removed svninfo, since this is now managed by mercurial
- # * Fixed typo in changelist
- # * Issue 52: added jpg->eps conversion (thanks to brubakee)
- # * Issue 54: fix missing Overfull colorization due to lack of a blank
- # line preceding the first error.
- # * Issue 51: remove head.tmp and body.tmp in make clean invocation
- # * Issue 56: maintain multiple versions of log files (for debugging)
- # Chris Monson (2009-11-14):
- # * Bumped version to 2.1.36
- # * Issues 53 and 49: added .brf, .mtc, and .maf to the cleanables
- # Chris Monson (2009-11-05):
- # * Bumped version to 2.1.35
- # * Added nomenclature support (see issue 48)
- # Chris Monson (2009-10-29):
- # * Bumped version to 2.1.34
- # * Fixed _out_ creation bug introduced in 2.1.33 (it was always created)
- # * Fixed erroneous help output for $HOME in BINARY_TARGET_DIR
- # * Changed contact email address - bring on the spam!
- # Chris Monson (2009-10-21):
- # * Bumped version to 2.1.33
- # * Fixed issue 46, adding support for dot2tex (thanks to fdemesmay)
- # * Made all_files.* settable in Makefile.ini (using ?= instead of :=)
- # * Fixed issue 47, thanks to fdemesmay: add binary copy directory, copy
- # dvi, pdf, and ps if it exists
- # Chris Monson (2009-09-25):
- # * Bumped version to 2.1.32
- # * Fixed so that a changed lol file will cause a rebuild
- # * Added .lol files to the cleanable list
- # Chris Monson (2009-09-08):
- # * Bumped version to 2.1.31
- # * Closed issue 43: evince doesn't notice pdf change w/out touch
- # Chris Monson (2009-08-28):
- # * Bumped version to 2.1.30
- # * Closed issue 39: Capture multi-line log warnings/errors to output
- # Chris Monson (2009-08-26):
- # * Bumped version to 2.1.29
- # * Closed issue 42: add svg support using inkscape
- # Chris Monson (2009-08-17):
- # * Bumped version to 2.1.28
- # * Patch from paul.biggar for issue 38: package warnings are overlooked
- # Chris Monson (2009-08-07):
- # * Bumped version to 2.1.27
- # * Included patch for issue 37 - removes pdf/ps files before copying,
- # allowing some broken viewers to see changes properly.
- # Chris Monson (2009-05-15):
- # * Bumped version to 2.1.26
- # * Included patch for issue 9 from favonia - detects .fig changes for
- # pstex files during regular compilation, so long as the pstex
- # has been built at least once with make all-pstex.
- # Chris Monson (2009-03-27):
- # * Bumped version to 2.1.25
- # * Cleaned up a bunch of variable setting stuff - more stuff is now
- # settable from Makefile.ini
- # * Cleaned up documentation for various features, especially settable
- # variables.
- # * issue 28: support for png -> eps conversion (it even looks good!)
- # * issue 29: support for "neverclean" files in Makefile.ini
- # * issue 30: make ps2pdf14 the default - fall back when not there
- # Chris Monson (2009-03-09):
- # * Bumped version to 2.1.24
- # * issue 27: xmgrace support (thanks to rolandschulzhd)
- # Chris Monson (2008-10-23):
- # * Bumped version to 2.1.23
- # * issue 23: fixed _check_programs to not use bash string subs
- # Chris Monson (2008-09-02):
- # * Bumped version to 2.1.22
- # * Appled patch from Holger <yllohy@googlemail.com> to add include
- # sources and some documentation updates.
- # * Updated backup_patterns to be a bit more aggressive (also thanks to
- # Holger)
- # Chris Monson (2008-08-30):
- # * Bumped version to 2.1.21
- # * Added ability to specify onlysources.* variables to indicate the only
- # files that should *not* be considered includes. Thanks to Holger
- # <yllohy@googlemail.com> for this patch.
- # * Added an automatic include of Makefile.ini if it exists. Allows
- # settings to be made outside of this makefile.
- # Chris Monson (2008-05-21):
- # * Bumped version to 2.1.20
- # * Added manual pstex compilation support (run make all-pstex first)
- # * Removed all automatic pstex support. It was totally breaking
- # everything and is very hard to incorporate into the makefile
- # concept because it requires LaTeX to *fail* before it can
- # determine that it needs the files.
- # Chris Monson (2008-04-17):
- # * Bumped version to 2.1.19
- # * Changed the pstex build hack to be on by default
- # Chris Monson (2008-04-09):
- # * Bumped version to 2.1.18
- # * issue 16: fixed pstex build problems, seems nondeterministic. Added
- # gratuitious hack for testing: set PSTEX_BUILD_ALL_HACK=1.
- # Chris Monson (2008-04-09):
- # * Bumped version to 2.1.17
- # * issue 20: fixed accumulation of <pid>*.make files - wildcard was
- # refusing to work on files that are very recently created.
- # Chris Monson (2008-04-02):
- # * Bumped version to 2.1.16
- # * issue 19: Removed the use of "type" to fix broken "echo" settings
- # Chris Monson (2008-03-27):
- # * Bumped version to 2.1.15
- # * issue 18: Favors binary echo over builtin, as binary understands -n
- # * issue 16: Fixed handling of missing pstex_t files in the log
- # * issue 9: Added .SECONDARY target for .pstex files
- # Chris Monson (2008-03-21):
- # * Bumped version to 2.1.14
- # * Fixed broken aux file flattening, which caused included bibs to be
- # missed.
- # Chris Monson (2008-03-20):
- # * Bumped version to 2.1.13
- # * Changed error output colorization to show errors for missing files
- # that are not graphics files.
- # Chris Monson (2008-03-20):
- # * Bumped version to 2.1.12
- # * Fixed a regression introduced in r28 that makes bibtex fail when
- # there is no index file present
- # Chris Monson (2008-03-03):
- # * Bumped version to 2.1.11
- # * Fixed issue 11 (handle index files, reported by abachn)
- # * Cleaned up some comments and help text
- # Chris Monson (2008-01-24):
- # * Bumped version to 2.1.10
- # * Fixed to work when 'sh' is a POSIX shell like 'dash'
- # Chris Monson (2007-12-12):
- # * Bumped version to 2.1.9
- # * Fixed documentation and dependency graph for pstex files
- # Chris Monson (2007-12-12):
- # * Bumped version to 2.1.8
- # * Added basic pstex_t support for fig files (Issue 9 by favonia)
- # I still suggest that psfrag be used instead.
- # Chris Monson (2007-10-16):
- # * Bumped version to 2.1.7
- # * Removed todo item: allow other comment directives for rst conversion
- # * Added ability to use global rst style file _rststyle_._include_.tex
- # * Added help text to that effect
- # Chris Monson (2007-05-20):
- # * Bumped version to 2.1.6
- # * Changed default paper size for rst files
- # * Added todo item: fix paper size for rst files
- # * Added todo item: allow other comment directives for rst conversion
- # Chris Monson (2007-04-02):
- # * Bumped version to 2.1.5
- # * Addressed Issue 7, incorrect .gpi.d generation in subdirectories
- # Chris Monson (2007-03-28):
- # * Bumped version to 2.1.4
- # * Fixed syntax error in dot output
- # Chris Monson (2007-03-01):
- # * Bumped version to 2.1.3
- # * Added reST to the included documentation
- # * Fixed graphics and script generation to be settable in the
- # environment.
- # Chris Monson (2007-02-23):
- # * Bumped version to 2.1.2
- # * Added the ability to generate .tex files from .rst files
- # Chris Monson (2006-10-17):
- # * Bumped version to 2.1.1
- # * Fixed includes from subdirectories (sed-to-sed slash escape problem)
- # Chris Monson (2006-10-05):
- # * Bumped version to 2.1.0 (pretty serious new feature added)
- # * New feature: bib files can now be anywhere on the BIBINPUTS path
- # * New programs: kpsewhich (with tetex) and xargs (BSD)
- # Chris Monson (2006-09-28):
- # * Bumped version to 2.0.9
- # * Added ability to parse more than one bibliography
- # Chris Monson (2006-06-01):
- # * Bumped version to 2.0.8
- # * Added .vrb to the list of cleaned files
- # Chris Monson (2006-04-26):
- # * Bumped version to 2.0.7
- # * Fixed so that clean-nographics does not remove .gpi.d files
- # * Removed jpg -> eps hack (not working properly -- just pre-convert)
- # * Fixed so that postscript grayscale can be done with BSD sed
- # Chris Monson (2006-04-25):
- # * Bumped version to 2.0.6
- # * Fixed so that changed toc, lot, lof, or out causes a rebuild
- # Chris Monson (2006-04-17):
- # * Bumped version to 2.0.5
- # * Added jpg -> eps conversion target
- # Chris Monson (2006-04-12):
- # * Bumped version to 2.0.4
- # * Fixed BSD sed invocation to not use \| as a branch delimiter
- # * Added a comment section on what is and is not allowed in BSD sed
- # * Made paper size handling more robust while I was at it
- # * Fixed postscript RGB grayscale to use a weighted average
- # * Fixed postscript HSB grayscale to convert to RGB first
- # * Fixed a problem with rebuilding .bbl files
- # Chris Monson (2006-04-11):
- # * Bumped version to 2.0.3
- # * Fixed some BSD sed problems: can't use \n in substitutions
- # Chris Monson (2006-04-10):
- # * Bumped version to 2.0.2
- # * Once again removed ability to create .tex files from scripts
- # * \includeonly works again
- # Chris Monson (2006-04-09):
- # * Bumped version to 2.0.1
- # * Fixed grayscale postscript handling to be more robust
- # * Added ability to generate ._gray_. files from eps and eps.gz
- # * Added ability to clean ._gray_.eps files created from .eps files
- # Chris Monson (2006-04-07):
- # * Bumped version to 2.0.0
- # * Removed clunky ability to create included .tex files from scripts
- # * Added note in the help about included tex scripting not working
- # * Fixed the .eps generation to delete %.gpihead.make when finished
- # * Abandoned designs to use shell variables to create sed scripts
- # * Abandoned __default__.tex.sh idea: it causes recursion with %: .
- # * Removed web page to-do. All items are now complete.
- # * Added better grayscale conversion for dot figures (direct ps fixup).
- # * Include files can now be scripted (at the expense of \includeonly).
- # * Updated dependency graph to contain better node names.
- # Chris Monson (2006-04-06):
- # * Bumped version to 2.0b3
- # * Top level includes now fail if there is no rule to build them
- # * A helpful message is printed when they do fail
- # * Grayscale has been changed to be ._gray_, other phonies use _ now, too
- # * Grayscale handling has been completed
- # * Changed _include_stems target to _includes target.
- # * Fixed _includes target to be useful by itself.
- # * Removed the ability to specify clean and build targets at once
- # * Verified that epsfig works fine with current code
- # * Fixed included scripts so that they are added to the dep files
- # * Fixed so that graphics includes don't happen if they aren't for gpi
- # * Fixed dot output to allow grayscale.
- # Chris Monson (2006-04-05):
- # * Bumped version to 2.0b2
- # * Removed automatic -gray output. It needs fixing in a bad way.
- # * Revamped dependency creation completely.
- # * Fixed conditional inclusion to actually work (test.nobuild.d, test.d).
- # * Fixed clean target to remove log targets
- # * Added the 'monochrome' word for gray gpi output
- # * Added a _check_gpi_files target that checks for common problems
- # * Changed the _version target into the version target (no _)
- # * Added better handling of grayscale files. Use the .gray.pdf target.
- # * Fixed testing for rebuilds
- # Chris Monson (2006-04-04):
- # * Bumped version to 2.0b1
- # * Changed colorization of output
- # * Made .auxbbl and .auxtex .make files secondary targets
- # * Shortened and simplified the final latex invocation loop
- # * Added version-specific output ($$i vs. $$$$i) in latex loop
- # * Added a build message for the first .dvi run (Building .dvi (0))
- # * Removed some build messages that most people don't care about.
- # * Simplified procedure for user-set colors -- simple text specification
- # * Fixed diff output to...not output.
- # * Fixed rerun bug -- detect not only when preceded with LaTeX Warning
- # * Sped up gpi plotting
- # * Added error handling and colorized output for gpi failure
- # * Documented color changing stuff.
- # * Now sort the flattened aux file to avoid false recompilation needs
- # * Added clean-nographics target
- # * Don't remove self.dvi file if self.aux is missing in the log
- # * Clarified some code. Did some very minor adjusting.
- # Chris Monson (2006-04-03):
- # * Bumped version to 2.0a7
- # * Added .dvi and .ps files as secondary files.
- # * Fixed handling of multiple run detection when includeonly is in use.
- # * Added code to flatten .aux files.
- # * Added more files as .SECONDARY prerequisites to avoid recompilation.
- # * Fixed the inputs generation to be much simpler and to use pipes.
- # * Added the dependency graph directly into the makefile.
- # * Changed flatten-aux to remove \@writefile \relax \newlabel, etc.
- # * Undid pipe changes with sed usage (BSD sed doesn't know -f-).
- # * Added a _check_programs target that tells you what your system has.
- # * Fixed an error in colorization that made unnecessary errors appear
- # * Added view targets.
- # * Updated help text.
- # * Augmented cookies so that .aux can trigger .bbl and .dvi rebuilds
- # * Added more informative error handling for dvips and ps2pdf
- # Chris Monson (2006-04-02):
- # * Bumped version to 2.0a6
- # * Added indirection to .bbl dependencies to avoid rebuilding .bbl files
- # * Streamlined the diff invocation to eliminate an existence test
- # * Removed special shell quote escape variables
- # * Moved includes to a more prominent location
- # * Fixed .inputs.make to not contain .aux files
- # * Fixed embedding to use a file instead of always grepping.
- # * Added *.make.temp to the list of cleanable files
- # * Fixed Ruby. It should now be supported properly.
- # * Now differentiate between all, default, and buildable files.
- # * Fixed to bail out on serious errors.
- # * Revised the handling of includable files. Still working on it.
- # Chris Monson (2006-03-31):
- # * Bumped version to 2.0a5
- # * Fixed a bug with LaTeX error detection (there can be spaces)
- # * Added .bbl support, simplifying everything and making it more correct
- # * Refactored some tests that muddy the code
- # * Did a little cleanup of some shell loops that can safely be make loops
- # * Added support for graphviz .dot files
- # * Made _all_programs output easier to read
- # * Added the ruby support that has long been advertised
- # * Font embedding was screwed up for PostScript -- now implicit
- # * Changed the generation of -gray.gpi files to a single command
- # * Changed any make-generated file that is not included from .d to .make
- # Chris Monson (2006-03-30):
- # * Bumped version to 2.0a4
- # * Fixed a bug with very long graphics file names
- # * Added a todo entry for epsfig support
- # * Fixed a bug paper size bug: sometimes more than one entry appears
- # * Fixed DVI build echoing to display the number instead of process ID
- # * DVI files are now removed on first invocation if ANY file is missing
- # * Added a simple grayscale approach: if a file ends with -gray.gpi, it
- # is created from the corresponding .gpi file with a special
- # comment ##GRAY in its header, which causes coloring to be
- # turned off.
- # * Fixed a bug in the handling of .tex.sh files. For some reason I had
- # neglected to define file stems for scripted output.
- # * Removed a trailing ; from the %.graphics dependencies
- # * Added dvips embedding (I think it works, anyway)
- # Chris Monson (2006-03-29):
- # * Bumped version to 2.0a3
- # * Fixed error in make 3.79 with MAKEFILE_LIST usage
- # * Added the presumed filename to the _version output
- # * Added a vim macro for converting sed scripts to make commands
- # * Added gpi dependency support (plotting external files and loading gpi)
- # * Allow .gpi files to be ignored if called .include.gpi or .nobuild.gpi
- # * Fixed sed invocations where \+ was used. BSD sed uses \{1,\}.
- # Chris Monson (2006-03-28):
- # * Bumped version to 2.0a2
- # * Added SHELL_DEBUG and VERBOSE options
- # * Changed the default shell back to /bin/sh (unset, in other words)
- # * Moved .PHONY declarations closer to their targets
- # * Moved help text into its own define block to obtain better formatting
- # * Removed need for double-entry when adding a new program invocation
- # * Moved .SECONDARY declaration closer to its relevant occurrence
- # * Commented things more heavily
- # * Added help text about setting terminal and output in gnuplot
- # * Created more fine-grained clean targets
- # * Added a %.graphics target that generates all of %'s graphics
- # * Killed backward-compatible graphics generation (e.g., eps.gpi=gpi.eps)
- # * For now, we're just GPL 2, not 3. Maybe it will change later
- # * Made the version and svninfo into variables
- # Chris Monson (2006-03-27):
- # * Bumped version to 2.0a1
- # * Huge, sweeping changes -- automatic dependencies
- # IMPORTANT!
- #
- # When adding to the following list, do not introduce any blank lines. The
- # list is extracted for documentation using sed and is terminated by a blank
- # line.
- #
- # EXTERNAL PROGRAMS:
- # = ESSENTIAL PROGRAMS =
- # == Basic Shell Utilities ==
- CAT ?= cat
- CP ?= cp -f
- DIFF ?= diff
- ECHO ?= echo
- EGREP ?= egrep
- ENV ?= env
- EXPR ?= expr
- MV ?= mv -f
- SED ?= sed
- SORT ?= sort
- TOUCH ?= touch
- UNIQ ?= uniq
- WHICH ?= which
- XARGS ?= xargs
- SLEEP ?= sleep
- # == LaTeX (tetex-provided) ==
- BIBTEX ?= bibtex
- DVIPS ?= dvips
- LATEX ?= latex
- PDFLATEX ?= pdflatex
- EPSTOPDF ?= epstopdf
- MAKEINDEX ?= makeindex
- KPSEWHICH ?= kpsewhich
- GS ?= gs
- # = OPTIONAL PROGRAMS =
- # == Makefile Color Output ==
- TPUT ?= tput
- # == TeX Generation ==
- PERL ?= perl
- PYTHON ?= python
- RST2LATEX ?= rst2latex.py
- # == EPS Generation ==
- CONVERT ?= convert # ImageMagick
- DOT ?= dot # GraphViz
- DOT2TEX ?= dot2tex # dot2tex - add options (not -o) as needed
- FIG2DEV ?= fig2dev # XFig
- GNUPLOT ?= gnuplot # GNUplot
- INKSCAPE ?= inkscape # Inkscape (svg support)
- XMGRACE ?= xmgrace # XMgrace
- PNGTOPNM ?= pngtopnm # From NetPBM - step 1 for png -> eps
- PPMTOPGM ?= ppmtopgm # From NetPBM - (gray) step 2 for png -> eps
- PNMTOPS ?= pnmtops # From NetPBM - step 3 for png -> eps
- GUNZIP ?= gunzip # GZipped EPS
- # == Beamer Enlarged Output ==
- PSNUP ?= psnup
- # == Viewing Stuff ==
- VIEW_POSTSCRIPT ?= gv
- VIEW_PDF ?= xpdf
- VIEW_GRAPHICS ?= display
- # Command options for embedding fonts and postscript->pdf conversion
- PS_EMBED_OPTIONS ?= -dPDFSETTINGS=/printer -dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100
- PS_COMPATIBILITY ?= 1.4
- # Defaults for GPI
- DEFAULT_GPI_EPS_FONTSIZE ?= 22
- DEFAULT_GPI_PDF_FONTSIZE ?= 12
- # Style file for ReST
- RST_STYLE_FILE ?= $(wildcard _rststyle_._include_.tex)
- # This ensures that even when echo is a shell builtin, we still use the binary
- # (the builtin doesn't always understand -n)
- FIXED_ECHO := $(if $(findstring -n,$(shell $(ECHO) -n)),$(shell which echo),$(ECHO))
- ECHO := $(if $(FIXED_ECHO),$(FIXED_ECHO),$(ECHO))
- define determine-gnuplot-output-extension
- $(if $(shell $(WHICH) $(GNUPLOT)),
- $(if $(findstring unknown or ambiguous, $(shell $(GNUPLOT) -e "set terminal pdf" 2>&1)),
- eps, pdf),
- none)
- endef
- GNUPLOT_OUTPUT_EXTENSION ?= $(strip $(call determine-gnuplot-output-extension))
- # Directory into which we place "binaries" if it exists.
- # Note that this can be changed on the commandline or in Makefile.ini:
- #
- # Command line:
- # make BINARY_TARGET_DIR=$HOME/pdfs myfile.pdf
- #
- # Also, you can specify a relative directory (relative to the Makefile):
- # make BINARY_TARGET_DIR=pdfs myfile.pdf
- #
- # Or, you can use Makefile.ini:
- #
- # BINARY_TARGET_DIR := $(HOME)/bin_out
- #
- BINARY_TARGET_DIR ?= _out_
- RESTARTS := $(if $(MAKE_RESTARTS),$(MAKE_RESTARTS),0)
- # SH NOTES
- #
- # On some systems, /bin/sh, which is the default shell, is not linked to
- # /bin/bash. While bash is supposed to be sh-compatible when invoked as sh, it
- # just isn't. This section details some of the things you have to stay away
- # from to remain sh-compatible.
- #
- # * File pattern expansion does not work for {}
- # * [ "$x" = "$y" ] has to be [ x"$x" x"$y" ]
- # * &> for stderr redirection doesn't work, use 2>&1 instead
- #
- # BSD SED NOTES
- #
- # BSD SED is not very nice compared to GNU sed, but it is the most
- # commonly-invoked sed on Macs (being based on BSD), so we have to cater to
- # it or require people to install GNU sed. It seems like the GNU
- # requirement isn't too bad since this makefile is really a GNU makefile,
- # but apparently GNU sed is much less common than GNU make in general, so
- # I'm supporting it here.
- #
- # Sad experience has taught me the following about BSD sed:
- #
- # * \+ is not understood to mean \{1,\}
- # * \| is meaningless (does not branch)
- # * \n cannot be used as a substitution character
- # * ? does not mean \{0,1\}, but is literal
- # * a\ works, but only reliably for a single line if subsequent lines
- # have forward slashes in them (as is the case in postscript)
- #
- # For more info (on the Mac) you can consult
- #
- # man -M /usr/share/man re_format
- #
- # And look for the word "Obsolete" near the bottom.
- #
- # EXTERNAL PROGRAM DOCUMENTATION SCRIPT
- #
- # $(call output-all-programs,[<output file>])
- define output-all-programs
- [ -f '$(this_file)' ] && \
- $(SED) \
- -e '/^[[:space:]]*#[[:space:]]*EXTERNAL PROGRAMS:/,/^$$/!d' \
- -e '/EXTERNAL PROGRAMS/d' \
- -e '/^$$/d' \
- -e '/^[[:space:]]*#/i\ '\
- -e 's/^[[:space:]]*#[[:space:]][^=]*//' \
- $(this_file) $(if $1,> '$1',) || \
- $(ECHO) "Cannot determine the name of this makefile."
- endef
- # If they misspell gray, it should still work.
- GRAY ?= $(call get-default,$(GREY),)
- #
- # Utility Functions and Definitions
- #
- # While not exactly a make function, this vim macro is useful. It takes a
- # verbatim sed script and converts each line to something suitable in a command
- # context. Just paste the script's contents into the editor, yank this into a
- # register (starting at '0') and run the macro once for each line of the
- # original script:
- #
- # 0i -e :s/\$/$$/eg
:s/'/'"'"'/eg
^Ela'A' \:noh
j
- # don't call this directly - it is here to avoid calling wildcard more than
- # once in remove-files.
- remove-files-helper = $(if $1,$(RM) $1,$(sh_true))
- # $(call remove-files,file1 file2)
- remove-files = $(call remove-files-helper,$(wildcard $1))
- # Removes all cleanable files in the given list
- # $(call clean-files,file1 file2 file3 ...)
- # Works exactly like remove-files, but filters out files in $(neverclean)
- clean-files = \
- $(call remove-files-helper,$(call cleanable-files,$(wildcard $1)))
- # Outputs all generated files to STDOUT, along with some others that are
- # created by these (e.g., .idx files end up producing .ilg and .ind files).
- # Discovered by reading *.fls OUTPUT lines and producing corresponding .ind
- # filenames as needed.
- #
- # $(call get-generated-names,<source recorder file (*.fls)>)
- define get-generated-names
- [ -f '$1' ] && \
- $(SED) \
- -e '/^OUTPUT /{' \
- -e ' s///' \
- -e ' p' \
- -e ' s/\.idx/\.ind/p' \
- -e ' s/\.ind/\.ilg/p' \
- -e '}' \
- -e 'd' \
- '$1' \
- | $(SORT) | $(UNIQ)
- endef
- # This removes files without checking whether they are there or not. This
- # sometimes has to be used when the file is created by a series of shell
- # commands, but there ends up being a race condition: make doesn't know about
- # the file generation as quickly as the system does, so $(wildcard ...) doesn't
- # work right. Blech.
- # $(call remove-temporary-files,filenames)
- remove-temporary-files = $(if $1,$(RM) $1,:)
- # Create an identifier from a file name
- # $(call cleanse-filename,filename)
- cleanse-filename = $(subst .,_,$(subst /,__,$1))
- # Escape dots
- # $(call escape-dots,str)
- escape-dots = $(subst .,\\.,$1)
- # Test that a file exists
- # $(call test-exists,file)
- test-exists = [ -e '$1' ]
- # $(call move-files,source,destination)
- move-if-exists = $(call test-exists,$1) && $(MV) '$1' '$2'
- # Copy file1 to file2 only if file2 doesn't exist or they are different
- # $(call copy-if-different,sfile,dfile)
- copy-if-different = $(call test-different,$1,$2) && $(CP) '$1' '$2'
- copy-if-exists = $(call test-exists,$1) && $(CP) '$1' '$2'
- move-if-different = $(call test-different,$1,$2) && $(MV) '$1' '$2'
- replace-if-different-and-remove = \
- $(call test-different,$1,$2) \
- && $(MV) '$1' '$2' \
- || $(call remove-files,'$1')
- # Note that $(DIFF) returns success when the files are the SAME....
- # $(call test-different,sfile,dfile)
- test-different = ! $(DIFF) -q '$1' '$2' >/dev/null 2>&1
- test-exists-and-different = \
- $(call test-exists,$2) && $(call test-different,$1,$2)
- # Return value 1, or value 2 if value 1 is empty
- # $(call get-default,<possibly empty arg>,<default value if empty>)
- get-default = $(if $1,$1,$2)
- # Copy a file and log what's going on
- # $(call copy-with-logging,<source>,<target>)
- define copy-with-logging
- if [ -d '$2/' ]; then \
- if $(CP) '$1' '$2/'; then \
- $(ECHO) "$(C_INFO)Copied '$1' to '$2/'$(C_RESET)"; \
- else \
- $(ECHO) "$(C_ERROR)Failed to copy '$1' to '$2/'$(C_RESET)"; \
- fi; \
- fi
- endef
- # Gives a reassuring message about the failure to find include files
- # $(call include-message,<list of include files>)
- define include-message
- $(strip \
- $(if $(filter-out $(wildcard $1),$1),\
- $(shell $(ECHO) \
- "$(C_INFO)NOTE: You may ignore warnings about the"\
- "following files:" >&2;\
- $(ECHO) >&2; \
- $(foreach s,$(filter-out $(wildcard $1),$1),$(ECHO) ' $s' >&2;)\
- $(ECHO) "$(C_RESET)" >&2)
- ))
- endef
- # Characters that are hard to specify in certain places
- space := $(empty) $(empty)
- colon := \:
- comma := ,
- # Useful shell definitions
- sh_true := :
- sh_false := ! :
- # Clear out the standard interfering make suffixes
- .SUFFIXES:
- # Turn off forceful rm (RM is usually mapped to rm -f)
- ifdef SAFE_RM
- RM := rm
- endif
- # Turn command echoing back on with VERBOSE=1
- ifndef VERBOSE
- QUIET := @
- endif
- # Turn on shell debugging with SHELL_DEBUG=1
- # (EVERYTHING is echoed, even $(shell ...) invocations)
- ifdef SHELL_DEBUG
- SHELL += -x
- endif
- # Get the name of this makefile (always right in 3.80, often right in 3.79)
- # This is only really used for documentation, so it isn't too serious.
- ifdef MAKEFILE_LIST
- this_file := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
- else
- this_file := $(wildcard GNUmakefile makefile Makefile)
- endif
- # Terminal color definitions
- REAL_TPUT := $(if $(NO_COLOR),,$(shell $(WHICH) $(TPUT)))
- # $(call get-term-code,codeinfo)
- # e.g.,
- # $(call get-term-code,setaf 0)
- get-term-code = $(if $(REAL_TPUT),$(shell $(REAL_TPUT) $1),)
- black := $(call get-term-code,setaf 0)
- red := $(call get-term-code,setaf 1)
- green := $(call get-term-code,setaf 2)
- yellow := $(call get-term-code,setaf 3)
- blue := $(call get-term-code,setaf 4)
- magenta := $(call get-term-code,setaf 5)
- cyan := $(call get-term-code,setaf 6)
- white := $(call get-term-code,setaf 7)
- bold := $(call get-term-code,bold)
- uline := $(call get-term-code,smul)
- reset := $(call get-term-code,sgr0)
- #
- # User-settable definitions
- #
- LATEX_COLOR_WARNING ?= magenta
- LATEX_COLOR_ERROR ?= red
- LATEX_COLOR_INFO ?= green
- LATEX_COLOR_UNDERFULL ?= magenta
- LATEX_COLOR_OVERFULL ?= red bold
- LATEX_COLOR_PAGES ?= bold
- LATEX_COLOR_BUILD ?= cyan
- LATEX_COLOR_GRAPHIC ?= yellow
- LATEX_COLOR_DEP ?= green
- LATEX_COLOR_SUCCESS ?= green bold
- LATEX_COLOR_FAILURE ?= red bold
- # Gets the real color from a simple textual definition like those above
- # $(call get-color,ALL_CAPS_COLOR_NAME)
- # e.g., $(call get-color,WARNING)
- get-color = $(subst $(space),,$(foreach c,$(LATEX_COLOR_$1),$($c)))
- #
- # STANDARD COLORS
- #
- C_WARNING := $(call get-color,WARNING)
- C_ERROR := $(call get-color,ERROR)
- C_INFO := $(call get-color,INFO)
- C_UNDERFULL := $(call get-color,UNDERFULL)
- C_OVERFULL := $(call get-color,OVERFULL)
- C_PAGES := $(call get-color,PAGES)
- C_BUILD := $(call get-color,BUILD)
- C_GRAPHIC := $(call get-color,GRAPHIC)
- C_DEP := $(call get-color,DEP)
- C_SUCCESS := $(call get-color,SUCCESS)
- C_FAILURE := $(call get-color,FAILURE)
- C_RESET := $(reset)
- #
- # PRE-BUILD TESTS
- #
- # Check that clean targets are not combined with other targets (weird things
- # happen, and it's not easy to fix them)
- hascleangoals := $(if $(sort $(filter clean clean-%,$(MAKECMDGOALS))),1)
- hasbuildgoals := $(if $(sort $(filter-out clean clean-%,$(MAKECMDGOALS))),1)
- ifneq "$(hasbuildgoals)" ""
- ifneq "$(hascleangoals)" ""
- $(error $(C_ERROR)Clean and build targets specified together$(C_RESET)))
- endif
- endif
- #
- # VARIABLE DECLARATIONS
- #
- # Names of sed scripts that morph gnuplot files -- only the first found is used
- GNUPLOT_SED := global-gpi.sed gnuplot.sed
- GNUPLOT_GLOBAL := global._include_.gpi gnuplot.global
- ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
- default_graphic_extension ?= eps
- latex_build_program ?= $(LATEX)
- build_target_extension ?= dvi
- hyperref_driver_pattern ?= hdvips
- hyperref_driver_error ?= Using dvips: specify ps2pdf in the hyperref options.
- else
- default_graphic_extension ?= pdf
- latex_build_program ?= $(PDFLATEX)
- build_target_extension ?= pdf
- hyperref_driver_pattern ?= hpdf.*
- hyperref_driver_error ?= Using pdflatex: specify pdftex in the hyperref options (or leave it blank).
- endif
- # Files of interest
- all_files.tex ?= $(wildcard *.tex)
- all_files.tex.sh ?= $(wildcard *.tex.sh)
- all_files.tex.pl ?= $(wildcard *.tex.pl)
- all_files.tex.py ?= $(wildcard *.tex.py)
- all_files.rst ?= $(wildcard *.rst)
- all_files.fig ?= $(wildcard *.fig)
- all_files.gpi ?= $(wildcard *.gpi)
- all_files.dot ?= $(wildcard *.dot)
- all_files.xvg ?= $(wildcard *.xvg)
- all_files.svg ?= $(wildcard *.svg)
- all_files.png ?= $(wildcard *.png)
- all_files.jpg ?= $(wildcard *.jpg)
- all_files.eps.gz ?= $(wildcard *.eps.gz)
- all_files.eps ?= $(wildcard *.eps)
- # Utility function for obtaining all files not specified in $(neverclean)
- # $(call cleanable-files,file1 file2 file3 ...)
- # Returns the list of files that is not in $(wildcard $(neverclean))
- cleanable-files = $(filter-out $(wildcard $(neverclean)), $1)
- # Utility function for getting all .$1 files that are to be ignored
- # * files listed in $(includes.$1)
- # * files not listed in $(onlysources.$1) if it is defined
- ignore_files = \
- $(includes.$1) \
- $(if $(onlysources.$1),$(filter-out $(onlysources.$1), $(all_files.$1)))
- # Patterns to never be allowed as source targets
- ignore_patterns := %._include_
- # Patterns allowed as source targets but not included in 'all' builds
- nodefault_patterns := %._nobuild_ $(ignore_patterns)
- # Utility function for getting targets suitable building
- # $(call filter-buildable,suffix)
- filter-buildable = \
- $(filter-out $(call ignore_files,$1) \
- $(addsuffix .$1,$(ignore_patterns)),$(all_files.$1))
- # Utility function for getting targets suitable for 'all' builds
- # $(call filter-default,suffix)
- filter-default = \
- $(filter-out $(call ignore_files,$1) \
- $(addsuffix .$1,$(nodefault_patterns)),$(all_files.$1))
- # Top level sources that can be built even when they are not by default
- files.tex := $(call filter-buildable,tex)
- files.tex.sh := $(call filter-buildable,tex.sh)
- files.tex.pl := $(call filter-buildable,tex.pl)
- files.tex.py := $(call filter-buildable,tex.py)
- files.rst := $(call filter-buildable,rst)
- files.gpi := $(call filter-buildable,gpi)
- files.dot := $(call filter-buildable,dot)
- files.fig := $(call filter-buildable,fig)
- files.xvg := $(call filter-buildable,xvg)
- files.svg := $(call filter-buildable,svg)
- files.png := $(call filter-buildable,png)
- files.jpg := $(call filter-buildable,jpg)
- files.eps.gz := $(call filter-buildable,eps.gz)
- # Make all pstex targets secondary. The pstex_t target requires the pstex
- # target, and nothing else really depends on it, so it often gets deleted.
- # This avoids that by allowing *all* fig files to be pstex targets, which is
- # perfectly valid and causes no problems even if they're going to become eps
- # files in the end.
- .SECONDARY: $(patsubst %.fig,%.pstex,$(files.fig))
- # Top level sources that are built by default targets
- default_files.tex := $(call filter-default,tex)
- default_files.tex.sh := $(call filter-default,tex.sh)
- default_files.tex.pl := $(call filter-default,tex.pl)
- default_files.tex.py := $(call filter-default,tex.py)
- default_files.rst := $(call filter-default,rst)
- default_files.gpi := $(call filter-default,gpi)
- default_files.dot := $(call filter-default,dot)
- default_files.fig := $(call filter-default,fig)
- default_files.xvg := $(call filter-default,xvg)
- default_files.svg := $(call filter-default,svg)
- default_files.png := $(call filter-default,png)
- default_files.jpg := $(call filter-default,jpg)
- default_files.eps.gz := $(call filter-default,eps.gz)
- # Utility function for creating larger lists of files
- # $(call concat-files,suffixes,[prefix])
- concat-files = $(foreach s,$1,$($(if $2,$2_,)files.$s))
- # Useful file groupings
- all_files_source := $(call concat-files,tex,all)
- all_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,all)
- .PHONY: $(all_files_scripts)
- default_files_source := $(call concat-files,tex,default)
- default_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,default)
- files_source := $(call concat-files,tex)
- files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst)
- # Utility function for obtaining stems
- # $(call get-stems,suffix,[prefix])
- get-stems = $(sort $($(if $2,$2_,)files.$1:%.$1=%))
- # List of all stems (including ._include_ and ._nobuild_ file stems)
- all_stems.tex := $(call get-stems,tex,all)
- all_stems.tex.sh := $(call get-stems,tex.sh,all)
- all_stems.tex.pl := $(call get-stems,tex.pl,all)
- all_stems.tex.py := $(call get-stems,tex.py,all)
- all_stems.rst := $(call get-stems,rst,all)
- all_stems.fig := $(call get-stems,fig,all)
- all_stems.gpi := $(call get-stems,gpi,all)
- all_stems.dot := $(call get-stems,dot,all)
- all_stems.xvg := $(call get-stems,xvg,all)
- all_stems.svg := $(call get-stems,svg,all)
- all_stems.png := $(call get-stems,png,all)
- all_stems.jpg := $(call get-stems,jpg,all)
- all_stems.eps.gz := $(call get-stems,eps.gz,all)
- all_stems.eps := $(call get-stems,eps,all)
- # List of all default stems (all default PDF targets):
- default_stems.tex := $(call get-stems,tex,default)
- default_stems.tex.sh := $(call get-stems,tex.sh,default)
- default_stems.tex.pl := $(call get-stems,tex.pl,default)
- default_stems.tex.py := $(call get-stems,tex.py,default)
- default_stems.rst := $(call get-stems,rst,default)
- default_stems.fig := $(call get-stems,fig,default)
- default_stems.gpi := $(call get-stems,gpi,default)
- default_stems.dot := $(call get-stems,dot,default)
- default_stems.xvg := $(call get-stems,xvg,default)
- default_stems.svg := $(call get-stems,svg,default)
- default_stems.png := $(call get-stems,png,default)
- default_stems.jpg := $(call get-stems,jpg,default)
- default_stems.eps.gz := $(call get-stems,eps.gz,default)
- # List of all stems (all possible bare PDF targets created here):
- stems.tex := $(call get-stems,tex)
- stems.tex.sh := $(call get-stems,tex.sh)
- stems.tex.pl := $(call get-stems,tex.pl)
- stems.tex.py := $(call get-stems,tex.py)
- stems.rst := $(call get-stems,rst)
- stems.fig := $(call get-stems,fig)
- stems.gpi := $(call get-stems,gpi)
- stems.dot := $(call get-stems,dot)
- stems.xvg := $(call get-stems,xvg)
- stems.svg := $(call get-stems,svg)
- stems.png := $(call get-stems,png)
- stems.jpg := $(call get-stems,jpg)
- stems.eps.gz := $(call get-stems,eps.gz)
- # Utility function for creating larger lists of stems
- # $(call concat-stems,suffixes,[prefix])
- concat-stems = $(sort $(foreach s,$1,$($(if $2,$2_,)stems.$s)))
- # The most likely to be source but not finished product go first
- graphic_source_extensions := fig \
- gpi \
- xvg \
- svg \
- dot \
- eps.gz
- ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
- graphic_source_extensions += png jpg
- graphic_target_extensions := eps ps
- else
- graphic_source_extensions += eps
- graphic_target_extensions := pdf png jpg mps tif
- endif
- all_stems_source := $(call concat-stems,tex,all)
- all_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,all)
- all_stems_graphic := $(call concat-stems,$(graphic_source_extensions),all)
- all_stems_ss := $(sort $(all_stems_source) $(all_stems_script))
- all_stems_sg := $(sort $(all_stems_script))
- all_stems_ssg := $(sort $(all_stems_ss))
- default_stems_source := $(call concat-stems,tex,default)
- default_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,default)
- default_stems_ss := $(sort $(default_stems_source) $(default_stems_script))
- default_stems_sg := $(sort $(default_stems_script))
- default_stems_ssg := $(sort $(default_stems_ss))
- stems_source := $(call concat-stems,tex)
- stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst)
- stems_graphic := $(call concat-stems,$(graphic_source_extensions))
- stems_gg := $(sort $(stems_graphic))
- stems_ss := $(sort $(stems_source) $(stems_script))
- stems_sg := $(sort $(stems_script))
- stems_ssg := $(sort $(stems_ss))
- # Calculate names that can generate the need for an include file. We can't
- # really do this with patterns because it's too easy to screw up, so we create
- # an exhaustive list.
- allowed_source_suffixes := \
- pdf \
- ps \
- dvi \
- ind \
- nls \
- bbl \
- aux \
- aux.make \
- d \
- auxbbl.make \
- _graphics \
- _show
- allowed_source_patterns := $(addprefix %.,$(allowed_source_suffixes))
- allowed_graphic_suffixes := \
- pdf \
- eps \
- gpihead.make \
- gpi.d
- allowed_graphic_patterns := $(addprefix %.,$(allowed_graphic_suffixes))
- # All targets allowed to build documents
- allowed_source_targets := \
- $(foreach suff,$(allowed_source_suffixes),\
- $(addsuffix .$(suff),$(stems_ssg)))
- # All targets allowed to build graphics
- allowed_graphic_targets := \
- $(foreach suff,$(allowed_graphic_suffixes),\
- $(addsuffix .$(suff),$(stems_gg)))
- # All targets that build multiple documents (like 'all')
- allowed_batch_source_targets := \
- all \
- all-pdf \
- all-ps \
- all-dvi \
- all-bbl \
- all-ind \
- all-gls \
- all-nls \
- show
- # All targets that build multiple graphics (independent of document)
- allowed_batch_graphic_targets := \
- all-graphics \
- all-pstex \
- all-dot2tex \
- show-graphics
- # Now we figure out which stuff is available as a make target for THIS RUN.
- real_goals := $(call get-default,$(filter-out _includes,$(MAKECMDGOALS)),\
- all)
- specified_source_targets := $(strip \
- $(filter $(allowed_source_targets) $(stems_ssg),$(real_goals)) \
- )
- specified_batch_source_targets := $(strip \
- $(filter $(allowed_batch_source_targets),$(real_goals)) \
- )
- specified_graphic_targets := $(strip \
- $(filter $(allowed_graphic_targets),$(real_goals)) \
- )
- specified_batch_graphic_targets := $(strip \
- $(filter $(allowed_batch_graphic_targets),$(real_goals)) \
- )
- specified_gpi_targets := $(patsubst %.gpi,%.$(default_graphic_extension),\
- $(filter $(patsubst %.$(default_graphic_extension),%.gpi,$(specified_graphic_targets)),\
- $(all_files.gpi)) \
- )
- # Determine which .d files need including from the information gained above.
- # This is done by first checking whether a batch target exists. If it does,
- # then all *default* stems are used to create possible includes (nobuild need
- # not apply for batch status). If no batch targets exist, then the individual
- # targets are considered and appropriate includes are taken from them.
- source_stems_to_include := \
- $(sort\
- $(if $(specified_batch_source_targets),\
- $(default_stems_ss),\
- $(foreach t,$(specified_source_targets),\
- $(foreach p,$(allowed_source_patterns),\
- $(patsubst $p,%,$(filter $p $(stems_ssg),$t)) \
- )) \
- ))
- # Determine which .gpi.d files are needed using the above information. We
- # first check whether a batch target is specified, then check individual
- # graphics that may have been specified.
- graphic_stems_to_include := \
- $(sort\
- $(if $(specified_batch_graphic_targets),\
- $(default_stems.gpi),\
- $(foreach t,$(specified_gpi_targets),\
- $(foreach p,$(allowed_graphic_patterns),\
- $(patsubst $p,%,$(filter $p,$t)) \
- )) \
- ))
- # All dependencies for the 'all' targets
- all_pdf_targets := $(addsuffix .pdf,$(stems_ssg))
- all_ps_targets := $(addsuffix .ps,$(stems_ssg))
- all_dvi_targets := $(addsuffix .dvi,$(stems_ssg))
- all_tex_targets := $(addsuffix .tex,$(stems_sg))
- all_d_targets := $(addsuffix .d,$(stems_ssg))
- all_graphics_targets := $(addsuffix .$(default_graphic_extension),$(stems_gg))
- intermediate_graphics_targets := $(if $(filter pdf,$(default_graphic_extension)),$(addsuffix .eps,$(stems_gg)),)
- all_pstex_targets := $(addsuffix .pstex_t,$(stems.fig))
- all_dot2tex_targets := $(addsuffix .dot_t,$(stems.dot))
- all_known_graphics := $(sort $(all_graphics_targets) $(wildcard *.$(default_graphic_extension)))
- default_pdf_targets := $(addsuffix .pdf,$(default_stems_ss))
- ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
- d