PageRenderTime 2081ms CodeModel.GetById 7ms RepoModel.GetById 9ms app.codeStats 0ms

/sparse_autoencoder/matlab/doc/Makefile

https://github.com/msparks/qjam
Makefile | 1275 lines | 434 code | 88 blank | 753 comment | 13 complexity | 31d06a2bd8f55c40b7faeb43af4011c2 MD5 | raw file
  1. # Copyright 2004 Chris Monson (shiblon@gmail.com)
  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. # TO OBTAIN INSTRUCTIONS FOR USING THIS FILE, RUN:
  28. # make help
  29. #
  30. fileinfo := LaTeX Makefile
  31. author := Chris Monson
  32. version := 2.2.0-rc2
  33. #
  34. # Note that the user-global version is imported *after* the source directory,
  35. # so that you can use stuff like ?= to get proper override behavior.
  36. .PHONY: Makefile GNUmakefile Makefile.ini $(HOME)/.latex-makefile/Makefile.ini
  37. -include Makefile.ini
  38. -include $(HOME)/.latex-makefile/Makefile.ini
  39. #
  40. # This can be pdflatex or latex - you can change this by adding the following line to your Makefile.ini:
  41. # BUILD_STRATEGY := latex
  42. BUILD_STRATEGY ?= pdflatex
  43. #
  44. # Sets LC_ALL=C, by default, so that the locale-aware tools, like sort, be
  45. # # immune to changes to the locale in the user environment.
  46. export LC_ALL ?= C
  47. #
  48. #
  49. # If you specify sources here, all other files with the same suffix
  50. # will be treated as if they were _include_ files.
  51. #onlysources.tex ?= main.tex
  52. #onlysources.tex.sh ?=
  53. #onlysources.tex.pl ?=
  54. #onlysources.tex.py ?=
  55. #onlysources.rst ?=
  56. #onlysources.fig ?=
  57. #onlysources.gpi ?=
  58. #onlysources.dot ?=
  59. #onlysources.xvg ?=
  60. #onlysources.svg ?=
  61. #onlysources.eps.gz ?=
  62. #onlysources.eps ?=
  63. #
  64. # If you list files here, they will be treated as _include_ files
  65. #includes.tex ?= file1.tex file2.tex
  66. #includes.tex.sh ?=
  67. #includes.tex.pl ?=
  68. #includes.tex.py ?=
  69. #includes.rst ?=
  70. #includes.fig ?=
  71. #includes.gpi ?=
  72. #includes.dot ?=
  73. #includes.xvg ?=
  74. #includes.svg ?=
  75. #includes.eps.gz ?=
  76. #includes.eps ?=
  77. #
  78. # If you list files or wildcards here, they will *not* be cleaned - default is
  79. # to allow everything to be cleaned.
  80. #neverclean ?= *.pdf
  81. #
  82. # Alternatively (recommended), you can add those lines to a Makefile.ini file
  83. # and it will get picked up automatically without your having to edit this
  84. # Makefile.
  85. #
  86. # KNOWN ISSUES:
  87. # * The following occurs:
  88. # file with: \usepackage{named}\bibliographystyle{named}
  89. # Compile
  90. # change to: \usepackage{apalike}\bibliographystyle{apalike}
  91. # Compile again -- BARF!
  92. #
  93. # The workaround: make clean-nographics; make
  94. #
  95. # Note that we may not be able to fix this. LaTeX itself barfs
  96. # on this, not the makefile. The very first invocation of LaTeX
  97. # (when something like this has happened) reads the existing .aux
  98. # file and discovers invalid commands like \citeauthoryear that
  99. # are only valid in the package that was just removed. It then
  100. # tries to parse them and explodes. It's not at all clear to me
  101. # how to fix this. I tried removing the .aux files on the first
  102. # run of LaTeX, but that necessarily requires more subsequent
  103. # rebuilds on common edits. There does not appear to be a
  104. # graceful solution to this issue.
  105. #
  106. # CHANGES:
  107. # Chris Monson (2010-04-28):
  108. # * Bumped version to 2.2.0-rc2
  109. # * Fixed %._show target
  110. # Chris Monson (2010-04-08):
  111. # * Bumped version to 2.2.0-rc1
  112. # * Added back in the rst_style_file stuff that got broken when switching
  113. # rst -> tex to use the script mechanism
  114. # Chris Monson (2010-03-23):
  115. # * Bumped version to 2.2.0-beta8
  116. # * Work on issue 76: bad backtick escape for some sed versions, failure
  117. # to clear out the hold buffer when outputting MISSING comment.
  118. # - Backed out 2>&1 to &> (doesn't work in sh)
  119. # - Backed out using . to source variables
  120. # Chris Monson (2010-03-22):
  121. # * Bumped version to 2.2.0-beta7
  122. # * Issue 72: Fix latex/bibtex invocation order for annotated bib styles
  123. # * Fixed informational output to reflect which LaTeX run we're on
  124. # * Fixed graphic detection to include graphics that are already there in
  125. # .d files
  126. # * Tightened up the .d file output to only make .d depend on graphic
  127. # *source* files. This means that building foo.d no longer
  128. # builds all of the graphics files on which foo.tex depends.
  129. # Had to use .SECONDEXPANSION trickery to make it work.
  130. # * Changed get-graphics to only accept a stem.
  131. # * Fixed build-once logic for scripted .tex to work better
  132. # * Made get-inputs sed script more maintainable.
  133. # * Moved Makefile.ini import up higher.
  134. # * Changed bare stems to not recursively invoke make
  135. # * Updated diff output to be more silent everywhere
  136. # * Added a MISSING comment to the .d file if stuff isn't found - forces
  137. # removal of .1st.make file, which often forces it to try again.
  138. # * Fixed broken graphics-target function
  139. # * Added sleep to .d file generation when stuff is missing - if it
  140. # builds too fast, make doesn't realize it needs to be reloaded,
  141. # and thus never discovers some deeper dependencies (especially
  142. # evident when graphics are included from scripted include
  143. # files).
  144. # Chris Monson (2010-03-17):
  145. # * Bumped version to 2.2.0-beta6
  146. # * Fixed bareword builds to actually work (requires static patterns)
  147. # * Fixed colorization to work with new paragraph stuff
  148. # Chris Monson (2010-03-17):
  149. # * Bumped version to 2.2.0-beta5
  150. # * Fixed graphic detection to be much more focused - splits log file
  151. # into paragraphs before doing pattern matching.
  152. # * Fixed make foo to work properly (recursively calls make foo.pdf)
  153. # * Fixed gpi -> pdf generation to not waste time building .eps *after*
  154. # the pdf already exists.
  155. # * Changed log copies to include MAKE_RESTARTS as part of the name.
  156. # * Fixed missing include file detection (also makes use of the paragraph
  157. # stuff) to detect missing scripted include files.
  158. # Chris Monson (2010-03-16):
  159. # * Bumped version to 2.2.0-beta4
  160. # * issue 70: .pdf not moved out of the way properly on first
  161. # compilation, resulting in early error detection failure.
  162. # * issue 74: fixed broken error on missing .aux files: the
  163. # implementation was masking real errors.
  164. # Chris Monson (2010-03-15):
  165. # * Bumped version to 2.2.0-beta3
  166. # * issue 71: Made the tput dependency optional
  167. # * issue 73: Made .tex targets not pull in .d files (building them from
  168. # scripts should not require a .d)
  169. # * issue 74: Output a much saner error when a .aux file is not produced
  170. # (e.g., when you are typing "make" without arguments in a
  171. # directory with included .tex files that are not named with
  172. # ._include_.)
  173. # Chris Monson (2010-03-11):
  174. # * Bumped version to 2.2.0-beta2
  175. # * Fixed clean-graphics to get rid of intermediate .eps files that may
  176. # be hanging around
  177. # * Added an automatic setting to use eps terminals in pdflatex mode for
  178. # gnuplot if it doesn't understand pdf.
  179. # * issue 66: Removed grayscale generation via magic suffix. Grayscale
  180. # generation is now only available via GRAY=1
  181. # * issue 68: Added explicit handling of LC_ALL for locale-aware tools
  182. # like "sort"
  183. # Chris Monson (2010-03-10):
  184. # * Bumped version to 2.2.0-beta1
  185. # * Fixed success message to handle output message in different places
  186. # * Added name of produced file to success message
  187. # Chris Monson (2010-03-10):
  188. # * Bumped version to 2.2.0-alpha3
  189. # * Added meaningful error message for wrong hyperref options
  190. # * Added meaningful error message for incorrect graphics extensions
  191. # Chris Monson (2010-03-09):
  192. # * Bumped version to 2.2.0-alpha2
  193. # * Updated graphics handling (gnuplot and fig generate pdf natively)
  194. # * Changed xmgrace to output monochrome natively
  195. # Chris Monson (2010-03-09):
  196. # * Bumped version to 2.2.0-alpha1 - major change!
  197. # * Support pdflatex natively and by default (issue 6 - a long time coming)
  198. # * Add ability to have a single $HOME/.latex-makefile/Makefile.ini for
  199. # all invocations
  200. # * Reworked graphic inclusion detection so that extensions need not be
  201. # specified for either build strategy (e.g.,
  202. # \includegraphics{test1.eps} -> \includegrahpics{test1})
  203. # * Changed log format to include filenames and line numbers
  204. # Chris Monson (2010-02-04):
  205. # * Bumped version to 2.1.43
  206. # * All of the following are for issue 63 (thanks to mojoh81):
  207. # * Added documentation about fixing Makefile.ini default target
  208. # * Added perl and python script targets
  209. # * Fixed run logic to allow included .tex files to be scripted (the
  210. # run-again logic now detects missing .tex files, and the MV
  211. # command has been switched out for a command that only invokes
  212. # MV if the files exist)
  213. # * Changed scripted generation to only run once per make invocation
  214. # * Added dependency on expr
  215. # Chris Monson (2010-01-19):
  216. # * Bumped version to 2.1.42
  217. # * issue 62: Added .brf extension to cleanable files (backrefs)
  218. # Chris Monson (2010-01-07):
  219. # * Bumped version to 2.1.41
  220. # * issue 60: bad makeindex runs now error out on subsequent tries
  221. # Chris Monson (2009-12-01):
  222. # * Bumped version to 2.1.40
  223. # * issue 36: build all indices (for e.g., splitidx usage)
  224. # * issue 59: clean up all generated files (including indices)
  225. # Chris Monson (2009-11-23):
  226. # * Bumped version to 2.1.39
  227. # * issue 57: change ps2pdf invocations to just use gs directly
  228. # Chris Monson (2009-11-19):
  229. # * Bumped version to 2.1.38
  230. # * issue 57: Added some limited support for Cygwin (spaces in filenames)
  231. # Chris Monson (2009-11-15):
  232. # * Bumped version to 2.1.37
  233. # * Removed svninfo, since this is now managed by mercurial
  234. # * Fixed typo in changelist
  235. # * Issue 52: added jpg->eps conversion (thanks to brubakee)
  236. # * Issue 54: fix missing Overfull colorization due to lack of a blank
  237. # line preceding the first error.
  238. # * Issue 51: remove head.tmp and body.tmp in make clean invocation
  239. # * Issue 56: maintain multiple versions of log files (for debugging)
  240. # Chris Monson (2009-11-14):
  241. # * Bumped version to 2.1.36
  242. # * Issues 53 and 49: added .brf, .mtc, and .maf to the cleanables
  243. # Chris Monson (2009-11-05):
  244. # * Bumped version to 2.1.35
  245. # * Added nomenclature support (see issue 48)
  246. # Chris Monson (2009-10-29):
  247. # * Bumped version to 2.1.34
  248. # * Fixed _out_ creation bug introduced in 2.1.33 (it was always created)
  249. # * Fixed erroneous help output for $HOME in BINARY_TARGET_DIR
  250. # * Changed contact email address - bring on the spam!
  251. # Chris Monson (2009-10-21):
  252. # * Bumped version to 2.1.33
  253. # * Fixed issue 46, adding support for dot2tex (thanks to fdemesmay)
  254. # * Made all_files.* settable in Makefile.ini (using ?= instead of :=)
  255. # * Fixed issue 47, thanks to fdemesmay: add binary copy directory, copy
  256. # dvi, pdf, and ps if it exists
  257. # Chris Monson (2009-09-25):
  258. # * Bumped version to 2.1.32
  259. # * Fixed so that a changed lol file will cause a rebuild
  260. # * Added .lol files to the cleanable list
  261. # Chris Monson (2009-09-08):
  262. # * Bumped version to 2.1.31
  263. # * Closed issue 43: evince doesn't notice pdf change w/out touch
  264. # Chris Monson (2009-08-28):
  265. # * Bumped version to 2.1.30
  266. # * Closed issue 39: Capture multi-line log warnings/errors to output
  267. # Chris Monson (2009-08-26):
  268. # * Bumped version to 2.1.29
  269. # * Closed issue 42: add svg support using inkscape
  270. # Chris Monson (2009-08-17):
  271. # * Bumped version to 2.1.28
  272. # * Patch from paul.biggar for issue 38: package warnings are overlooked
  273. # Chris Monson (2009-08-07):
  274. # * Bumped version to 2.1.27
  275. # * Included patch for issue 37 - removes pdf/ps files before copying,
  276. # allowing some broken viewers to see changes properly.
  277. # Chris Monson (2009-05-15):
  278. # * Bumped version to 2.1.26
  279. # * Included patch for issue 9 from favonia - detects .fig changes for
  280. # pstex files during regular compilation, so long as the pstex
  281. # has been built at least once with make all-pstex.
  282. # Chris Monson (2009-03-27):
  283. # * Bumped version to 2.1.25
  284. # * Cleaned up a bunch of variable setting stuff - more stuff is now
  285. # settable from Makefile.ini
  286. # * Cleaned up documentation for various features, especially settable
  287. # variables.
  288. # * issue 28: support for png -> eps conversion (it even looks good!)
  289. # * issue 29: support for "neverclean" files in Makefile.ini
  290. # * issue 30: make ps2pdf14 the default - fall back when not there
  291. # Chris Monson (2009-03-09):
  292. # * Bumped version to 2.1.24
  293. # * issue 27: xmgrace support (thanks to rolandschulzhd)
  294. # Chris Monson (2008-10-23):
  295. # * Bumped version to 2.1.23
  296. # * issue 23: fixed _check_programs to not use bash string subs
  297. # Chris Monson (2008-09-02):
  298. # * Bumped version to 2.1.22
  299. # * Appled patch from Holger <yllohy@googlemail.com> to add include
  300. # sources and some documentation updates.
  301. # * Updated backup_patterns to be a bit more aggressive (also thanks to
  302. # Holger)
  303. # Chris Monson (2008-08-30):
  304. # * Bumped version to 2.1.21
  305. # * Added ability to specify onlysources.* variables to indicate the only
  306. # files that should *not* be considered includes. Thanks to Holger
  307. # <yllohy@googlemail.com> for this patch.
  308. # * Added an automatic include of Makefile.ini if it exists. Allows
  309. # settings to be made outside of this makefile.
  310. # Chris Monson (2008-05-21):
  311. # * Bumped version to 2.1.20
  312. # * Added manual pstex compilation support (run make all-pstex first)
  313. # * Removed all automatic pstex support. It was totally breaking
  314. # everything and is very hard to incorporate into the makefile
  315. # concept because it requires LaTeX to *fail* before it can
  316. # determine that it needs the files.
  317. # Chris Monson (2008-04-17):
  318. # * Bumped version to 2.1.19
  319. # * Changed the pstex build hack to be on by default
  320. # Chris Monson (2008-04-09):
  321. # * Bumped version to 2.1.18
  322. # * issue 16: fixed pstex build problems, seems nondeterministic. Added
  323. # gratuitious hack for testing: set PSTEX_BUILD_ALL_HACK=1.
  324. # Chris Monson (2008-04-09):
  325. # * Bumped version to 2.1.17
  326. # * issue 20: fixed accumulation of <pid>*.make files - wildcard was
  327. # refusing to work on files that are very recently created.
  328. # Chris Monson (2008-04-02):
  329. # * Bumped version to 2.1.16
  330. # * issue 19: Removed the use of "type" to fix broken "echo" settings
  331. # Chris Monson (2008-03-27):
  332. # * Bumped version to 2.1.15
  333. # * issue 18: Favors binary echo over builtin, as binary understands -n
  334. # * issue 16: Fixed handling of missing pstex_t files in the log
  335. # * issue 9: Added .SECONDARY target for .pstex files
  336. # Chris Monson (2008-03-21):
  337. # * Bumped version to 2.1.14
  338. # * Fixed broken aux file flattening, which caused included bibs to be
  339. # missed.
  340. # Chris Monson (2008-03-20):
  341. # * Bumped version to 2.1.13
  342. # * Changed error output colorization to show errors for missing files
  343. # that are not graphics files.
  344. # Chris Monson (2008-03-20):
  345. # * Bumped version to 2.1.12
  346. # * Fixed a regression introduced in r28 that makes bibtex fail when
  347. # there is no index file present
  348. # Chris Monson (2008-03-03):
  349. # * Bumped version to 2.1.11
  350. # * Fixed issue 11 (handle index files, reported by abachn)
  351. # * Cleaned up some comments and help text
  352. # Chris Monson (2008-01-24):
  353. # * Bumped version to 2.1.10
  354. # * Fixed to work when 'sh' is a POSIX shell like 'dash'
  355. # Chris Monson (2007-12-12):
  356. # * Bumped version to 2.1.9
  357. # * Fixed documentation and dependency graph for pstex files
  358. # Chris Monson (2007-12-12):
  359. # * Bumped version to 2.1.8
  360. # * Added basic pstex_t support for fig files (Issue 9 by favonia)
  361. # I still suggest that psfrag be used instead.
  362. # Chris Monson (2007-10-16):
  363. # * Bumped version to 2.1.7
  364. # * Removed todo item: allow other comment directives for rst conversion
  365. # * Added ability to use global rst style file _rststyle_._include_.tex
  366. # * Added help text to that effect
  367. # Chris Monson (2007-05-20):
  368. # * Bumped version to 2.1.6
  369. # * Changed default paper size for rst files
  370. # * Added todo item: fix paper size for rst files
  371. # * Added todo item: allow other comment directives for rst conversion
  372. # Chris Monson (2007-04-02):
  373. # * Bumped version to 2.1.5
  374. # * Addressed Issue 7, incorrect .gpi.d generation in subdirectories
  375. # Chris Monson (2007-03-28):
  376. # * Bumped version to 2.1.4
  377. # * Fixed syntax error in dot output
  378. # Chris Monson (2007-03-01):
  379. # * Bumped version to 2.1.3
  380. # * Added reST to the included documentation
  381. # * Fixed graphics and script generation to be settable in the
  382. # environment.
  383. # Chris Monson (2007-02-23):
  384. # * Bumped version to 2.1.2
  385. # * Added the ability to generate .tex files from .rst files
  386. # Chris Monson (2006-10-17):
  387. # * Bumped version to 2.1.1
  388. # * Fixed includes from subdirectories (sed-to-sed slash escape problem)
  389. # Chris Monson (2006-10-05):
  390. # * Bumped version to 2.1.0 (pretty serious new feature added)
  391. # * New feature: bib files can now be anywhere on the BIBINPUTS path
  392. # * New programs: kpsewhich (with tetex) and xargs (BSD)
  393. # Chris Monson (2006-09-28):
  394. # * Bumped version to 2.0.9
  395. # * Added ability to parse more than one bibliography
  396. # Chris Monson (2006-06-01):
  397. # * Bumped version to 2.0.8
  398. # * Added .vrb to the list of cleaned files
  399. # Chris Monson (2006-04-26):
  400. # * Bumped version to 2.0.7
  401. # * Fixed so that clean-nographics does not remove .gpi.d files
  402. # * Removed jpg -> eps hack (not working properly -- just pre-convert)
  403. # * Fixed so that postscript grayscale can be done with BSD sed
  404. # Chris Monson (2006-04-25):
  405. # * Bumped version to 2.0.6
  406. # * Fixed so that changed toc, lot, lof, or out causes a rebuild
  407. # Chris Monson (2006-04-17):
  408. # * Bumped version to 2.0.5
  409. # * Added jpg -> eps conversion target
  410. # Chris Monson (2006-04-12):
  411. # * Bumped version to 2.0.4
  412. # * Fixed BSD sed invocation to not use \| as a branch delimiter
  413. # * Added a comment section on what is and is not allowed in BSD sed
  414. # * Made paper size handling more robust while I was at it
  415. # * Fixed postscript RGB grayscale to use a weighted average
  416. # * Fixed postscript HSB grayscale to convert to RGB first
  417. # * Fixed a problem with rebuilding .bbl files
  418. # Chris Monson (2006-04-11):
  419. # * Bumped version to 2.0.3
  420. # * Fixed some BSD sed problems: can't use \n in substitutions
  421. # Chris Monson (2006-04-10):
  422. # * Bumped version to 2.0.2
  423. # * Once again removed ability to create .tex files from scripts
  424. # * \includeonly works again
  425. # Chris Monson (2006-04-09):
  426. # * Bumped version to 2.0.1
  427. # * Fixed grayscale postscript handling to be more robust
  428. # * Added ability to generate ._gray_. files from eps and eps.gz
  429. # * Added ability to clean ._gray_.eps files created from .eps files
  430. # Chris Monson (2006-04-07):
  431. # * Bumped version to 2.0.0
  432. # * Removed clunky ability to create included .tex files from scripts
  433. # * Added note in the help about included tex scripting not working
  434. # * Fixed the .eps generation to delete %.gpihead.make when finished
  435. # * Abandoned designs to use shell variables to create sed scripts
  436. # * Abandoned __default__.tex.sh idea: it causes recursion with %: .
  437. # * Removed web page to-do. All items are now complete.
  438. # * Added better grayscale conversion for dot figures (direct ps fixup).
  439. # * Include files can now be scripted (at the expense of \includeonly).
  440. # * Updated dependency graph to contain better node names.
  441. # Chris Monson (2006-04-06):
  442. # * Bumped version to 2.0b3
  443. # * Top level includes now fail if there is no rule to build them
  444. # * A helpful message is printed when they do fail
  445. # * Grayscale has been changed to be ._gray_, other phonies use _ now, too
  446. # * Grayscale handling has been completed
  447. # * Changed _include_stems target to _includes target.
  448. # * Fixed _includes target to be useful by itself.
  449. # * Removed the ability to specify clean and build targets at once
  450. # * Verified that epsfig works fine with current code
  451. # * Fixed included scripts so that they are added to the dep files
  452. # * Fixed so that graphics includes don't happen if they aren't for gpi
  453. # * Fixed dot output to allow grayscale.
  454. # Chris Monson (2006-04-05):
  455. # * Bumped version to 2.0b2
  456. # * Removed automatic -gray output. It needs fixing in a bad way.
  457. # * Revamped dependency creation completely.
  458. # * Fixed conditional inclusion to actually work (test.nobuild.d, test.d).
  459. # * Fixed clean target to remove log targets
  460. # * Added the 'monochrome' word for gray gpi output
  461. # * Added a _check_gpi_files target that checks for common problems
  462. # * Changed the _version target into the version target (no _)
  463. # * Added better handling of grayscale files. Use the .gray.pdf target.
  464. # * Fixed testing for rebuilds
  465. # Chris Monson (2006-04-04):
  466. # * Bumped version to 2.0b1
  467. # * Changed colorization of output
  468. # * Made .auxbbl and .auxtex .make files secondary targets
  469. # * Shortened and simplified the final latex invocation loop
  470. # * Added version-specific output ($$i vs. $$$$i) in latex loop
  471. # * Added a build message for the first .dvi run (Building .dvi (0))
  472. # * Removed some build messages that most people don't care about.
  473. # * Simplified procedure for user-set colors -- simple text specification
  474. # * Fixed diff output to...not output.
  475. # * Fixed rerun bug -- detect not only when preceded with LaTeX Warning
  476. # * Sped up gpi plotting
  477. # * Added error handling and colorized output for gpi failure
  478. # * Documented color changing stuff.
  479. # * Now sort the flattened aux file to avoid false recompilation needs
  480. # * Added clean-nographics target
  481. # * Don't remove self.dvi file if self.aux is missing in the log
  482. # * Clarified some code. Did some very minor adjusting.
  483. # Chris Monson (2006-04-03):
  484. # * Bumped version to 2.0a7
  485. # * Added .dvi and .ps files as secondary files.
  486. # * Fixed handling of multiple run detection when includeonly is in use.
  487. # * Added code to flatten .aux files.
  488. # * Added more files as .SECONDARY prerequisites to avoid recompilation.
  489. # * Fixed the inputs generation to be much simpler and to use pipes.
  490. # * Added the dependency graph directly into the makefile.
  491. # * Changed flatten-aux to remove \@writefile \relax \newlabel, etc.
  492. # * Undid pipe changes with sed usage (BSD sed doesn't know -f-).
  493. # * Added a _check_programs target that tells you what your system has.
  494. # * Fixed an error in colorization that made unnecessary errors appear
  495. # * Added view targets.
  496. # * Updated help text.
  497. # * Augmented cookies so that .aux can trigger .bbl and .dvi rebuilds
  498. # * Added more informative error handling for dvips and ps2pdf
  499. # Chris Monson (2006-04-02):
  500. # * Bumped version to 2.0a6
  501. # * Added indirection to .bbl dependencies to avoid rebuilding .bbl files
  502. # * Streamlined the diff invocation to eliminate an existence test
  503. # * Removed special shell quote escape variables
  504. # * Moved includes to a more prominent location
  505. # * Fixed .inputs.make to not contain .aux files
  506. # * Fixed embedding to use a file instead of always grepping.
  507. # * Added *.make.temp to the list of cleanable files
  508. # * Fixed Ruby. It should now be supported properly.
  509. # * Now differentiate between all, default, and buildable files.
  510. # * Fixed to bail out on serious errors.
  511. # * Revised the handling of includable files. Still working on it.
  512. # Chris Monson (2006-03-31):
  513. # * Bumped version to 2.0a5
  514. # * Fixed a bug with LaTeX error detection (there can be spaces)
  515. # * Added .bbl support, simplifying everything and making it more correct
  516. # * Refactored some tests that muddy the code
  517. # * Did a little cleanup of some shell loops that can safely be make loops
  518. # * Added support for graphviz .dot files
  519. # * Made _all_programs output easier to read
  520. # * Added the ruby support that has long been advertised
  521. # * Font embedding was screwed up for PostScript -- now implicit
  522. # * Changed the generation of -gray.gpi files to a single command
  523. # * Changed any make-generated file that is not included from .d to .make
  524. # Chris Monson (2006-03-30):
  525. # * Bumped version to 2.0a4
  526. # * Fixed a bug with very long graphics file names
  527. # * Added a todo entry for epsfig support
  528. # * Fixed a bug paper size bug: sometimes more than one entry appears
  529. # * Fixed DVI build echoing to display the number instead of process ID
  530. # * DVI files are now removed on first invocation if ANY file is missing
  531. # * Added a simple grayscale approach: if a file ends with -gray.gpi, it
  532. # is created from the corresponding .gpi file with a special
  533. # comment ##GRAY in its header, which causes coloring to be
  534. # turned off.
  535. # * Fixed a bug in the handling of .tex.sh files. For some reason I had
  536. # neglected to define file stems for scripted output.
  537. # * Removed a trailing ; from the %.graphics dependencies
  538. # * Added dvips embedding (I think it works, anyway)
  539. # Chris Monson (2006-03-29):
  540. # * Bumped version to 2.0a3
  541. # * Fixed error in make 3.79 with MAKEFILE_LIST usage
  542. # * Added the presumed filename to the _version output
  543. # * Added a vim macro for converting sed scripts to make commands
  544. # * Added gpi dependency support (plotting external files and loading gpi)
  545. # * Allow .gpi files to be ignored if called .include.gpi or .nobuild.gpi
  546. # * Fixed sed invocations where \+ was used. BSD sed uses \{1,\}.
  547. # Chris Monson (2006-03-28):
  548. # * Bumped version to 2.0a2
  549. # * Added SHELL_DEBUG and VERBOSE options
  550. # * Changed the default shell back to /bin/sh (unset, in other words)
  551. # * Moved .PHONY declarations closer to their targets
  552. # * Moved help text into its own define block to obtain better formatting
  553. # * Removed need for double-entry when adding a new program invocation
  554. # * Moved .SECONDARY declaration closer to its relevant occurrence
  555. # * Commented things more heavily
  556. # * Added help text about setting terminal and output in gnuplot
  557. # * Created more fine-grained clean targets
  558. # * Added a %.graphics target that generates all of %'s graphics
  559. # * Killed backward-compatible graphics generation (e.g., eps.gpi=gpi.eps)
  560. # * For now, we're just GPL 2, not 3. Maybe it will change later
  561. # * Made the version and svninfo into variables
  562. # Chris Monson (2006-03-27):
  563. # * Bumped version to 2.0a1
  564. # * Huge, sweeping changes -- automatic dependencies
  565. # IMPORTANT!
  566. #
  567. # When adding to the following list, do not introduce any blank lines. The
  568. # list is extracted for documentation using sed and is terminated by a blank
  569. # line.
  570. #
  571. # EXTERNAL PROGRAMS:
  572. # = ESSENTIAL PROGRAMS =
  573. # == Basic Shell Utilities ==
  574. CAT ?= cat
  575. CP ?= cp -f
  576. DIFF ?= diff
  577. ECHO ?= echo
  578. EGREP ?= egrep
  579. ENV ?= env
  580. EXPR ?= expr
  581. MV ?= mv -f
  582. SED ?= sed
  583. SORT ?= sort
  584. TOUCH ?= touch
  585. UNIQ ?= uniq
  586. WHICH ?= which
  587. XARGS ?= xargs
  588. SLEEP ?= sleep
  589. # == LaTeX (tetex-provided) ==
  590. BIBTEX ?= bibtex
  591. DVIPS ?= dvips
  592. LATEX ?= latex
  593. PDFLATEX ?= pdflatex
  594. EPSTOPDF ?= epstopdf
  595. MAKEINDEX ?= makeindex
  596. KPSEWHICH ?= kpsewhich
  597. GS ?= gs
  598. # = OPTIONAL PROGRAMS =
  599. # == Makefile Color Output ==
  600. TPUT ?= tput
  601. # == TeX Generation ==
  602. PERL ?= perl
  603. PYTHON ?= python
  604. RST2LATEX ?= rst2latex.py
  605. # == EPS Generation ==
  606. CONVERT ?= convert # ImageMagick
  607. DOT ?= dot # GraphViz
  608. DOT2TEX ?= dot2tex # dot2tex - add options (not -o) as needed
  609. FIG2DEV ?= fig2dev # XFig
  610. GNUPLOT ?= gnuplot # GNUplot
  611. INKSCAPE ?= inkscape # Inkscape (svg support)
  612. XMGRACE ?= xmgrace # XMgrace
  613. PNGTOPNM ?= pngtopnm # From NetPBM - step 1 for png -> eps
  614. PPMTOPGM ?= ppmtopgm # From NetPBM - (gray) step 2 for png -> eps
  615. PNMTOPS ?= pnmtops # From NetPBM - step 3 for png -> eps
  616. GUNZIP ?= gunzip # GZipped EPS
  617. # == Beamer Enlarged Output ==
  618. PSNUP ?= psnup
  619. # == Viewing Stuff ==
  620. VIEW_POSTSCRIPT ?= gv
  621. VIEW_PDF ?= xpdf
  622. VIEW_GRAPHICS ?= display
  623. # Command options for embedding fonts and postscript->pdf conversion
  624. PS_EMBED_OPTIONS ?= -dPDFSETTINGS=/printer -dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100
  625. PS_COMPATIBILITY ?= 1.4
  626. # Defaults for GPI
  627. DEFAULT_GPI_EPS_FONTSIZE ?= 22
  628. DEFAULT_GPI_PDF_FONTSIZE ?= 12
  629. # Style file for ReST
  630. RST_STYLE_FILE ?= $(wildcard _rststyle_._include_.tex)
  631. # This ensures that even when echo is a shell builtin, we still use the binary
  632. # (the builtin doesn't always understand -n)
  633. FIXED_ECHO := $(if $(findstring -n,$(shell $(ECHO) -n)),$(shell which echo),$(ECHO))
  634. ECHO := $(if $(FIXED_ECHO),$(FIXED_ECHO),$(ECHO))
  635. define determine-gnuplot-output-extension
  636. $(if $(shell $(WHICH) $(GNUPLOT)),
  637. $(if $(findstring unknown or ambiguous, $(shell $(GNUPLOT) -e "set terminal pdf" 2>&1)),
  638. eps, pdf),
  639. none)
  640. endef
  641. GNUPLOT_OUTPUT_EXTENSION ?= $(strip $(call determine-gnuplot-output-extension))
  642. # Directory into which we place "binaries" if it exists.
  643. # Note that this can be changed on the commandline or in Makefile.ini:
  644. #
  645. # Command line:
  646. # make BINARY_TARGET_DIR=$HOME/pdfs myfile.pdf
  647. #
  648. # Also, you can specify a relative directory (relative to the Makefile):
  649. # make BINARY_TARGET_DIR=pdfs myfile.pdf
  650. #
  651. # Or, you can use Makefile.ini:
  652. #
  653. # BINARY_TARGET_DIR := $(HOME)/bin_out
  654. #
  655. BINARY_TARGET_DIR ?= _out_
  656. RESTARTS := $(if $(MAKE_RESTARTS),$(MAKE_RESTARTS),0)
  657. # SH NOTES
  658. #
  659. # On some systems, /bin/sh, which is the default shell, is not linked to
  660. # /bin/bash. While bash is supposed to be sh-compatible when invoked as sh, it
  661. # just isn't. This section details some of the things you have to stay away
  662. # from to remain sh-compatible.
  663. #
  664. # * File pattern expansion does not work for {}
  665. # * [ "$x" = "$y" ] has to be [ x"$x" x"$y" ]
  666. # * &> for stderr redirection doesn't work, use 2>&1 instead
  667. #
  668. # BSD SED NOTES
  669. #
  670. # BSD SED is not very nice compared to GNU sed, but it is the most
  671. # commonly-invoked sed on Macs (being based on BSD), so we have to cater to
  672. # it or require people to install GNU sed. It seems like the GNU
  673. # requirement isn't too bad since this makefile is really a GNU makefile,
  674. # but apparently GNU sed is much less common than GNU make in general, so
  675. # I'm supporting it here.
  676. #
  677. # Sad experience has taught me the following about BSD sed:
  678. #
  679. # * \+ is not understood to mean \{1,\}
  680. # * \| is meaningless (does not branch)
  681. # * \n cannot be used as a substitution character
  682. # * ? does not mean \{0,1\}, but is literal
  683. # * a\ works, but only reliably for a single line if subsequent lines
  684. # have forward slashes in them (as is the case in postscript)
  685. #
  686. # For more info (on the Mac) you can consult
  687. #
  688. # man -M /usr/share/man re_format
  689. #
  690. # And look for the word "Obsolete" near the bottom.
  691. #
  692. # EXTERNAL PROGRAM DOCUMENTATION SCRIPT
  693. #
  694. # $(call output-all-programs,[<output file>])
  695. define output-all-programs
  696. [ -f '$(this_file)' ] && \
  697. $(SED) \
  698. -e '/^[[:space:]]*#[[:space:]]*EXTERNAL PROGRAMS:/,/^$$/!d' \
  699. -e '/EXTERNAL PROGRAMS/d' \
  700. -e '/^$$/d' \
  701. -e '/^[[:space:]]*#/i\ '\
  702. -e 's/^[[:space:]]*#[[:space:]][^=]*//' \
  703. $(this_file) $(if $1,> '$1',) || \
  704. $(ECHO) "Cannot determine the name of this makefile."
  705. endef
  706. # If they misspell gray, it should still work.
  707. GRAY ?= $(call get-default,$(GREY),)
  708. #
  709. # Utility Functions and Definitions
  710. #
  711. # While not exactly a make function, this vim macro is useful. It takes a
  712. # verbatim sed script and converts each line to something suitable in a command
  713. # context. Just paste the script's contents into the editor, yank this into a
  714. # register (starting at '0') and run the macro once for each line of the
  715. # original script:
  716. #
  717. # 0i -e :s/\$/$$/eg :s/'/'"'"'/eg ^Ela'A' \:noh j
  718. # don't call this directly - it is here to avoid calling wildcard more than
  719. # once in remove-files.
  720. remove-files-helper = $(if $1,$(RM) $1,$(sh_true))
  721. # $(call remove-files,file1 file2)
  722. remove-files = $(call remove-files-helper,$(wildcard $1))
  723. # Removes all cleanable files in the given list
  724. # $(call clean-files,file1 file2 file3 ...)
  725. # Works exactly like remove-files, but filters out files in $(neverclean)
  726. clean-files = \
  727. $(call remove-files-helper,$(call cleanable-files,$(wildcard $1)))
  728. # Outputs all generated files to STDOUT, along with some others that are
  729. # created by these (e.g., .idx files end up producing .ilg and .ind files).
  730. # Discovered by reading *.fls OUTPUT lines and producing corresponding .ind
  731. # filenames as needed.
  732. #
  733. # $(call get-generated-names,<source recorder file (*.fls)>)
  734. define get-generated-names
  735. [ -f '$1' ] && \
  736. $(SED) \
  737. -e '/^OUTPUT /{' \
  738. -e ' s///' \
  739. -e ' p' \
  740. -e ' s/\.idx/\.ind/p' \
  741. -e ' s/\.ind/\.ilg/p' \
  742. -e '}' \
  743. -e 'd' \
  744. '$1' \
  745. | $(SORT) | $(UNIQ)
  746. endef
  747. # This removes files without checking whether they are there or not. This
  748. # sometimes has to be used when the file is created by a series of shell
  749. # commands, but there ends up being a race condition: make doesn't know about
  750. # the file generation as quickly as the system does, so $(wildcard ...) doesn't
  751. # work right. Blech.
  752. # $(call remove-temporary-files,filenames)
  753. remove-temporary-files = $(if $1,$(RM) $1,:)
  754. # Create an identifier from a file name
  755. # $(call cleanse-filename,filename)
  756. cleanse-filename = $(subst .,_,$(subst /,__,$1))
  757. # Escape dots
  758. # $(call escape-dots,str)
  759. escape-dots = $(subst .,\\.,$1)
  760. # Test that a file exists
  761. # $(call test-exists,file)
  762. test-exists = [ -e '$1' ]
  763. # $(call move-files,source,destination)
  764. move-if-exists = $(call test-exists,$1) && $(MV) '$1' '$2'
  765. # Copy file1 to file2 only if file2 doesn't exist or they are different
  766. # $(call copy-if-different,sfile,dfile)
  767. copy-if-different = $(call test-different,$1,$2) && $(CP) '$1' '$2'
  768. copy-if-exists = $(call test-exists,$1) && $(CP) '$1' '$2'
  769. move-if-different = $(call test-different,$1,$2) && $(MV) '$1' '$2'
  770. replace-if-different-and-remove = \
  771. $(call test-different,$1,$2) \
  772. && $(MV) '$1' '$2' \
  773. || $(call remove-files,'$1')
  774. # Note that $(DIFF) returns success when the files are the SAME....
  775. # $(call test-different,sfile,dfile)
  776. test-different = ! $(DIFF) -q '$1' '$2' >/dev/null 2>&1
  777. test-exists-and-different = \
  778. $(call test-exists,$2) && $(call test-different,$1,$2)
  779. # Return value 1, or value 2 if value 1 is empty
  780. # $(call get-default,<possibly empty arg>,<default value if empty>)
  781. get-default = $(if $1,$1,$2)
  782. # Copy a file and log what's going on
  783. # $(call copy-with-logging,<source>,<target>)
  784. define copy-with-logging
  785. if [ -d '$2/' ]; then \
  786. if $(CP) '$1' '$2/'; then \
  787. $(ECHO) "$(C_INFO)Copied '$1' to '$2/'$(C_RESET)"; \
  788. else \
  789. $(ECHO) "$(C_ERROR)Failed to copy '$1' to '$2/'$(C_RESET)"; \
  790. fi; \
  791. fi
  792. endef
  793. # Gives a reassuring message about the failure to find include files
  794. # $(call include-message,<list of include files>)
  795. define include-message
  796. $(strip \
  797. $(if $(filter-out $(wildcard $1),$1),\
  798. $(shell $(ECHO) \
  799. "$(C_INFO)NOTE: You may ignore warnings about the"\
  800. "following files:" >&2;\
  801. $(ECHO) >&2; \
  802. $(foreach s,$(filter-out $(wildcard $1),$1),$(ECHO) ' $s' >&2;)\
  803. $(ECHO) "$(C_RESET)" >&2)
  804. ))
  805. endef
  806. # Characters that are hard to specify in certain places
  807. space := $(empty) $(empty)
  808. colon := \:
  809. comma := ,
  810. # Useful shell definitions
  811. sh_true := :
  812. sh_false := ! :
  813. # Clear out the standard interfering make suffixes
  814. .SUFFIXES:
  815. # Turn off forceful rm (RM is usually mapped to rm -f)
  816. ifdef SAFE_RM
  817. RM := rm
  818. endif
  819. # Turn command echoing back on with VERBOSE=1
  820. ifndef VERBOSE
  821. QUIET := @
  822. endif
  823. # Turn on shell debugging with SHELL_DEBUG=1
  824. # (EVERYTHING is echoed, even $(shell ...) invocations)
  825. ifdef SHELL_DEBUG
  826. SHELL += -x
  827. endif
  828. # Get the name of this makefile (always right in 3.80, often right in 3.79)
  829. # This is only really used for documentation, so it isn't too serious.
  830. ifdef MAKEFILE_LIST
  831. this_file := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
  832. else
  833. this_file := $(wildcard GNUmakefile makefile Makefile)
  834. endif
  835. # Terminal color definitions
  836. REAL_TPUT := $(if $(NO_COLOR),,$(shell $(WHICH) $(TPUT)))
  837. # $(call get-term-code,codeinfo)
  838. # e.g.,
  839. # $(call get-term-code,setaf 0)
  840. get-term-code = $(if $(REAL_TPUT),$(shell $(REAL_TPUT) $1),)
  841. black := $(call get-term-code,setaf 0)
  842. red := $(call get-term-code,setaf 1)
  843. green := $(call get-term-code,setaf 2)
  844. yellow := $(call get-term-code,setaf 3)
  845. blue := $(call get-term-code,setaf 4)
  846. magenta := $(call get-term-code,setaf 5)
  847. cyan := $(call get-term-code,setaf 6)
  848. white := $(call get-term-code,setaf 7)
  849. bold := $(call get-term-code,bold)
  850. uline := $(call get-term-code,smul)
  851. reset := $(call get-term-code,sgr0)
  852. #
  853. # User-settable definitions
  854. #
  855. LATEX_COLOR_WARNING ?= magenta
  856. LATEX_COLOR_ERROR ?= red
  857. LATEX_COLOR_INFO ?= green
  858. LATEX_COLOR_UNDERFULL ?= magenta
  859. LATEX_COLOR_OVERFULL ?= red bold
  860. LATEX_COLOR_PAGES ?= bold
  861. LATEX_COLOR_BUILD ?= cyan
  862. LATEX_COLOR_GRAPHIC ?= yellow
  863. LATEX_COLOR_DEP ?= green
  864. LATEX_COLOR_SUCCESS ?= green bold
  865. LATEX_COLOR_FAILURE ?= red bold
  866. # Gets the real color from a simple textual definition like those above
  867. # $(call get-color,ALL_CAPS_COLOR_NAME)
  868. # e.g., $(call get-color,WARNING)
  869. get-color = $(subst $(space),,$(foreach c,$(LATEX_COLOR_$1),$($c)))
  870. #
  871. # STANDARD COLORS
  872. #
  873. C_WARNING := $(call get-color,WARNING)
  874. C_ERROR := $(call get-color,ERROR)
  875. C_INFO := $(call get-color,INFO)
  876. C_UNDERFULL := $(call get-color,UNDERFULL)
  877. C_OVERFULL := $(call get-color,OVERFULL)
  878. C_PAGES := $(call get-color,PAGES)
  879. C_BUILD := $(call get-color,BUILD)
  880. C_GRAPHIC := $(call get-color,GRAPHIC)
  881. C_DEP := $(call get-color,DEP)
  882. C_SUCCESS := $(call get-color,SUCCESS)
  883. C_FAILURE := $(call get-color,FAILURE)
  884. C_RESET := $(reset)
  885. #
  886. # PRE-BUILD TESTS
  887. #
  888. # Check that clean targets are not combined with other targets (weird things
  889. # happen, and it's not easy to fix them)
  890. hascleangoals := $(if $(sort $(filter clean clean-%,$(MAKECMDGOALS))),1)
  891. hasbuildgoals := $(if $(sort $(filter-out clean clean-%,$(MAKECMDGOALS))),1)
  892. ifneq "$(hasbuildgoals)" ""
  893. ifneq "$(hascleangoals)" ""
  894. $(error $(C_ERROR)Clean and build targets specified together$(C_RESET)))
  895. endif
  896. endif
  897. #
  898. # VARIABLE DECLARATIONS
  899. #
  900. # Names of sed scripts that morph gnuplot files -- only the first found is used
  901. GNUPLOT_SED := global-gpi.sed gnuplot.sed
  902. GNUPLOT_GLOBAL := global._include_.gpi gnuplot.global
  903. ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
  904. default_graphic_extension ?= eps
  905. latex_build_program ?= $(LATEX)
  906. build_target_extension ?= dvi
  907. hyperref_driver_pattern ?= hdvips
  908. hyperref_driver_error ?= Using dvips: specify ps2pdf in the hyperref options.
  909. else
  910. default_graphic_extension ?= pdf
  911. latex_build_program ?= $(PDFLATEX)
  912. build_target_extension ?= pdf
  913. hyperref_driver_pattern ?= hpdf.*
  914. hyperref_driver_error ?= Using pdflatex: specify pdftex in the hyperref options (or leave it blank).
  915. endif
  916. # Files of interest
  917. all_files.tex ?= $(wildcard *.tex)
  918. all_files.tex.sh ?= $(wildcard *.tex.sh)
  919. all_files.tex.pl ?= $(wildcard *.tex.pl)
  920. all_files.tex.py ?= $(wildcard *.tex.py)
  921. all_files.rst ?= $(wildcard *.rst)
  922. all_files.fig ?= $(wildcard *.fig)
  923. all_files.gpi ?= $(wildcard *.gpi)
  924. all_files.dot ?= $(wildcard *.dot)
  925. all_files.xvg ?= $(wildcard *.xvg)
  926. all_files.svg ?= $(wildcard *.svg)
  927. all_files.png ?= $(wildcard *.png)
  928. all_files.jpg ?= $(wildcard *.jpg)
  929. all_files.eps.gz ?= $(wildcard *.eps.gz)
  930. all_files.eps ?= $(wildcard *.eps)
  931. # Utility function for obtaining all files not specified in $(neverclean)
  932. # $(call cleanable-files,file1 file2 file3 ...)
  933. # Returns the list of files that is not in $(wildcard $(neverclean))
  934. cleanable-files = $(filter-out $(wildcard $(neverclean)), $1)
  935. # Utility function for getting all .$1 files that are to be ignored
  936. # * files listed in $(includes.$1)
  937. # * files not listed in $(onlysources.$1) if it is defined
  938. ignore_files = \
  939. $(includes.$1) \
  940. $(if $(onlysources.$1),$(filter-out $(onlysources.$1), $(all_files.$1)))
  941. # Patterns to never be allowed as source targets
  942. ignore_patterns := %._include_
  943. # Patterns allowed as source targets but not included in 'all' builds
  944. nodefault_patterns := %._nobuild_ $(ignore_patterns)
  945. # Utility function for getting targets suitable building
  946. # $(call filter-buildable,suffix)
  947. filter-buildable = \
  948. $(filter-out $(call ignore_files,$1) \
  949. $(addsuffix .$1,$(ignore_patterns)),$(all_files.$1))
  950. # Utility function for getting targets suitable for 'all' builds
  951. # $(call filter-default,suffix)
  952. filter-default = \
  953. $(filter-out $(call ignore_files,$1) \
  954. $(addsuffix .$1,$(nodefault_patterns)),$(all_files.$1))
  955. # Top level sources that can be built even when they are not by default
  956. files.tex := $(call filter-buildable,tex)
  957. files.tex.sh := $(call filter-buildable,tex.sh)
  958. files.tex.pl := $(call filter-buildable,tex.pl)
  959. files.tex.py := $(call filter-buildable,tex.py)
  960. files.rst := $(call filter-buildable,rst)
  961. files.gpi := $(call filter-buildable,gpi)
  962. files.dot := $(call filter-buildable,dot)
  963. files.fig := $(call filter-buildable,fig)
  964. files.xvg := $(call filter-buildable,xvg)
  965. files.svg := $(call filter-buildable,svg)
  966. files.png := $(call filter-buildable,png)
  967. files.jpg := $(call filter-buildable,jpg)
  968. files.eps.gz := $(call filter-buildable,eps.gz)
  969. # Make all pstex targets secondary. The pstex_t target requires the pstex
  970. # target, and nothing else really depends on it, so it often gets deleted.
  971. # This avoids that by allowing *all* fig files to be pstex targets, which is
  972. # perfectly valid and causes no problems even if they're going to become eps
  973. # files in the end.
  974. .SECONDARY: $(patsubst %.fig,%.pstex,$(files.fig))
  975. # Top level sources that are built by default targets
  976. default_files.tex := $(call filter-default,tex)
  977. default_files.tex.sh := $(call filter-default,tex.sh)
  978. default_files.tex.pl := $(call filter-default,tex.pl)
  979. default_files.tex.py := $(call filter-default,tex.py)
  980. default_files.rst := $(call filter-default,rst)
  981. default_files.gpi := $(call filter-default,gpi)
  982. default_files.dot := $(call filter-default,dot)
  983. default_files.fig := $(call filter-default,fig)
  984. default_files.xvg := $(call filter-default,xvg)
  985. default_files.svg := $(call filter-default,svg)
  986. default_files.png := $(call filter-default,png)
  987. default_files.jpg := $(call filter-default,jpg)
  988. default_files.eps.gz := $(call filter-default,eps.gz)
  989. # Utility function for creating larger lists of files
  990. # $(call concat-files,suffixes,[prefix])
  991. concat-files = $(foreach s,$1,$($(if $2,$2_,)files.$s))
  992. # Useful file groupings
  993. all_files_source := $(call concat-files,tex,all)
  994. all_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,all)
  995. .PHONY: $(all_files_scripts)
  996. default_files_source := $(call concat-files,tex,default)
  997. default_files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst,default)
  998. files_source := $(call concat-files,tex)
  999. files_scripts := $(call concat-files,tex.sh tex.pl tex.py rst)
  1000. # Utility function for obtaining stems
  1001. # $(call get-stems,suffix,[prefix])
  1002. get-stems = $(sort $($(if $2,$2_,)files.$1:%.$1=%))
  1003. # List of all stems (including ._include_ and ._nobuild_ file stems)
  1004. all_stems.tex := $(call get-stems,tex,all)
  1005. all_stems.tex.sh := $(call get-stems,tex.sh,all)
  1006. all_stems.tex.pl := $(call get-stems,tex.pl,all)
  1007. all_stems.tex.py := $(call get-stems,tex.py,all)
  1008. all_stems.rst := $(call get-stems,rst,all)
  1009. all_stems.fig := $(call get-stems,fig,all)
  1010. all_stems.gpi := $(call get-stems,gpi,all)
  1011. all_stems.dot := $(call get-stems,dot,all)
  1012. all_stems.xvg := $(call get-stems,xvg,all)
  1013. all_stems.svg := $(call get-stems,svg,all)
  1014. all_stems.png := $(call get-stems,png,all)
  1015. all_stems.jpg := $(call get-stems,jpg,all)
  1016. all_stems.eps.gz := $(call get-stems,eps.gz,all)
  1017. all_stems.eps := $(call get-stems,eps,all)
  1018. # List of all default stems (all default PDF targets):
  1019. default_stems.tex := $(call get-stems,tex,default)
  1020. default_stems.tex.sh := $(call get-stems,tex.sh,default)
  1021. default_stems.tex.pl := $(call get-stems,tex.pl,default)
  1022. default_stems.tex.py := $(call get-stems,tex.py,default)
  1023. default_stems.rst := $(call get-stems,rst,default)
  1024. default_stems.fig := $(call get-stems,fig,default)
  1025. default_stems.gpi := $(call get-stems,gpi,default)
  1026. default_stems.dot := $(call get-stems,dot,default)
  1027. default_stems.xvg := $(call get-stems,xvg,default)
  1028. default_stems.svg := $(call get-stems,svg,default)
  1029. default_stems.png := $(call get-stems,png,default)
  1030. default_stems.jpg := $(call get-stems,jpg,default)
  1031. default_stems.eps.gz := $(call get-stems,eps.gz,default)
  1032. # List of all stems (all possible bare PDF targets created here):
  1033. stems.tex := $(call get-stems,tex)
  1034. stems.tex.sh := $(call get-stems,tex.sh)
  1035. stems.tex.pl := $(call get-stems,tex.pl)
  1036. stems.tex.py := $(call get-stems,tex.py)
  1037. stems.rst := $(call get-stems,rst)
  1038. stems.fig := $(call get-stems,fig)
  1039. stems.gpi := $(call get-stems,gpi)
  1040. stems.dot := $(call get-stems,dot)
  1041. stems.xvg := $(call get-stems,xvg)
  1042. stems.svg := $(call get-stems,svg)
  1043. stems.png := $(call get-stems,png)
  1044. stems.jpg := $(call get-stems,jpg)
  1045. stems.eps.gz := $(call get-stems,eps.gz)
  1046. # Utility function for creating larger lists of stems
  1047. # $(call concat-stems,suffixes,[prefix])
  1048. concat-stems = $(sort $(foreach s,$1,$($(if $2,$2_,)stems.$s)))
  1049. # The most likely to be source but not finished product go first
  1050. graphic_source_extensions := fig \
  1051. gpi \
  1052. xvg \
  1053. svg \
  1054. dot \
  1055. eps.gz
  1056. ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
  1057. graphic_source_extensions += png jpg
  1058. graphic_target_extensions := eps ps
  1059. else
  1060. graphic_source_extensions += eps
  1061. graphic_target_extensions := pdf png jpg mps tif
  1062. endif
  1063. all_stems_source := $(call concat-stems,tex,all)
  1064. all_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,all)
  1065. all_stems_graphic := $(call concat-stems,$(graphic_source_extensions),all)
  1066. all_stems_ss := $(sort $(all_stems_source) $(all_stems_script))
  1067. all_stems_sg := $(sort $(all_stems_script))
  1068. all_stems_ssg := $(sort $(all_stems_ss))
  1069. default_stems_source := $(call concat-stems,tex,default)
  1070. default_stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst,default)
  1071. default_stems_ss := $(sort $(default_stems_source) $(default_stems_script))
  1072. default_stems_sg := $(sort $(default_stems_script))
  1073. default_stems_ssg := $(sort $(default_stems_ss))
  1074. stems_source := $(call concat-stems,tex)
  1075. stems_script := $(call concat-stems,tex.sh tex.pl tex.py rst)
  1076. stems_graphic := $(call concat-stems,$(graphic_source_extensions))
  1077. stems_gg := $(sort $(stems_graphic))
  1078. stems_ss := $(sort $(stems_source) $(stems_script))
  1079. stems_sg := $(sort $(stems_script))
  1080. stems_ssg := $(sort $(stems_ss))
  1081. # Calculate names that can generate the need for an include file. We can't
  1082. # really do this with patterns because it's too easy to screw up, so we create
  1083. # an exhaustive list.
  1084. allowed_source_suffixes := \
  1085. pdf \
  1086. ps \
  1087. dvi \
  1088. ind \
  1089. nls \
  1090. bbl \
  1091. aux \
  1092. aux.make \
  1093. d \
  1094. auxbbl.make \
  1095. _graphics \
  1096. _show
  1097. allowed_source_patterns := $(addprefix %.,$(allowed_source_suffixes))
  1098. allowed_graphic_suffixes := \
  1099. pdf \
  1100. eps \
  1101. gpihead.make \
  1102. gpi.d
  1103. allowed_graphic_patterns := $(addprefix %.,$(allowed_graphic_suffixes))
  1104. # All targets allowed to build documents
  1105. allowed_source_targets := \
  1106. $(foreach suff,$(allowed_source_suffixes),\
  1107. $(addsuffix .$(suff),$(stems_ssg)))
  1108. # All targets allowed to build graphics
  1109. allowed_graphic_targets := \
  1110. $(foreach suff,$(allowed_graphic_suffixes),\
  1111. $(addsuffix .$(suff),$(stems_gg)))
  1112. # All targets that build multiple documents (like 'all')
  1113. allowed_batch_source_targets := \
  1114. all \
  1115. all-pdf \
  1116. all-ps \
  1117. all-dvi \
  1118. all-bbl \
  1119. all-ind \
  1120. all-gls \
  1121. all-nls \
  1122. show
  1123. # All targets that build multiple graphics (independent of document)
  1124. allowed_batch_graphic_targets := \
  1125. all-graphics \
  1126. all-pstex \
  1127. all-dot2tex \
  1128. show-graphics
  1129. # Now we figure out which stuff is available as a make target for THIS RUN.
  1130. real_goals := $(call get-default,$(filter-out _includes,$(MAKECMDGOALS)),\
  1131. all)
  1132. specified_source_targets := $(strip \
  1133. $(filter $(allowed_source_targets) $(stems_ssg),$(real_goals)) \
  1134. )
  1135. specified_batch_source_targets := $(strip \
  1136. $(filter $(allowed_batch_source_targets),$(real_goals)) \
  1137. )
  1138. specified_graphic_targets := $(strip \
  1139. $(filter $(allowed_graphic_targets),$(real_goals)) \
  1140. )
  1141. specified_batch_graphic_targets := $(strip \
  1142. $(filter $(allowed_batch_graphic_targets),$(real_goals)) \
  1143. )
  1144. specified_gpi_targets := $(patsubst %.gpi,%.$(default_graphic_extension),\
  1145. $(filter $(patsubst %.$(default_graphic_extension),%.gpi,$(specified_graphic_targets)),\
  1146. $(all_files.gpi)) \
  1147. )
  1148. # Determine which .d files need including from the information gained above.
  1149. # This is done by first checking whether a batch target exists. If it does,
  1150. # then all *default* stems are used to create possible includes (nobuild need
  1151. # not apply for batch status). If no batch targets exist, then the individual
  1152. # targets are considered and appropriate includes are taken from them.
  1153. source_stems_to_include := \
  1154. $(sort\
  1155. $(if $(specified_batch_source_targets),\
  1156. $(default_stems_ss),\
  1157. $(foreach t,$(specified_source_targets),\
  1158. $(foreach p,$(allowed_source_patterns),\
  1159. $(patsubst $p,%,$(filter $p $(stems_ssg),$t)) \
  1160. )) \
  1161. ))
  1162. # Determine which .gpi.d files are needed using the above information. We
  1163. # first check whether a batch target is specified, then check individual
  1164. # graphics that may have been specified.
  1165. graphic_stems_to_include := \
  1166. $(sort\
  1167. $(if $(specified_batch_graphic_targets),\
  1168. $(default_stems.gpi),\
  1169. $(foreach t,$(specified_gpi_targets),\
  1170. $(foreach p,$(allowed_graphic_patterns),\
  1171. $(patsubst $p,%,$(filter $p,$t)) \
  1172. )) \
  1173. ))
  1174. # All dependencies for the 'all' targets
  1175. all_pdf_targets := $(addsuffix .pdf,$(stems_ssg))
  1176. all_ps_targets := $(addsuffix .ps,$(stems_ssg))
  1177. all_dvi_targets := $(addsuffix .dvi,$(stems_ssg))
  1178. all_tex_targets := $(addsuffix .tex,$(stems_sg))
  1179. all_d_targets := $(addsuffix .d,$(stems_ssg))
  1180. all_graphics_targets := $(addsuffix .$(default_graphic_extension),$(stems_gg))
  1181. intermediate_graphics_targets := $(if $(filter pdf,$(default_graphic_extension)),$(addsuffix .eps,$(stems_gg)),)
  1182. all_pstex_targets := $(addsuffix .pstex_t,$(stems.fig))
  1183. all_dot2tex_targets := $(addsuffix .dot_t,$(stems.dot))
  1184. all_known_graphics := $(sort $(all_graphics_targets) $(wildcard *.$(default_graphic_extension)))
  1185. default_pdf_targets := $(addsuffix .pdf,$(default_stems_ss))
  1186. ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
  1187. d