├── LICENSE.txt ├── Makefile ├── README.md ├── TODO ├── config └── make │ ├── README │ ├── latex-mk │ ├── latex-mk │ ├── latex.gmk │ ├── latex.mk │ ├── latex.subdir.gmk │ ├── latex.subdir.mk │ ├── lgrind.gmk │ ├── lgrind.mk │ ├── mpost.gmk │ ├── mpost.mk │ ├── tgif.gmk │ ├── tgif.mk │ ├── xfig.gmk │ └── xfig.mk │ └── latex.mk ├── python-logo-notext.pdf ├── python-logo-notext.svg ├── python-logo.png ├── python-quick-ref.pdf └── python-quick-ref.tex /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | NAME = python-quick-ref 2 | USE_PDFLATEX = 1 3 | 4 | LATEX_ENV+=TEXINPUTS=.:tex:lisp:src:config:figs:data:lily:out: 5 | PDFLATEX_ENV+= $(LATEX_ENV) 6 | 7 | LATEX_MK = config/make/latex-mk/latex-mk 8 | include config/make/latex.mk 9 | include config/make/latex-mk/latex.gmk 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python quick reference 2 | 3 | This is a short cheat sheet for python 3.1. I wanted a quick reference 4 | for the core language that was short (2 pages tops) and beautiful and 5 | free. I found some but not quite what I was looking for, so I made 6 | this one using LaTeX. You can compile it from source or you can 7 | download it here: 8 | 9 | http://github.com/downloads/kroger/python-quick-ref/python-quick-ref.pdf 10 | 11 | 12 | # Thanks 13 | 14 | Sarabander made some adjustments in typesetting and color, used a 15 | vector graphics for the Python logo and fixed the URL. 16 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | # -*- org -*- 2 | 3 | * DONE slice operations 4 | CLOSED: [2010-03-28 Sun 17:18] 5 | * DONE file methods 6 | CLOSED: [2010-03-28 Sun 17:18] 7 | 8 | 9 | * keywords 10 | -------------------------------------------------------------------------------- /config/make/README: -------------------------------------------------------------------------------- 1 | No genos nos trabalhomos com a seguinte estrutura de diretório: 2 | 3 | / <- o nome do seu projeto 4 | /.tex <- o seu arquivo tex 5 | /figs <- as suas figuras estáticas 6 | /data <- arquivos .plot e .dat pro gnuplot 7 | /lily <- arquivos lilypond 8 | ~/lib <- essa biblioteca 9 | ~/bib <- a bibliografia do genos 10 | 11 | Mas é possivel ter outra estrutura desde que os caminhos estejam 12 | indicados nas respectivas variáveis de ambiente. 13 | 14 | É necessário ter um ~/.latexmk como o do exemplo abaixo: 15 | 16 | ---------------------------------------------------------------------- 17 | LATEX_ENV+= BIBINPUTS=~/bib: 18 | LATEX_ENV+= BSTINPUTS=~/lib/latex/bib/: 19 | LATEX_ENV+= TEXINPUTS=:src:config:figs:data:lily:out:~/lib/latex//:~/lib/license//:~/lib/emacs/bbdb/tex/: 20 | PDFLATEX_ENV+= $(LATEX_ENV) 21 | 22 | include ~/lib/make/latex.mk 23 | include /usr/share/latex-mk/latex.gmk 24 | ---------------------------------------------------------------------- 25 | 26 | Nenhuma variável de ambiente é definida no latex.mk do genos e 27 | recomendamos que você defina apenas em um lugar do ~/.latexmk. 28 | 29 | Para um projeto que use todos esses componentes, o Makefile 30 | recomendado, /Makefile é: 31 | 32 | NAME = 33 | USE_PDFLATEX = 1 34 | VIEWPDF = evince 35 | # OTHER += $(LILY_PDF) # descomente se usar lilyponds 36 | # OTHER += $(GNUPLOY_PDF) # descomente se usar gnuplot 37 | # OTHER += $(SVG_PDF) # descomente se usar imagens svg 38 | # OTHER += $(DIA_PNG) # descomente se usar diagramas dia 39 | include ~/.latexmk 40 | 41 | E pronto! 42 | 43 | Com isso feito, o seu artigo latex será compilado pra pdf com 44 | "make", será mostrado no evince com "make view", arquivos do gnuplot 45 | serão plotados em pdf, diagramas svg serão convertidos para pdf, 46 | diagramas dia serão convertidos pra png e o mundo viverá para sempre 47 | de mãos dadas em um gramado infinito, e todo dia será natal (bom, 48 | esses dois últimos são exagero, mas você entende). 49 | 50 | Caso tenha alguma dúvida, mande email para genos-users@listas.genos.mus.br 51 | 52 | Para ajudar, se quiser converter arquivos FOO em BAR antes de 53 | incluir no seu artigo, coloque a linha OTHER += $(FOO_BAR) no seu 54 | Makefile. Se ela não existir aqui, adicione! 55 | -------------------------------------------------------------------------------- /config/make/latex-mk/latex-mk: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # $Id: latex-mk.in,v 1.40 2010/12/28 07:28:50 dan Exp $ 4 | # 5 | # Copyright (c) 2002, 2003, 2004, 2005, 2006, 2010 Dan McMahill 6 | # All rights reserved. 7 | # 8 | # Redistribution and use in source and binary forms, with or without 9 | # modification, are permitted provided that the following conditions 10 | # are met: 11 | # 1. Redistributions of source code must retain the above copyright 12 | # notice, this list of conditions and the following disclaimer. 13 | # 2. Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in the 15 | # documentation and/or other materials provided with the distribution. 16 | # 3. All advertising materials mentioning features or use of this software 17 | # must display the following acknowledgement: 18 | # This product includes software developed by Dan McMahill 19 | # 4. The name of the author may not be used to endorse or promote products 20 | # derived from this software without specific prior written permission. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 29 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 | # SUCH DAMAGE. 33 | # 34 | 35 | VERSION=2.1 36 | 37 | MAXITERS=${MAXITERS:-5} 38 | 39 | BIBTEX=${BIBTEX:-bibtex} 40 | BIBTEX_FLAGS=${BIBTEX_FLAGS:-} 41 | LATEX=${LATEX:-latex} 42 | LATEX_FLAGS=${LATEX_FLAGS:-} 43 | MAKEIDX=${MAKEIDX:-makeindex} 44 | MAKEIDX_FLAGS=${MAKEIDX_FLAGS:-} 45 | MAKEGLS=${MAKEGLS:-makeindex} 46 | MAKEGLS_FLAGS=${MAKEGLS_FLAGS:-} 47 | PDFLATEX=${PDFLATEX:-pdflatex} 48 | PDFLATEX_FLAGS=${PDFLATEX_FLAGS:-} 49 | TEX2PAGE=${TEX2PAGE:-tex2page} 50 | TEX2PAGE_FLAGS=${TEX2PAGE_FLAGS:-} 51 | 52 | LATEX_MK_LOG=${LOG:-latex-mk.log} 53 | 54 | # The environment variable TEXMFOUTPUT is a "special" one. LaTeX will 55 | # try to write its output files (including intermediate files) to the 56 | # current directory. If the current directory is not writeable, then 57 | # it will try to use the directory specified by TEXMFOUTPUT. This 58 | # is rather important for this script as we monitor certain intermediate 59 | # files produced by latex and we also need to know where to point programs 60 | # like BibTeX. Because of this, we will test right away if we can write 61 | # to the current directory. 62 | 63 | here=${PWD} 64 | t=latex-mk.test.$$$$ 65 | if touch ${t} 2>/dev/null ; then 66 | rm -f ${t} 67 | ODIR="." 68 | else 69 | if test -z "${TEXMFOUTPUT}"; then 70 | echo "$0: The current directory: ${here}" 71 | echo "is not writeable and TEXMFOUTPUT is not set. LaTeX can not be run." 72 | exit 1 73 | else 74 | t="${TEXMFOUTPUT}/${t}" 75 | if touch ${t} 2>/dev/null ; then 76 | rm -f ${t} 77 | ODIR="${TEXMFOUTPUT}" 78 | if test -z "${TEXINPUTS}" ; then 79 | TEXINPUTS="${ODIR}:" 80 | else 81 | TEXINPUTS="${ODIR}:${TEXINPUTS}:" 82 | fi 83 | export TEXINPUTS 84 | if test -z "${BIBINPUTS}" ; then 85 | BIBINPUTS=".:${here}:" 86 | else 87 | BIBINPUTS=".:${here}:${BIBINPUTS}:" 88 | fi 89 | export BIBINPUTS 90 | else 91 | echo "$0: Neither the current directory: ${here}" 92 | echo " nor the directory specified by TEXMFOUTPUT: ${TEXMFOUTPUT}" 93 | echo " can be written to. LaTeX can not be run." 94 | exit 1 95 | fi 96 | fi 97 | fi 98 | 99 | echo "${LATEX_MK_LOG}" | grep "^/" 100 | if test $? -ne 0 ; then 101 | LATEX_MK_LOG="${ODIR}/${LATEX_MK_LOG}" 102 | fi 103 | 104 | # list of files to monitor. If they change, we will rerun 105 | # LaTeX again. These are all suffixes of ${NAME} 106 | # 107 | # glo = \glossaryentry commands from \glossary 108 | # gls = glossary file created by (normally) makeindex from the .glo file 109 | # ilg = glossary log file created by (normally) makeindex 110 | # ind = index file created by the makeindex program from the .idx file 111 | # lof = list of figures 112 | # lot = list of tables 113 | # toc = table of contents 114 | monitor_files="glo gls ind lof lot toc" 115 | clean_files="idx ilg ${monitor_files}" 116 | 117 | sep="------------------------------------" 118 | 119 | ####################################################################### 120 | # 121 | # usage() 122 | # 123 | 124 | usage() { 125 | cat << EOF 126 | 127 | $0 128 | 129 | This is a wrapper script used by the LaTeX-Mk 130 | makefile system for LaTeX documents. Its purpose is to 131 | run LaTeX the appropriate number of times to resolve all 132 | references and page changes associated with resolving 133 | references. In addition BibTex and makeindex runs are 134 | performed as needed. 135 | 136 | Although the primary purpose of this script is to be a support 137 | tool for the LaTeX-Mk system, it may be run standalone. 138 | 139 | 140 | OPTIONS 141 | 142 | -b, --bibtex : Force a run of bibtex even if there were no 143 | missing citations. 144 | 145 | --clean : Clean up various state files and log files used 146 | by $0. 147 | 148 | --debug : Enable verbose debugging output. 149 | 150 | -h, --help : Display this help message. 151 | 152 | --ignore-errors : Ignores any error codes from the various programs 153 | which are run. 154 | 155 | --pdflatex : Use PDFLaTeX instead of LaTeX. 156 | 157 | --testlog logfile : Log the actions taken by this script to the file 158 | "logfile". This is used as part of the regression 159 | test suite and is primarily for developer use. 160 | The exact format and contents of the log file are 161 | subject to change without notification. 162 | 163 | --tex2page : Use TeX2Page instead of LaTeX. 164 | 165 | --version : Displays the version and exits. 166 | 167 | ENVIRONMENT VARIABLES 168 | 169 | The following environment variables, with defaults shown in [], 170 | affect the behaviour of $0. 171 | 172 | BIBTEX [${BIBTEX}] 173 | BIBTEX_FLAGS [${BIBTEX_FLAGS}] 174 | LATEX [${LATEX}] 175 | LATEX_FLAGS [${LATEX_FLAGS}] 176 | MAKEIDX [${MAKEIDX}] 177 | MAKEIDX_FLAGS [${MAKEIDX_FLAGS}] 178 | MAKEGLS [${MAKEGLS}] 179 | MAKEGLS_FLAGS [${MAKEGLS_FLAGS}] 180 | PDFLATEX [${PDFLATEX}] 181 | PDFLATEX_FLAGS [${PDFLATEX_FLAGS}] 182 | TEX2PAGE [${TEX2PAGE}] 183 | TEX2PAGE_FLAGS [${TEX2PAGE_FLAGS}] 184 | TEXMFOUTPUT [${TEXMFOUTPUT}] 185 | LATEX_MK_LOG [${LOG}] 186 | 187 | SEE ALSO 188 | 189 | http://latex-mk.sf.net 190 | 191 | EOF 192 | } 193 | # 194 | ####################################################################### 195 | 196 | ignore_errors=no 197 | debug=no 198 | do_clean=no 199 | force_bibtex=no 200 | test_log="" 201 | flags="" 202 | 203 | while test -n "$1" 204 | do 205 | case "$1" 206 | in 207 | 208 | -b|--bibtex) 209 | force_bibtex=yes 210 | flags="${flags} bibtex" 211 | shift 212 | ;; 213 | 214 | --clean) 215 | do_clean=yes 216 | flags="${flags} clean" 217 | shift 218 | ;; 219 | 220 | --debug) 221 | debug=yes 222 | echo "$0: Enabling debug mode" 223 | shift 224 | ;; 225 | 226 | -h|--help) 227 | usage 228 | exit 0 229 | ;; 230 | 231 | --ignore-errors) 232 | ignore_errors=yes 233 | flags="${flags} ignore_errors" 234 | shift 235 | ;; 236 | 237 | --pdflatex) 238 | LATEX=$PDFLATEX 239 | LATEX_FLAGS=$PDFLATEX_FLAGS 240 | flags="${flags} pdflatex" 241 | shift 242 | ;; 243 | 244 | --testlog) 245 | test_log="$2" 246 | shift 2 247 | ;; 248 | 249 | --tex2page) 250 | LATEX=$TEX2PAGE 251 | LATEX_FLAGS=$TEX2PAGE_FLAGS 252 | flags="${flags} tex2page" 253 | shift 254 | ;; 255 | 256 | --version) 257 | echo "latex-mk version $VERSION" 258 | exit 0 259 | ;; 260 | 261 | -*) 262 | echo "unknown option: $1" 263 | exit 1 264 | ;; 265 | 266 | *) 267 | break 268 | ;; 269 | 270 | esac 271 | done 272 | 273 | ####################################################################### 274 | # 275 | # log() 276 | # 277 | 278 | first_log=yes 279 | log() { 280 | # Log a message to the test log file if it has been defined. 281 | if test -n "$test_log" ; then 282 | if test "${first_log}" = "yes" ; then 283 | first_log=no 284 | rm -f $test_log 285 | fi 286 | if test ! -f $test_log ; then 287 | touch $test_log 288 | if test $? -ne 0 ; then 289 | echo "$0: Could not write to test log $test_log" > /dev/stderr 290 | exit 1 291 | fi 292 | fi 293 | echo "$*" >> $test_log 294 | 295 | fi 296 | } 297 | 298 | # 299 | # 300 | ####################################################################### 301 | 302 | ####################################################################### 303 | # 304 | # check_bibunits() 305 | 306 | check_bibunits() { 307 | msg="Checking if ${NAME} uses the bibunits package..." 308 | if grep "bibunits.sty" "$LATEX_MK_LOG" >/dev/null ; then 309 | rslt="yes" 310 | using_bibunits=yes 311 | log "bibunits package detected" 312 | else 313 | rslt="yes" 314 | using_bibunits=no 315 | fi 316 | report "$msg $rslt" 317 | } 318 | 319 | # 320 | ####################################################################### 321 | 322 | ####################################################################### 323 | # 324 | # new_or_changed() 325 | # 326 | 327 | new_or_changed() { 328 | f=$1 329 | r=1 330 | report "Checking for ${f} ..." 331 | if [ -f "${f}" ]; then 332 | if [ ! -f "${f}.old" ]; then 333 | log "\"${f}\" is new" 334 | r=0 335 | elif cmp -s "${f}.old" "${f}" ; then 336 | log "\"${f}\" is not changed" 337 | else 338 | log "\"${f}\" has changed" 339 | r=0 340 | fi 341 | 342 | cp -p "${f}" "${f}.old" 343 | fi 344 | 345 | return ${r} 346 | } 347 | 348 | # 349 | # 350 | ####################################################################### 351 | 352 | ####################################################################### 353 | # 354 | # report() -- Like echo but with some decorations added to help 355 | # the user know what tool is producing the message 356 | # 357 | 358 | report() { 359 | cat </dev/null 2>/dev/null ; then 471 | rslt="yes" 472 | bibtex_ok=yes 473 | log "check_bib(): It is ok to run BibTex (found $w)" 474 | fi 475 | report "$msg $rslt" 476 | done 477 | rc=0 478 | if test $bibtex_ok = no ; then 479 | rc=1 480 | fi 481 | return $rc 482 | } 483 | 484 | # 485 | ####################################################################### 486 | 487 | ####################################################################### 488 | # 489 | # run_latex() 490 | # 491 | 492 | run_latex() { 493 | # run latex. If it fails, manually remove the .dvi file since 494 | # latex won't. Leaving the .dvi file would confuse 'make' because on the next 495 | # invocation, the .dvi file would appear to be up to date already. 496 | log "run_latex() called" 497 | ( ( ( "$LATEX" $LATEX_FLAGS "$INFILE" 2>&1 ; echo $? >&4) | tee "$LATEX_MK_LOG" 1>&3) 4>&1 | (read a; exit $a)) 3>&1 498 | rc=$? 499 | if test $rc -ne 0 -a "$ignore_errors" != "yes" ; then 500 | echo "$sep" 501 | echo "$0: Error: LaTeX failed" 502 | echo "$sep" 503 | rm -f "${ODIR}/${NAME}.dvi" "${ODIR}/${NAME}.pdf" 504 | rm -f "$LATEX_MK_LOG" 505 | log "run_latex() failed" 506 | exit $rc 507 | fi 508 | 509 | } 510 | 511 | # 512 | ####################################################################### 513 | 514 | ####################################################################### 515 | # 516 | # run_bibtex() 517 | # 518 | 519 | run_bibtex() { 520 | log "run_bibtex $* called" 521 | do_post=yes 522 | while test $# -gt 0 ; do 523 | case $1 in 524 | --skip-post-hook) 525 | do_post=no 526 | shift 527 | ;; 528 | -*) 529 | echo "$0: INTERNAL ERROR: run_bibtex $*" 530 | exit 1 531 | ;; 532 | *) 533 | break 534 | ;; 535 | esac 536 | done 537 | BIBFILE="${1:-${NAME}}" 538 | log "cd \"${ODIR}\" && \"$BIBTEX\" $BIBTEX_FLAGS \"${BIBFILE}\"" 539 | echo "${sep}" 540 | echo "Running BibTeX" 541 | echo "cd $\"{ODIR}\" && \"$BIBTEX\" $BIBTEX_FLAGS \"${BIBFILE}\"" 542 | cd "${ODIR}" && "$BIBTEX" $BIBTEX_FLAGS "${BIBFILE}" 543 | rc=$? 544 | cd ${here} 545 | if test $rc -ne 0 -a "$ignore_errors" != "yes" ; then 546 | echo "$sep" 547 | echo "$0: Error: BibTeX failed" 548 | echo "$sep" 549 | rm -f "${ODIR}/${NAME}.dvi" "${ODIR}/${NAME}.pdf" 550 | rm -f "$LATEX_MK_LOG" 551 | log "run_bibtex($*) failed" 552 | exit $rc 553 | fi 554 | 555 | # run the post-bibtex hook if its been defined 556 | if test "$do_post" = "yes" -a "X$POST_BIBTEX_HOOK" != "X" ; then 557 | if test -x $POST_BIBTEX_HOOK ; then 558 | $POST_BIBTEX_HOOK "$BIBFILE" 559 | rc=$? 560 | if test $rc -ne 0 ; then 561 | echo "$POST_BIBTEX_HOOK "$BIBFILE" failed" 562 | rm -f "${ODIR}/${NAME}.dvi" "${ODIR}/${NAME}.pdf" 563 | rm -f "$LATEX_MK_LOG" 564 | exit $rc 565 | fi 566 | fi 567 | fi 568 | echo "${sep}" 569 | } 570 | 571 | ####################################################################### 572 | # 573 | # run_makeindex() 574 | # 575 | 576 | run_makeindex() { 577 | log "run_makeindex() called" 578 | log "cd \"${ODIR}\" && \"$MAKEIDX\" $MAKEIDX_FLAGS \"$NAME\"" 579 | echo "${sep}" 580 | echo "Running makeindex" 581 | echo "cd \"${ODIR}\" && \"$MAKEIDX\" $MAKEIDX_FLAGS \"$NAME\"" 582 | cd "${ODIR}" && "$MAKEIDX" $MAKEIDX_FLAGS "$NAME" 583 | rc=$? 584 | cd ${here} 585 | if test $rc -ne 0 -a "$ignore_errors" != "yes" ; then 586 | echo "$sep" 587 | echo "$0: Error: makeindex failed" 588 | echo "$sep" 589 | rm -f "${ODIR}/${NAME}.dvi" "${ODIR}/${NAME}.pdf" 590 | rm -f "$LATEX_MK_LOG" 591 | log "run_makeindex() failed" 592 | exit $rc 593 | fi 594 | echo "${sep}" 595 | 596 | } 597 | 598 | ####################################################################### 599 | # 600 | # run_makeglossary() 601 | # 602 | 603 | run_makeglossary() { 604 | log "run_makeglossary() called" 605 | log "cd \"${ODIR}\" && \"$MAKEGLS\" $MAKEGLS_FLAGS -s \"$GLSFILE\" \"$NAME.glo\" -o \"$NAME.gls\"" 606 | echo "${sep}" 607 | echo "Running `basename $MAKEGLS`" 608 | echo "cd \"${ODIR}\" && \"$MAKEGLS\" $MAKEGLS_FLAGS -s \"$GLSFILE\" -o \"$NAME.gls\" \"$NAME.glo\"" 609 | cd "${ODIR}" && "$MAKEGLS" $MAKEGLS_FLAGS -s "$GLSFILE" -o "$NAME.gls" "$NAME.glo" 610 | rc=$? 611 | cd ${here} 612 | if test $rc -ne 0 -a "$ignore_errors" != "yes" ; then 613 | echo "$sep" 614 | echo "$0: Error: `basename $MAKEGLS` failed" 615 | echo "$sep" 616 | rm -f "${ODIR}/${NAME}.dvi" "${ODIR}/${NAME}.pdf" 617 | rm -f "$LATEX_MK_LOG" 618 | log "run_makeglossary() failed" 619 | exit $rc 620 | fi 621 | echo "${sep}" 622 | 623 | } 624 | 625 | # 626 | ####################################################################### 627 | 628 | if [ "X$force_bibtex" = "Xyes" ] ; then 629 | log "Running with force_bibtex" 630 | run_latex 631 | run_bibtex 632 | fi 633 | 634 | 635 | cnt=0 636 | bibcnt=0 637 | while test $cnt -lt $MAXITERS ; do 638 | log "${sep}" 639 | log "Pass #${cnt}" 640 | run_latex 641 | 642 | # if the document uses the bibunits package, then we will end up 643 | # with a bunch of .bib files and a bunch of .aux files and we will 644 | # need to run bibtex 645 | check_bibunits 646 | 647 | # if we need to run bibtex, we should end up with something like this: 648 | #LaTeX Warning: Citation `foo' on page 1 undefined on input line 2 649 | # and 650 | #LaTeX Warning: There were undefined references. 651 | # 652 | # After bibtex is run, we will get one more latex run that has a citation 653 | # complaint so we allow one more complaint from latex before declaring 654 | # that there is a problem with the citations. Just in case someone 655 | # wants to keep running latex and viewing/printing the results with these 656 | # errors present, provide a way to override this. 657 | # 658 | # Evidently, we may also simply get the following complaint: 659 | # 660 | # No file foo.bbl 661 | # 662 | # instead of the previous warning. This can happen if you only have 663 | # something like \nocite{*} in your document instead of \cite{x} 664 | # 665 | if test "$using_bibunits" = "yes" -a $cnt -eq 0 ; then 666 | for f in "${ODIR}"/*.aux ; do 667 | case $f in 668 | # FIXME -- the user can potentially change 669 | # the file names used here. Is there a more robust 670 | # way? 671 | ${ODIR}/bu[0-9]*.aux) 672 | fb=`basename $f .aux` 673 | log "Running bibtex on $f" 674 | run_bibtex --skip-post-hook "${fb}" 675 | ;; 676 | esac 677 | done 678 | fi 679 | 680 | needbib=`grep "Citation.*undefined" "$LATEX_MK_LOG"` 681 | if test -n "$needbib" ; then log "Citation undefined" ; fi 682 | if test -z "$needbib" ; then 683 | report "Checking for missing .bbl files in latex log ..." 684 | needbib=`grep "No file.*\.bbl" "$LATEX_MK_LOG"` 685 | if test -n "$needbib" ; then log "Missing .bbl" ; fi 686 | fi 687 | if test -n "$needbib" ; then 688 | if test $bibcnt -eq 0 ; then 689 | # This is a bit of a dodgy thing here. If we are using 690 | # the bibunits package, we will probably end up here 691 | # but we actually don't need to run bibtex on the main 692 | # document. There is also the possiblilty that we still 693 | # need to run bibtex. It all depends on if we have a 694 | # non-bibunits bibliography too or not 695 | if check_bib ; then 696 | echo "$sep" 697 | echo "$0: Running bibtex to resolve citations" 698 | echo "$sep" 699 | log "BibTex run #1" 700 | run_bibtex 701 | else 702 | log "Skip BibTex run #1 (due to check_bib)" 703 | fi 704 | elif test $bibcnt -eq 1 ; then 705 | echo "$sep" 706 | echo "$0: BibTeX has already been run, but LaTeX is still reporting" 707 | echo " $needbib." 708 | echo " Trying LaTeX one more time...." 709 | echo "$sep" 710 | log "Try another latex run for the citations" 711 | elif test -n "$IGNORE_CITATION_WARNS" ; then 712 | echo "$sep" 713 | echo "$0: WARNING: BibTeX has already been run, but LaTeX is still reporting" 714 | echo "$0: $needbib" 715 | echo "$0: You have set the IGNORE_CITATION_WARNS variable to override this, but" 716 | echo "$0: you probably do have an error in your citations." 717 | echo "$sep" 718 | log "Could not resolve citations but you are ignoring this" 719 | else 720 | echo "$sep" 721 | echo "$0: Error: BibTeX has already been run, but LaTeX is still reporting" 722 | echo "$0: $needbib" 723 | echo "$sep" 724 | rm -f "$LATEX_MK_LOG" 725 | log "Exit with undefined citations" 726 | if test "$ignore_errors" = "yes" ; then exit 0 ; else exit 1 ; fi 727 | fi 728 | bibcnt=`expr $bibcnt + 1` 729 | fi 730 | 731 | # Check if we need to run makeindex. What will happen is the first LaTeX run 732 | # generates a .idx file. Then we run makeindex to operate on the .idx file 733 | # and generate a .ind file. Since we monitor the .ind file all we must do here 734 | # is see if a makeindex run is needed. 735 | if new_or_changed "${ODIR}/${NAME}.idx" ; then 736 | log "\"${ODIR}/${NAME}.idx\" new or changed -> need to run makeindex" 737 | run_makeindex 738 | fi 739 | 740 | # we shouldn't need this, but lets be sure 741 | if test -f "${ODIR}/${NAME}.idx" -a ! -f "${ODIR}/${NAME}.ind" ; then 742 | log "\"${ODIR}/${NAME}.idx\" exists but not \"${ODIR}/${NAME}.ind\" -> run makeindex" 743 | run_makeindex 744 | fi 745 | 746 | if test -f "${ODIR}/${NAME}.glo" && new_or_changed "${ODIR}/${NAME}.glo" ; then 747 | log "\"${ODIR}/${NAME}.glo\" new or changed -> need to update glossary" 748 | run_makeglossary 749 | fi 750 | 751 | # Examine the list of figures, list of tables, table of contents, etc 752 | # files because when these change, we need to re-run latex, but 753 | # sometimes latex does not tell us this. 754 | changed_file="" 755 | for sfx in $monitor_files ; do 756 | if new_or_changed "${ODIR}/${NAME}.${sfx}" ; then 757 | changed_file="${changed_file} \"${ODIR}/${NAME}.${sfx}\"" 758 | echo "\"${ODIR}/${NAME}.${sfx}\" is new or changed. LaTeX needs to be re-run" 759 | fi 760 | done 761 | 762 | # with latex, you might see: 763 | #LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right 764 | # 765 | # with tex2page, you may get: 766 | #Rerun: tex2page week5.tex 767 | # 768 | rerun=`grep "Rerun" "$LATEX_MK_LOG"` 769 | log "rerun = ${rerun}" 770 | log "needbib = ${needbib}" 771 | log "changed_file = ${changed_file}" 772 | if test -z "$rerun" -a -z "$needbib" -a -z "$changed_file" ; then 773 | log "No rerun is needed" 774 | break; 775 | fi 776 | log "Rerun is needed" 777 | echo "$sep" 778 | echo "$0: LaTeX references have changed, another latex run is needed" 779 | echo "$sep" 780 | cnt=`expr $cnt + 1` 781 | if test "X$debug" = "Xyes" ; then echo "$0 debug: incremented cnt=$cnt" ; fi 782 | done 783 | 784 | #LaTeX Warning: There were undefined references. 785 | undefined=`grep "There were undefined references" "$LATEX_MK_LOG"` 786 | if test -n "$undefined" ; then 787 | log "Finished but still have undefined references." 788 | echo "$sep" 789 | echo "$0: There were undefined references. Please correct this." 790 | echo "$0: I have already made $cnt passes." 791 | #LaTeX Warning: Reference `tab:fuse_table' on page 3 undefined on input line 82. 792 | grep "Reference.*on page.*undefined" "$LATEX_MK_LOG" 793 | echo "$sep" 794 | fi 795 | 796 | #LaTeX Warning: There were multiply-defined labels. 797 | mult=`grep "multiply-defined labels" "$LATEX_MK_LOG"` 798 | if test -n "$mult" ; then 799 | log "Finished but still have multiply defined labels." 800 | echo "$sep" 801 | echo "$0: There were multiply defined labels." 802 | echo "$0: You may wish to correct this" 803 | #LaTeX Warning: Label `fig:myfig' multiply defined. 804 | grep "multiply defined" "$LATEX_MK_LOG" 805 | echo "$sep" 806 | fi 807 | 808 | if test $cnt -eq $MAXITERS ; then 809 | log "Reached iteration limit." 810 | echo "$sep" 811 | echo "$0: Failed to get LaTeX to converge after $MAXITERS tries" 812 | echo "$0: Please fix the document or try again if you think it" 813 | echo "$0: should be ok" 814 | echo "$sep" 815 | rm -f "$LATEX_MK_LOG" 816 | if test "$ignore_errors" = "yes" ; then exit 0 ; else exit 1 ; fi 817 | fi 818 | 819 | log "Remove log and exit." 820 | rm -f "$LATEX_MK_LOG" 821 | exit 0 822 | 823 | -------------------------------------------------------------------------------- /config/make/latex-mk/latex.gmk: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # $Id: latex.mk.in.in,v 1.68 2010/03/28 05:51:58 dan Exp $ 3 | # 4 | # Makefile fragment for handling LaTeX projects 5 | # 6 | # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Dan McMahill 7 | # All rights reserved. 8 | # 9 | # This code is derived from software written by Dan McMahill 10 | # 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 3. All advertising materials mentioning features or use of this software 20 | # must display the following acknowledgement: 21 | # This product includes software developed by Dan McMahill 22 | # 4. The name of the author may not be used to endorse or promote products 23 | # derived from this software without specific prior written permission. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 | # SUCH DAMAGE. 36 | # 37 | 38 | 39 | ####################################### 40 | # 41 | # README: 42 | # 43 | # To use this makefile fragment, set the variable: 44 | # NAME = Top level project name. Your top level LaTeX 45 | # file should be called $(NAME).tex 46 | # 47 | # TEXSRCS = Additional LaTeX input files (.tex) 48 | # 49 | # and add the line: 50 | # .include "latex.mk" 51 | # in your top level Makefile 52 | # 53 | # The following variables may be overridden in your top level Makefile 54 | # 55 | # BIBTEX = the BibTeX executable 56 | # BIBEX_FLAGS = flags passed to the BibTeX executable 57 | # CONVERT = the 'convert' program which is part of ImageMagick 58 | # DVIPDFM = the dvipdfm executable 59 | # DVIPDFM_ENV = environment variables set when running the dvipdfm executable 60 | # DVIPDFM_FLAGS= flags passed to the dvipdfm executable 61 | # DVIPS = the dvips executable 62 | # DVIPS_ENV = environment variables set when running the dvips executable 63 | # DVIPS_FLAGS = flags passed to the dvips executable 64 | # GZIP = gzip program 65 | # GV = a postscript previewer executable 66 | # GV_FLAGS = flags passed to the postscript previewer executable 67 | # JPG2EPS = program and flags used to convert JPEG files to EPS 68 | # LATEX = the LaTeX executable 69 | # LATEX_ENV = environment variables set when running the LaTeX executable 70 | # LATEX_FLAGS = flags passed to the LaTeX executable 71 | # LATEX2HTML = LaTeX2HTML executable 72 | # LATEX2HTML_ENV 73 | # = environment variables set when running LATEX2HTML 74 | # LATEX2HTML_FLAGS 75 | # = flags passed to LATEX2HTML 76 | # LATEX2RTF = LaTeX2RTF executable 77 | # LATEX2RTF_ENV 78 | # = environment variables set when running LATEX2RTF 79 | # LATEX2RTF_FLAGS 80 | # = flags passed to LATEX2RTF 81 | # LPR = executable to print postscript files 82 | # LPR_FLAGS = flags passed to the executable to print postscript files 83 | # MAKEIDX = the makeindex executable 84 | # MAKEIDX_FLAGS= flags passed to the makeindex executable 85 | # MAKEGLS = executable to create glossary 86 | # MAKEGLS_FLAGS= flags passed to the executable to create glossary 87 | # PDFLATEX = pdflatex executable 88 | # PDFLATEX_ENV = environment variables set when running the PDFLaTeX executable 89 | # PDFLATEX_FLAGS= flags passed to the PDFLaTeX executable 90 | # PNG2EPS = program and flags used to convert PNG files to EPS 91 | # PS2PDF = ps2pdf executable 92 | # PS2PDF_FLAGS = flags passed to the ps2pdf executable 93 | # TAR = tape archiver program 94 | # VIEWPDF = PDF viewer 95 | # VIEWPDF_FLAGS= PDF viewer flags 96 | # XDVI = a .dvi previewer executable 97 | # XDVI_FLAGS = flags passed to the .dvi previewer executable 98 | # 99 | # USE_DVIPDFM = set to use dvipdfm to create pdf files from dvi 100 | # instead of using dvips and ps2pdf 101 | # USE_PDFLATEX = set to use pdflatex to create pdf files from .tex 102 | # files instead of using latex, dvips and ps2pdf 103 | # 104 | ####################################### 105 | 106 | # figure out the name of the Makefile. We'll need this to include 107 | # in the tar file created as part of the 'dist' target 108 | MAKEFILE:= $(word 1,${MAKEFILE_LIST}) 109 | 110 | MAKECONF?= /usr/local/etc/latex-gmk.conf 111 | USER_MAKECONF?= ${HOME}/.latex-gmk.conf 112 | 113 | 114 | _CONFS= $(wildcard ${MAKECONF}) 115 | _CONFS+= $(wildcard ${USER_MAKECONF}) 116 | include ${_CONFS} 117 | 118 | # Make sure we set at least 1 way for creating html files 119 | ifndef USE_HEVEA 120 | ifndef USE_TEX2PAGE 121 | USE_LATEX2HTML= YES 122 | endif 123 | endif 124 | 125 | # The location of the latex-mk .mk and .gmk files 126 | # we do this instead of hard coding so the package 127 | # can be tested before installation by setting this 128 | # variable in a test config file 129 | 130 | AWK?= /usr/bin/awk 131 | BIBTEX?= bibtex 132 | CONVERT?= convert 133 | DVIPDFM?= dvipdfm 134 | DVIPDFM_ENV?= 135 | DVIPDFM_FLAGS+= 136 | DVIPDFM_LANDSCAPE_FLAGS?= -l 137 | DVIPS?= dvips 138 | DVIPS_ENV?= 139 | DVIPS_FLAGS+= -j0 140 | DVIPS_LANDSCAPE_FLAGS?= -t landscape 141 | ECHO?= /bin/echo 142 | ENV_PROG?= /usr/bin/env 143 | FALSE?= /usr/bin/false 144 | FIND?= /usr/bin/find 145 | GREP?= /usr/bin/grep 146 | GV?= gv 147 | GV_FLAGS?= 148 | GV_LANDSCAPE_FLAGS?= -landscape 149 | GZCAT?= /usr/bin/gzcat 150 | GZIP?= /usr/bin/gzip 151 | HACHA?= hacha 152 | HACHA_ENV?= 153 | HACHA_FLAGS?= 154 | HEVEA?= hevea 155 | HEVEA_ENV?= 156 | HEVEA_FLAGS?= -fix 157 | IMAGEN?= imagen 158 | JPG2EPS?= ${CONVERT} 159 | LATEX_MK?= /usr/local/bin/latex-mk 160 | LATEX_MK_FLAGS?= 161 | LATEX?= latex 162 | LATEX_ENV?= 163 | LATEX2HTML?= latex2html 164 | LATEX2HTML_ENV?= 165 | LATEX2HTML_FLAGS?=-image_type png -local_icons -show_section_numbers 166 | LATEX2RTF?= latex2rtf 167 | LATEX2RTF_ENV?= 168 | LATEX2RTF_FLAGS?= 169 | LPR?= /usr/bin/lpr 170 | LPR_FLAGS?= 171 | MAKEIDX?= makeindex 172 | MAKEIDX_FLAGS?= 173 | MAKEGLS?= makeindex 174 | MAKEGLS_FLAGS?= 175 | PDFLATEX?= pdflatex 176 | PDFLATEX_ENV?= 177 | PDFLATEX_FLAGS?= 178 | PNG2EPS?= ${CONVERT} 179 | POST_BIBTEX_HOOK?= 180 | RM?= /bin/rm 181 | RMDIR?= /bin/rmdir 182 | PS2PDF?= ps2pdf 183 | PS2PDF_FLAGS?= 184 | TAR?= /usr/bin/tar 185 | TEX2PAGE?= tex2page 186 | TEX2PAGE_ENV?= 187 | TEX2PAGE_FLAGS?= 188 | XDVI?= xdvi 189 | XDVI_FLAGS?= 190 | XDVI_LANDSCAPE_FLAGS?= -paper usr 191 | VIEWPDF?= ${GV} 192 | VIEWPDF_FLAGS?= ${GV_FLAGS} 193 | VIEWPDF_LANDSCAPE_FLAGS?= ${GV_LANDSCAPE_FLAGS} 194 | 195 | 196 | DRAFT_STAMP_PS?= draft_stamp.ps 197 | DATED_DRAFT_PS?= dated_draft.ps 198 | 199 | .PHONY: default 200 | default: all 201 | 202 | .MAIN: all 203 | .PHONY: all 204 | all:: view-all 205 | 206 | ifdef LANDSCAPE 207 | DVIPS_FLAGS+= ${DVIPS_LANDSCAPE_FLAGS} 208 | DVIPDFM_FLAGS+= ${DVIPDFM_LANDSCAPE_FLAGS} 209 | GV_FLAGS+= ${GV_LANDSCAPE_FLAGS} 210 | XDVI_FLAGS+= ${XDVI_LANDSCAPE_FLAGS} 211 | VIEWPDF_FLAGS+= ${VIEWPDF_LANDSCAPE_FLAGS} 212 | endif 213 | 214 | 215 | REAL_LATEX_ENV+= LATEX=${LATEX} 216 | REAL_LATEX_ENV+= LATEX_FLAGS=${LATEX_FLAGS} 217 | REAL_LATEX_ENV+= BIBTEX=${BIBTEX} 218 | REAL_LATEX_ENV+= BIBTEX_FLAGS=${BIBTEX_FLAGS} 219 | REAL_LATEX_ENV+= MAKEIDX=${MAKEIDX} 220 | REAL_LATEX_ENV+= MAKEIDX_FLAGS=${MAKEIDX_FLAGS} 221 | REAL_LATEX_ENV+= MAKEGLS=${MAKEGLS} 222 | REAL_LATEX_ENV+= MAKEGLS_FLAGS=${MAKEGLS_FLAGS} 223 | REAL_LATEX_ENV+= POST_BIBTEX_HOOK=${POST_BIBTEX_HOOK} 224 | REAL_LATEX_ENV+= ${LATEX_ENV} 225 | 226 | REAL_PDFLATEX_ENV+= PDFLATEX=${PDFLATEX} 227 | REAL_PDFLATEX_ENV+= PDFLATEX_FLAGS=${PDFLATEX_FLAGS} 228 | REAL_PDFLATEX_ENV+= BIBTEX=${BIBTEX} 229 | REAL_PDFLATEX_ENV+= BIBTEX_FLAGS=${BIBTEX_FLAGS} 230 | REAL_PDFLATEX_ENV+= MAKEIDX=${MAKEIDX} 231 | REAL_PDFLATEX_ENV+= MAKEIDX_FLAGS=${MAKEIDX_FLAGS} 232 | REAL_PDFLATEX_ENV+= MAKEGLS=${MAKEGLS} 233 | REAL_PDFLATEX_ENV+= MAKEGLS_FLAGS=${MAKEGLS_FLAGS} 234 | REAL_PDFLATEX_ENV+= POST_BIBTEX_HOOK=${POST_BIBTEX_HOOK} 235 | REAL_PDFLATEX_ENV+= ${PDFLATEX_ENV} 236 | 237 | REAL_TEX2PAGE_ENV+= TEX2PAGE=${TEX2PAGE} 238 | REAL_TEX2PAGE_ENV+= TEX2PAGE_FLAGS=${TEX2PAGE_FLAGS} 239 | REAL_TEX2PAGE_ENV+= BIBTEX=${BIBTEX} 240 | REAL_TEX2PAGE_ENV+= BIBTEX_FLAGS=${BIBTEX_FLAGS} 241 | REAL_TEX2PAGE_ENV+= MAKEIDX=${MAKEIDX} 242 | REAL_TEX2PAGE_ENV+= MAKEIDX_FLAGS=${MAKEIDX_FLAGS} 243 | REAL_TEX2PAGE_ENV+= MAKEGLS=${MAKEGLS} 244 | REAL_TEX2PAGE_ENV+= MAKEGLS_FLAGS=${MAKEGLS_FLAGS} 245 | REAL_TEX2PAGE_ENV+= POST_BIBTEX_HOOK=${POST_BIBTEX_HOOK} 246 | REAL_TEX2PAGE_ENV+= ${TEX2PAGE_ENV} 247 | 248 | # Include other .mk files often times used with LaTeX 249 | 250 | ####################################### 251 | # 252 | # Check for lgrind 253 | # 254 | ####################################### 255 | 256 | # Check for LGRINDSRCS and LGRINDDIRS 257 | 258 | 259 | ifdef LGRINDSRCS 260 | _USE_LGRIND_MK+= YES 261 | endif 262 | ifdef LGRINDDIRS 263 | _USE_LGRIND_MK+= YES 264 | endif 265 | 266 | # Check for proj_LGRINDSRCS and proj_LGRINDDIRS 267 | 268 | 269 | 270 | define add_lgrind_mk_template 271 | ifdef $(1)_LGRINDSRCS 272 | _USE_LGRIND_MK= YES 273 | endif 274 | ifdef $(1)_LGRINDDIRS 275 | _USE_LGRIND_MK= YES 276 | endif 277 | endef 278 | $(foreach __tmp__,$(NAME),$(eval $(call add_lgrind_mk_template,$(__tmp__)))) 279 | 280 | # pull in lgrind.[g]mk if needed 281 | 282 | ifdef _USE_LGRIND_MK 283 | include lgrind.gmk 284 | endif 285 | 286 | ####################################### 287 | # 288 | # Check for METAPOST 289 | # 290 | ####################################### 291 | 292 | # Check for MPOSTSRCS and MPOSTDIRS 293 | 294 | 295 | ifdef MPOSTSRCS 296 | _USE_MPOST_MK+= YES 297 | endif 298 | ifdef MPOSTDIRS 299 | _USE_MPOST_MK+= YES 300 | endif 301 | 302 | # Check for proj_MPOSTSRCS and proj_MPOSTDIRS 303 | 304 | 305 | 306 | define add_mpost_mk_template 307 | ifdef $(1)_MPOSTSRCS 308 | _USE_MPOST_MK= YES 309 | endif 310 | ifdef $(1)_MPOSTDIRS 311 | _USE_MPOST_MK= YES 312 | endif 313 | endef 314 | $(foreach __tmp__,$(NAME),$(eval $(call add_mpost_mk_template,$(__tmp__)))) 315 | 316 | # pull in mpost.[g]mk if needed 317 | 318 | ifdef _USE_MPOST_MK 319 | include mpost.gmk 320 | endif 321 | 322 | ####################################### 323 | # 324 | # Check for tgif 325 | # 326 | ####################################### 327 | 328 | # Check for TGIFSRCS and TGIFDIRS 329 | 330 | 331 | ifdef TGIFSRCS 332 | _USE_TGIF_MK+= YES 333 | endif 334 | ifdef TGIFDIRS 335 | _USE_TGIF_MK+= YES 336 | endif 337 | 338 | # Check for proj_TGIFSRCS and proj_TGIFDIRS 339 | 340 | 341 | 342 | define add_tgif_mk_template 343 | ifdef $(1)_TGIFSRCS 344 | _USE_TGIF_MK= YES 345 | endif 346 | ifdef $(1)_TGIFDIRS 347 | _USE_TGIF_MK= YES 348 | endif 349 | endef 350 | $(foreach __tmp__,$(NAME),$(eval $(call add_tgif_mk_template,$(__tmp__)))) 351 | 352 | # pull in tgif.[g]mk if needed 353 | 354 | ifdef _USE_TGIF_MK 355 | include tgif.gmk 356 | endif 357 | 358 | ####################################### 359 | # 360 | # Check for xfig 361 | # 362 | ####################################### 363 | 364 | # Check for XFIGSRCS and XFIGDIRS 365 | 366 | 367 | ifdef XFIGSRCS 368 | _USE_XFIG_MK+= YES 369 | endif 370 | ifdef XFIGDIRS 371 | _USE_XFIG_MK+= YES 372 | endif 373 | 374 | # Check for proj_XFIGSRCS and proj_XFIGDIRS 375 | 376 | 377 | 378 | define add_xfig_mk_template 379 | ifdef $(1)_XFIGSRCS 380 | _USE_XFIG_MK= YES 381 | endif 382 | ifdef $(1)_XFIGDIRS 383 | _USE_XFIG_MK= YES 384 | endif 385 | endef 386 | $(foreach __tmp__,$(NAME),$(eval $(call add_xfig_mk_template,$(__tmp__)))) 387 | 388 | # pull in xfig.[g]mk if needed 389 | 390 | ifdef _USE_XFIG_MK 391 | include xfig.gmk 392 | endif 393 | 394 | ####################################### 395 | # 396 | # Targets 397 | # 398 | ####################################### 399 | 400 | ####################################### 401 | # target: view_ 402 | ####################################### 403 | 404 | 405 | define view_template 406 | .PHONY: view_$(1) 407 | ifdef USE_PDFLATEX 408 | view_$(1): viewpdf_$(1) 409 | else 410 | view_$(1): $(1).dvi 411 | $(XDVI) $(XDVI_FLAGS) $(1).dvi 412 | endif 413 | ALLVIEW+= view_$(1) 414 | DEFAULTVIEW?= view_$(1) 415 | endef 416 | $(foreach __tmp__,$(NAME),$(eval $(call view_template,$(__tmp__)))) 417 | 418 | ####################################### 419 | # target: viewps_ 420 | ####################################### 421 | 422 | 423 | define viewps_template 424 | .PHONY: viewps_$(1) 425 | viewps_$(1): $(1).ps 426 | $(GV) $(GV_FLAGS) $(1).ps 427 | DEFAULTVIEWPS?= viewps_$(1) 428 | ALLVIEWPS+= viewps_$(1) 429 | .PHONY: viewps_$(1)-draft 430 | viewps_$(1)-draft: $(1)-draft.ps 431 | $(GV) $(GV_FLAGS) $(1)-draft.ps 432 | DEFAULTVIEWPS_DRAFT?= viewps_$(1)-draft 433 | ALLVIEWPS_DRAFT+= viewps_$(1)-draft 434 | $(1)-draft.ps: $(1).dvi ${DATED_DRAFT_PS} 435 | sed "s;DATE;`date`;g" ${DATED_DRAFT_PS} > ${DRAFT_STAMP_PS} 436 | ${ENV_PROG} ${DVIPS_ENV} $(DVIPS) -h ${DRAFT_STAMP_PS} ${$*_DVIPS_FLAGS} $(DVIPS_FLAGS) -o $(1)-draft.ps $(1).dvi 437 | endef 438 | $(foreach __tmp__,$(NAME),$(eval $(call viewps_template,$(__tmp__)))) 439 | 440 | ####################################### 441 | # target: viewpdf_ 442 | ####################################### 443 | 444 | 445 | define viewpdf_template 446 | .PHONY: viewpdf_$(1) 447 | viewpdf_$(1): $(1).pdf 448 | $(VIEWPDF) $(VIEWPDF_FLAGS) $(1).pdf 449 | DEFAULTVIEWPDF?= viewpdf_$(1) 450 | ALLVIEWPDF+= viewpdf_$(1) 451 | .PHONY: viewpdf_$(1)-draft 452 | viewpdf_$(1)-draft: $(1)-draft.pdf 453 | $(VIEWPDF) $(VIEWPDF_FLAGS) $(1)-draft.pdf 454 | DEFAULTVIEWPDF_DRAFT?= viewpdf_$(1)-draft 455 | ALLVIEWPDF_DRAFT+= viewpdf_$(1)-draft 456 | endef 457 | $(foreach __tmp__,$(NAME),$(eval $(call viewpdf_template,$(__tmp__)))) 458 | 459 | ####################################### 460 | # target: print_ 461 | ####################################### 462 | 463 | 464 | 465 | define print_template 466 | .PHONY: print_$(1) 467 | print_$(1): $(1).ps 468 | $(LPR) $(LPR_FLAGS) $(1).ps 469 | DEFAULTPRINT?= print_$(1) 470 | ALLPRINT+= print_$(1) 471 | .PHONY: print_$(1)-draft 472 | print_$(1)-draft: $(1)-draft.ps 473 | $(LPR) $(LPR_FLAGS) $(1)-draft.ps 474 | DEFAULTPRINT_DRAFT?= print_$(1)-draft 475 | ALLPRINT_DRAFT+= print_$(1)-draft 476 | endef 477 | $(foreach __tmp__,$(NAME),$(eval $(call print_template,$(__tmp__)))) 478 | 479 | ####################################### 480 | 481 | ALLTEXSRCS= ${TEXSRCS} 482 | ALLBIBTEXSRCS= ${BIBTEXSRCS} 483 | 484 | ####################################### 485 | # 486 | # master name for the distfile 487 | # 488 | ####################################### 489 | 490 | 491 | define distname_template 492 | ifdef ALLNAME 493 | ALLNAME:= ${ALLNAME}_$(1) 494 | else 495 | ALLNAME= $(1) 496 | endif 497 | endef 498 | $(foreach __tmp__,$(NAME),$(eval $(call distname_template,$(__tmp__)))) 499 | 500 | ifneq (${ALLNAME}, ${NAME}) 501 | dist: ${ALLNAME}.tar.gz 502 | ${ALLNAME}.tar.gz: ${NAME:=.tar.gz} 503 | ${RM} -fr ${ALLNAME} 504 | mkdir ${ALLNAME} 505 | for f in ${NAME:=.tar.gz} ; do \ 506 | ${GZCAT} $$f | (cd ${ALLNAME} && ${TAR} xpf -) ; \ 507 | done 508 | ${TAR} cf - ${ALLNAME} | ${GZIP} > $@ 509 | ${RM} -fr ${ALLNAME} 510 | @${ECHO} "******* Distfile left in ${ALLNAME}.tar.gz *******" 511 | endif 512 | 513 | ####################################### 514 | # 515 | # add the dependencies for each documents .dvi file 516 | # 517 | ####################################### 518 | 519 | 520 | define dvideps_template 521 | $(1).dvi: $(1).tex ${TEXSRCS} ${$(1)_TEXSRCS} ${OTHER} ${$(1)_OTHER} 522 | ifneq ($(strip $(BIBTEXSRCS)$($(1)_BIBTEXSRCS)),) 523 | $(1).dvi: $(1).bib-stamp 524 | $(1).html-stamp: $(1).bib-stamp 525 | endif 526 | ifdef USE_PDFLATEX 527 | $(1).pdf: $(1).tex ${TEXSRCS} ${$(1)_TEXSRCS} ${OTHER} ${$(1)_OTHER} 528 | ifneq ($(strip $(BIBTEXSRCS)$($(1)_BIBTEXSRCS)),) 529 | $(1).pdf: $(1).bib-stamp 530 | endif 531 | endif 532 | $(1).html-stamp: $(1).tex ${TEXSRCS} ${$(1)_TEXSRCS} ${OTHER} ${$(1)_OTHER} 533 | $(1).bib-stamp: ${BIBTEXSRCS} ${$(1)_BIBTEXSRCS} 534 | ifdef USE_PDFLATEX 535 | $(ENV_PROG) $(REAL_PDFLATEX_ENV) $(LATEX_MK) $(LATEX_MK_FLAGS) --pdflatex --bibtex $(1).tex 536 | else 537 | $(ENV_PROG) $(REAL_LATEX_ENV) $(LATEX_MK) $(LATEX_MK_FLAGS) --bibtex $(1).tex 538 | endif 539 | touch $(1).bib-stamp 540 | 541 | ALLTEXSRCS+= $(1).tex ${$(1)_TEXSRCS} 542 | ALLBIBTEXSRCS+= ${$(1)_BIBTEXSRCS} 543 | dist: $(1).tar.gz 544 | dvi: $(1).dvi 545 | html: $(1).html-stamp 546 | # latex2html needs latex to run first because it makes use of the 547 | # .aux file. It seems that tex2page and hevea do not require this. 548 | ifdef USE_LATEX2HTML 549 | $(1).html-stamp: $(1).dvi 550 | endif 551 | .PHONY: $(1).html 552 | $(1).html: $(1).html-stamp 553 | ps: $(1).ps 554 | pdf: $(1).pdf 555 | ps-draft: $(1)-draft.ps 556 | pdf-draft: $(1)-draft.pdf 557 | $(1).rtf: $(1).dvi 558 | rtf: $(1).rtf 559 | clean:: 560 | if [ -f $(1).www_files ]; then \ 561 | for f in `${AWK} '{print $$2}' $(1).www_files` ; do \ 562 | if [ -f $$$$f ]; then ${RM} -f $$$$f ; fi ;\ 563 | done ;\ 564 | fi 565 | ${RM} -f $(1).www_files 566 | ifdef USE_LATEX2HTML 567 | ${RM} -f $(1).html_dir/images.aux 568 | ${RM} -f $(1).html_dir/images.bbl 569 | ${RM} -f $(1).html_dir/images.log 570 | ${RM} -f $(1).html_dir/images.out 571 | ${RM} -f $(1).html_dir/images.tex 572 | endif 573 | if [ -d $(1).html_dir ] ; then ${RMDIR} $(1).html_dir ; fi 574 | 575 | # And add dependencies for a source tarball 576 | $(1)_DIST+= $(1).tex ${TEXSRCS} ${$(1)_TEXSRCS} ${BIBTEXSRCS} ${$(1)_BIBTEXSRCS} ${OTHER} ${$(1)_OTHER} ${MAKEFILE} ${$(1)_EXTRA_DIST} ${EXTRA_DIST} 577 | 578 | endef 579 | $(foreach __tmp__,$(NAME),$(eval $(call dvideps_template,$(__tmp__)))) 580 | 581 | define dist_template 582 | ALL_DIST+= $($(1)_DIST) 583 | 584 | $(1).tar.gz: $($(1)_DIST) 585 | ${TAR} cf - ${$(1)_DIST} | ${GZIP} > $(1).tar.gz 586 | @${ECHO} "******* Distfile left in $(1).tar.gz *******" 587 | 588 | endef 589 | $(foreach __tmp__,$(NAME),$(eval $(call dist_template,$(__tmp__)))) 590 | 591 | ####################################### 592 | # target: view, view-all 593 | ####################################### 594 | 595 | .PHONY: view 596 | view: ${DEFAULTVIEW} 597 | .PHONY: view-all 598 | view-all: ${ALLVIEW} 599 | 600 | 601 | ####################################### 602 | # target: viewps, viewps-all 603 | ####################################### 604 | 605 | .PHONY: viewps 606 | viewps: ${DEFAULTVIEWPS} 607 | .PHONY: viewps-all 608 | viewps-all: ${ALLVIEWPS} 609 | 610 | ####################################### 611 | # target: viewpdf, viewpdf-all 612 | ####################################### 613 | 614 | .PHONY: viewpdf 615 | viewpdf: ${DEFAULTVIEWPDF} 616 | .PHONY: viewpdf-all 617 | viewpdf-all: ${ALLVIEWPDF} 618 | 619 | ####################################### 620 | # target: viewps-draft, viewps-all-draft 621 | ####################################### 622 | 623 | .PHONY: viewps-draft 624 | viewps-draft: ${DEFAULTVIEWPS_DRAFT} 625 | .PHONY: viewps-all-draft 626 | viewps-all-draft: ${ALLVIEWPS_DRAFT} 627 | 628 | ####################################### 629 | # target: viewpdf-draft, viewpdf-all-draft 630 | ####################################### 631 | 632 | .PHONY: viewpdf-draft 633 | viewpdf-draft: ${DEFAULTVIEWPDF_DRAFT} 634 | .PHONY: viewpdf-all-draft 635 | viewpdf-all-draft: ${ALLVIEWPDF_DRAFT} 636 | 637 | ####################################### 638 | # target: print, print-all 639 | ####################################### 640 | 641 | .PHONY: print 642 | print: ${DEFAULTPRINT} 643 | .PHONY: print-all 644 | print-all: ${ALLPRINT} 645 | 646 | ####################################### 647 | # target: print-draft, print-all-draft 648 | ####################################### 649 | 650 | .PHONY: print-draft 651 | print-draft: ${DEFAULTPRINT_DRAFT} 652 | .PHONY: print-all-draft 653 | print-all-draft: ${ALLPRINT_DRAFT} 654 | 655 | ####################################### 656 | # 657 | ####################################### 658 | 659 | .SUFFIXES : .tex .dvi .ps .pdf .rtf .html-stamp .png .jpg .eps 660 | 661 | ifdef IGNORE_LATEX_ERRORS 662 | LATEX_MK_FLAGS+= --ignore-errors 663 | endif 664 | 665 | ####################################### 666 | # 667 | # Graphic file conversions 668 | # 669 | ####################################### 670 | .jpg.eps : 671 | $(JPG2EPS) $< $@ 672 | 673 | .png.eps : 674 | $(PNG2EPS) $< $@ 675 | 676 | ####################################### 677 | # 678 | # Distribution output (tarfile) 679 | # 680 | ####################################### 681 | .PHONY: dist 682 | 683 | ####################################### 684 | # 685 | # DVI Output (latex) 686 | # 687 | ####################################### 688 | .PHONY: dvi 689 | .tex.dvi : 690 | $(ENV_PROG) $(REAL_LATEX_ENV) $(LATEX_MK) $(LATEX_MK_FLAGS) $< 691 | 692 | ####################################### 693 | # 694 | # HTML Output (latex2html or HeVeA) 695 | # 696 | ####################################### 697 | 698 | # note: we have to use a time stamp file here to keep track of what files 699 | # get created by the html conversion. Neither latex2html nor hevea provide 700 | # a convenient way to get a list of files to clean. In addition, hevea 701 | # does not currently provide a DESTDIR type functionality which is needed 702 | # for dealing with multiple top level documents. 703 | 704 | 705 | .PHONY: html 706 | .tex.html-stamp : 707 | touch $@1 708 | ifdef USE_LATEX2HTML 709 | @${ECHO} LaTeX-Mk: Creating HTML output using latex2html 710 | $(ENV_PROG) $(LATEX2HTML_ENV) $(LATEX2HTML) $(LATEX2HTML_FLAGS) -mkdir -dir $*.html_dir $< 711 | else 712 | ifdef USE_TEX2PAGE 713 | @${ECHO} LaTeX-Mk: Creating HTML output using tex2page 714 | ${ECHO} "$*.html_dir" > $*.hdir 715 | $(ENV_PROG) $(REAL_TEX2PAGE_ENV) $(LATEX_MK) --tex2page $(LATEX_MK_FLAGS) $< 716 | else 717 | ifdef USE_HEVEA 718 | @${ECHO} LaTeX-Mk: Creating HTML output using HeVeA 719 | mkdir -p $*.html_dir 720 | -$(ENV_PROG) $(HEVEA_ENV) $(HEVEA) $(HEVEA_FLAGS) $< 721 | -$(ENV_PROG) $(HEVEA_ENV) ${IMAGEN} `basename $< .tex` 722 | -$(ENV_PROG) $(HEVEA_ENV) $(HEVEA) $(HEVEA_FLAGS) $< 723 | endif 724 | endif 725 | endif 726 | if [ ! -f $*.www_files ]; then touch $*.www_files ; fi 727 | for f in `${FIND} . -type f \( -name \*.html -o -name \*.htm -o -name \*.gif \ 728 | -o -name \*.png -o -name \*.css -o -name \*.pl -o -name WARNINGS \ 729 | -o -name \*.scm -o -name \*.hlog \) \ 730 | -newer $@1 -print` ; do \ 731 | fn=`basename $$f` ; \ 732 | if ${GREP} "^$$f " $*.www_files >/dev/null ; then \ 733 | echo "$$f already recorded" ; \ 734 | else \ 735 | echo "recording file $$f ($*.html_dir/$$fn)" ; \ 736 | echo "$$f $*.html_dir/$$fn" >> $*.www_files ; \ 737 | fi ;\ 738 | done 739 | ifdef USE_TEX2PAGE 740 | for f in `${FIND} . -type f \( -name \*-Z-G-\*.tex -o -name \*-Z-G-\*.aux \ 741 | -o -name \*-Z-G-\*.log -o -name \*-Z-G-\*.dvi -o -name \*-Z-G-\*.ps \ 742 | -o -name .Z\*.tex \) -newer $@1 -print` ; do \ 743 | fn=`basename $$f` ; \ 744 | if ${GREP} "^$$f " $*.www_files >/dev/null ; then \ 745 | echo "$$f already recorded" ; \ 746 | elif test "`dirname $$f`" != "." ; then \ 747 | echo "$$f is not in this directory, skipping" ; \ 748 | else \ 749 | echo "recording file $$f (./$$fn)" ; \ 750 | echo "$$f ./$$fn" >> $*.www_files ; \ 751 | fi ;\ 752 | done 753 | endif 754 | ifdef USE_HEVEA 755 | for f in `${AWK} '{print $$1}' $*.www_files` ; do \ 756 | ${ECHO} "Moving $$f to $*.html_dir" ; mv $$f $*.html_dir ; \ 757 | done 758 | endif 759 | mv $@1 $@ 760 | 761 | ####################################### 762 | # 763 | # Postscript Output (dvips) 764 | # 765 | ####################################### 766 | .PHONY: ps 767 | 768 | # if we're doing a *-draft target, then add the 769 | # DRAFT watermark and time stamp 770 | ifeq ($(findstring -draft,${MAKECMDGOALS}),-draft) 771 | __DRAFT= yes 772 | endif 773 | 774 | .dvi.ps : 775 | ifdef __DRAFT 776 | sed "s;DATE;`date`;g" ${DATED_DRAFT_PS} > ${DRAFT_STAMP_PS} 777 | ${ENV_PROG} ${DVIPS_ENV} $(DVIPS) -h ${DRAFT_STAMP_PS} ${$*_DVIPS_FLAGS} $(DVIPS_FLAGS) -o $*-draft.ps $< 778 | else 779 | ${ENV_PROG} ${DVIPS_ENV} $(DVIPS) ${$*_DVIPS_FLAGS} $(DVIPS_FLAGS) -o $@ $< 780 | endif 781 | 782 | ####################################### 783 | # 784 | # PDF Output (ps2pdf) 785 | # 786 | ####################################### 787 | .PHONY: pdf 788 | 789 | ifdef USE_DVIPDFM 790 | .dvi.pdf : 791 | $(ENV_PROG) $(DVIPDFM_ENV) $(DVIPDFM) ${$*_DVIPDFM_FLAGS} $(DVIPDFM_FLAGS) $< 792 | else 793 | ifdef USE_PDFLATEX 794 | .tex.pdf : 795 | $(ENV_PROG) $(REAL_PDFLATEX_ENV) $(LATEX_MK) --pdflatex $(LATEX_MK_FLAGS) $< 796 | else 797 | .ps.pdf : 798 | $(PS2PDF) $(PS2PDF_FLAGS) $< 799 | endif 800 | endif 801 | 802 | ####################################### 803 | # 804 | # RTF (Rich Text Format) output (latex2rtf) 805 | # 806 | ####################################### 807 | .PHONY: rtf 808 | 809 | .dvi.rtf : 810 | $(ENV_PROG) $(LATEX2RTF_ENV) $(LATEX2RTF) $(LATEX2RTF_FLAGS) -o $@ $*.tex 811 | 812 | ####################################### 813 | # 814 | # Clean up (clean) 815 | # 816 | ####################################### 817 | CLEAN_FILES+= ${ALLTEXSRCS:.tex=.aux} 818 | CLEAN_FILES+= ${BIBTEXSRCS:.bib=.aux} 819 | CLEAN_FILES+= ${NAME:=.ps} 820 | CLEAN_FILES+= ${NAME:=-draft.ps} 821 | CLEAN_FILES+= ${NAME:=.pdf} 822 | CLEAN_FILES+= ${NAME:=-draft.pdf} 823 | CLEAN_FILES+= ${NAME:=.rtf} 824 | CLEAN_FILES+= ${NAME:=.aux} 825 | CLEAN_FILES+= ${NAME:=.log} 826 | CLEAN_FILES+= ${NAME:=.dvi} 827 | CLEAN_FILES+= ${NAME:=.log} 828 | CLEAN_FILES+= ${NAME:=.bbl} 829 | CLEAN_FILES+= ${NAME:=.blg} 830 | CLEAN_FILES+= ${NAME:=.glo} 831 | CLEAN_FILES+= ${NAME:=.gls} 832 | CLEAN_FILES+= ${NAME:=.ilg} 833 | CLEAN_FILES+= ${NAME:=.idx} 834 | CLEAN_FILES+= ${NAME:=.ind} 835 | CLEAN_FILES+= ${NAME:=.lof} 836 | CLEAN_FILES+= ${NAME:=.lot} 837 | CLEAN_FILES+= ${NAME:=.toc} 838 | CLEAN_FILES+= ${NAME:=.out} 839 | CLEAN_FILES+= $(DRAFT_STAMP_PS) 840 | CLEAN_FILES+= ${NAME:=.bib-stamp} 841 | 842 | # HTML generation 843 | CLEAN_FILES+= ${NAME:=.html-stamp} 844 | CLEAN_FILES+= ${NAME:=.www_files} 845 | 846 | ifdef USE_HEVEA 847 | CLEAN_FILES+= ${NAME:=.haux} 848 | CLEAN_FILES+= ${NAME:=.image.tex} 849 | endif 850 | 851 | ifdef USE_LATEX2HTML 852 | CLEAN_FILES+= ${NAME:=.haux} 853 | CLEAN_FILES+= ${NAME:=.image.tex} 854 | endif 855 | 856 | 857 | ifdef USE_TEX2PAGE 858 | CLEAN_FILES+= ${NAME:=.hdir} 859 | endif 860 | 861 | 862 | .PHONY: clean 863 | 864 | define latex_mk_clean_template 865 | clean:: 866 | ${LATEX_MK} --clean $(1) 867 | endef 868 | $(foreach __tmp__,$(NAME),$(eval $(call latex_mk_clean_template,$(__tmp__)))) 869 | 870 | clean:: 871 | $(RM) -f *~ texput.log $(CLEAN_FILES) 872 | 873 | .PHONY: distclean 874 | distclean: clean 875 | 876 | ####################################### 877 | # 878 | # Some helpful debugging targets 879 | # 880 | ####################################### 881 | .PHONY: show-var 882 | show-var: 883 | @${ECHO} ${${VARNAME}} 884 | -------------------------------------------------------------------------------- /config/make/latex-mk/latex.mk: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # $Id: latex.mk.in.in,v 1.68 2010/03/28 05:51:58 dan Exp $ 3 | # 4 | # Makefile fragment for handling LaTeX projects 5 | # 6 | # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Dan McMahill 7 | # All rights reserved. 8 | # 9 | # This code is derived from software written by Dan McMahill 10 | # 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 3. All advertising materials mentioning features or use of this software 20 | # must display the following acknowledgement: 21 | # This product includes software developed by Dan McMahill 22 | # 4. The name of the author may not be used to endorse or promote products 23 | # derived from this software without specific prior written permission. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 | # SUCH DAMAGE. 36 | # 37 | 38 | 39 | ####################################### 40 | # 41 | # README: 42 | # 43 | # To use this makefile fragment, set the variable: 44 | # NAME = Top level project name. Your top level LaTeX 45 | # file should be called $(NAME).tex 46 | # 47 | # TEXSRCS = Additional LaTeX input files (.tex) 48 | # 49 | # and add the line: 50 | # .include "latex.mk" 51 | # in your top level Makefile 52 | # 53 | # The following variables may be overridden in your top level Makefile 54 | # 55 | # BIBTEX = the BibTeX executable 56 | # BIBEX_FLAGS = flags passed to the BibTeX executable 57 | # CONVERT = the 'convert' program which is part of ImageMagick 58 | # DVIPDFM = the dvipdfm executable 59 | # DVIPDFM_ENV = environment variables set when running the dvipdfm executable 60 | # DVIPDFM_FLAGS= flags passed to the dvipdfm executable 61 | # DVIPS = the dvips executable 62 | # DVIPS_ENV = environment variables set when running the dvips executable 63 | # DVIPS_FLAGS = flags passed to the dvips executable 64 | # GZIP = gzip program 65 | # GV = a postscript previewer executable 66 | # GV_FLAGS = flags passed to the postscript previewer executable 67 | # JPG2EPS = program and flags used to convert JPEG files to EPS 68 | # LATEX = the LaTeX executable 69 | # LATEX_ENV = environment variables set when running the LaTeX executable 70 | # LATEX_FLAGS = flags passed to the LaTeX executable 71 | # LATEX2HTML = LaTeX2HTML executable 72 | # LATEX2HTML_ENV 73 | # = environment variables set when running LATEX2HTML 74 | # LATEX2HTML_FLAGS 75 | # = flags passed to LATEX2HTML 76 | # LATEX2RTF = LaTeX2RTF executable 77 | # LATEX2RTF_ENV 78 | # = environment variables set when running LATEX2RTF 79 | # LATEX2RTF_FLAGS 80 | # = flags passed to LATEX2RTF 81 | # LPR = executable to print postscript files 82 | # LPR_FLAGS = flags passed to the executable to print postscript files 83 | # MAKEIDX = the makeindex executable 84 | # MAKEIDX_FLAGS= flags passed to the makeindex executable 85 | # MAKEGLS = executable to create glossary 86 | # MAKEGLS_FLAGS= flags passed to the executable to create glossary 87 | # PDFLATEX = pdflatex executable 88 | # PDFLATEX_ENV = environment variables set when running the PDFLaTeX executable 89 | # PDFLATEX_FLAGS= flags passed to the PDFLaTeX executable 90 | # PNG2EPS = program and flags used to convert PNG files to EPS 91 | # PS2PDF = ps2pdf executable 92 | # PS2PDF_FLAGS = flags passed to the ps2pdf executable 93 | # TAR = tape archiver program 94 | # VIEWPDF = PDF viewer 95 | # VIEWPDF_FLAGS= PDF viewer flags 96 | # XDVI = a .dvi previewer executable 97 | # XDVI_FLAGS = flags passed to the .dvi previewer executable 98 | # 99 | # USE_DVIPDFM = set to use dvipdfm to create pdf files from dvi 100 | # instead of using dvips and ps2pdf 101 | # USE_PDFLATEX = set to use pdflatex to create pdf files from .tex 102 | # files instead of using latex, dvips and ps2pdf 103 | # 104 | ####################################### 105 | 106 | 107 | MAKECONF?= /usr/local/etc/latex-mk.conf 108 | USER_MAKECONF?= ${HOME}/.latex-mk.conf 109 | 110 | .if exists(${MAKECONF}) 111 | .include "${MAKECONF}" 112 | .endif 113 | 114 | .if exists(${USER_MAKECONF}) 115 | .include "${USER_MAKECONF}" 116 | .endif 117 | 118 | 119 | # Make sure we set at least 1 way for creating html files 120 | .if !defined(USE_HEVEA) && !defined(USE_TEX2PAGE) 121 | USE_LATEX2HTML= YES 122 | .endif 123 | 124 | # The location of the latex-mk .mk and .gmk files 125 | # we do this instead of hard coding so the package 126 | # can be tested before installation by setting this 127 | # variable in a test config file 128 | LATEX_MK_DIR?= /usr/local/share/latex-mk 129 | 130 | AWK?= /usr/bin/awk 131 | BIBTEX?= /usr/texbin/bibtex 132 | CONVERT?= /usr/local/bin/convert 133 | DVIPDFM?= /usr/texbin/dvipdfm 134 | DVIPDFM_ENV?= 135 | DVIPDFM_FLAGS+= 136 | DVIPDFM_LANDSCAPE_FLAGS?= -l 137 | DVIPS?= /usr/texbin/dvips 138 | DVIPS_ENV?= 139 | DVIPS_FLAGS+= -j0 140 | DVIPS_LANDSCAPE_FLAGS?= -t landscape 141 | ECHO?= /bin/echo 142 | ENV_PROG?= /usr/bin/env 143 | FALSE?= /usr/bin/false 144 | FIND?= /usr/bin/find 145 | GREP?= /usr/bin/grep 146 | GV?= gv 147 | GV_FLAGS?= 148 | GV_LANDSCAPE_FLAGS?= -landscape 149 | GZCAT?= /usr/bin/gzcat 150 | GZIP?= /usr/bin/gzip 151 | HACHA?= hacha 152 | HACHA_ENV?= 153 | HACHA_FLAGS?= 154 | HEVEA?= hevea 155 | HEVEA_ENV?= 156 | HEVEA_FLAGS?= -fix 157 | IMAGEN?= imagen 158 | JPG2EPS?= ${CONVERT} 159 | LATEX_MK?= /usr/local/bin/latex-mk 160 | LATEX_MK_FLAGS?= 161 | LATEX?= /usr/texbin/latex 162 | LATEX_ENV?= 163 | LATEX2HTML?= latex2html 164 | LATEX2HTML_ENV?= 165 | LATEX2HTML_FLAGS?=-image_type png -local_icons -show_section_numbers 166 | LATEX2RTF?= latex2rtf 167 | LATEX2RTF_ENV?= 168 | LATEX2RTF_FLAGS?= 169 | LPR?= /usr/bin/lpr 170 | LPR_FLAGS?= 171 | MAKEIDX?= /usr/texbin/makeindex 172 | MAKEIDX_FLAGS?= 173 | MAKEGLS?= /usr/texbin/makeindex 174 | MAKEGLS_FLAGS?= 175 | PDFLATEX?= /usr/texbin/pdflatex 176 | PDFLATEX_ENV?= 177 | PDFLATEX_FLAGS?= 178 | PNG2EPS?= ${CONVERT} 179 | POST_BIBTEX_HOOK?= 180 | RM?= /bin/rm 181 | RMDIR?= /bin/rmdir 182 | PS2PDF?= /usr/local/bin/ps2pdf 183 | PS2PDF_FLAGS?= 184 | TAR?= /usr/bin/tar 185 | TEX2PAGE?= tex2page 186 | TEX2PAGE_ENV?= 187 | TEX2PAGE_FLAGS?= 188 | XDVI?= /usr/texbin/xdvi 189 | XDVI_FLAGS?= 190 | XDVI_LANDSCAPE_FLAGS?= -paper usr 191 | VIEWPDF?= ${GV} 192 | VIEWPDF_FLAGS?= ${GV_FLAGS} 193 | VIEWPDF_LANDSCAPE_FLAGS?= ${GV_LANDSCAPE_FLAGS} 194 | 195 | 196 | DRAFT_STAMP_PS?= draft_stamp.ps 197 | DATED_DRAFT_PS?= ${LATEX_MK_DIR}/dated_draft.ps 198 | 199 | .if !target(default) 200 | .PHONY: default 201 | default: all 202 | .endif 203 | 204 | .if !target(all) 205 | .MAIN: all 206 | .PHONY: all 207 | all:: view-all 208 | .endif 209 | 210 | .if defined(LANDSCAPE) 211 | DVIPS_FLAGS+= ${DVIPS_LANDSCAPE_FLAGS} 212 | DVIPDFM_FLAGS+= ${DVIPDFM_LANDSCAPE_FLAGS} 213 | GV_FLAGS+= ${GV_LANDSCAPE_FLAGS} 214 | XDVI_FLAGS+= ${XDVI_LANDSCAPE_FLAGS} 215 | VIEWPDF_FLAGS+= ${VIEWPDF_LANDSCAPE_FLAGS} 216 | .endif 217 | 218 | REAL_LATEX_ENV+= LATEX=${LATEX:Q} 219 | REAL_LATEX_ENV+= LATEX_FLAGS=${LATEX_FLAGS} 220 | REAL_LATEX_ENV+= BIBTEX=${BIBTEX:Q} 221 | REAL_LATEX_ENV+= BIBTEX_FLAGS=${BIBTEX_FLAGS} 222 | REAL_LATEX_ENV+= MAKEIDX=${MAKEIDX:Q} 223 | REAL_LATEX_ENV+= MAKEIDX_FLAGS=${MAKEIDX_FLAGS} 224 | REAL_LATEX_ENV+= MAKEGLS=${MAKEGLS:Q} 225 | REAL_LATEX_ENV+= MAKEGLS_FLAGS=${MAKEGLS_FLAGS} 226 | REAL_LATEX_ENV+= POST_BIBTEX_HOOK=${POST_BIBTEX_HOOK} 227 | REAL_LATEX_ENV+= ${LATEX_ENV} 228 | 229 | REAL_PDFLATEX_ENV+= PDFLATEX=${PDFLATEX:Q} 230 | REAL_PDFLATEX_ENV+= PDFLATEX_FLAGS=${PDFLATEX_FLAGS} 231 | REAL_PDFLATEX_ENV+= BIBTEX=${BIBTEX:Q} 232 | REAL_PDFLATEX_ENV+= BIBTEX_FLAGS=${BIBTEX_FLAGS} 233 | REAL_PDFLATEX_ENV+= MAKEIDX=${MAKEIDX:Q} 234 | REAL_PDFLATEX_ENV+= MAKEIDX_FLAGS=${MAKEIDX_FLAGS} 235 | REAL_PDFLATEX_ENV+= MAKEGLS=${MAKEGLS:Q} 236 | REAL_PDFLATEX_ENV+= MAKEGLS_FLAGS=${MAKEGLS_FLAGS} 237 | REAL_PDFLATEX_ENV+= POST_BIBTEX_HOOK=${POST_BIBTEX_HOOK} 238 | REAL_PDFLATEX_ENV+= ${PDFLATEX_ENV} 239 | 240 | REAL_TEX2PAGE_ENV+= TEX2PAGE=${TEX2PAGE:Q} 241 | REAL_TEX2PAGE_ENV+= TEX2PAGE_FLAGS=${TEX2PAGE_FLAGS} 242 | REAL_TEX2PAGE_ENV+= BIBTEX=${BIBTEX:Q} 243 | REAL_TEX2PAGE_ENV+= BIBTEX_FLAGS=${BIBTEX_FLAGS} 244 | REAL_TEX2PAGE_ENV+= MAKEIDX=${MAKEIDX:Q} 245 | REAL_TEX2PAGE_ENV+= MAKEIDX_FLAGS=${MAKEIDX_FLAGS} 246 | REAL_TEX2PAGE_ENV+= MAKEGLS=${MAKEGLS:Q} 247 | REAL_TEX2PAGE_ENV+= MAKEGLS_FLAGS=${MAKEGLS_FLAGS} 248 | REAL_TEX2PAGE_ENV+= POST_BIBTEX_HOOK=${POST_BIBTEX_HOOK} 249 | REAL_TEX2PAGE_ENV+= ${TEX2PAGE_ENV} 250 | 251 | 252 | # Include other .mk files often times used with LaTeX 253 | 254 | ####################################### 255 | # 256 | # Check for lgrind 257 | # 258 | ####################################### 259 | 260 | # Check for LGRINDSRCS and LGRINDDIRS 261 | 262 | .if defined(LGRINDSRCS) || defined(LGRINDDIRS) 263 | _USE_LGRIND_MK= YES 264 | .endif 265 | 266 | 267 | # Check for proj_LGRINDSRCS and proj_LGRINDDIRS 268 | 269 | .for __tmp__ in ${NAME} 270 | .if defined(${__tmp__}_LGRINDSRCS) || defined(${__tmp__}_LGRINDDIRS) 271 | _USE_LGRIND_MK= YES 272 | .endif 273 | .endfor 274 | 275 | 276 | # pull in lgrind.[g]mk if needed 277 | 278 | .if defined(_USE_LGRIND_MK) 279 | .include "${LATEX_MK_DIR}/lgrind.mk" 280 | .endif 281 | 282 | ####################################### 283 | # 284 | # Check for METAPOST 285 | # 286 | ####################################### 287 | 288 | # Check for MPOSTSRCS and MPOSTDIRS 289 | 290 | .if defined(MPOSTSRCS) || defined(MPOSTDIRS) 291 | _USE_MPOST_MK= YES 292 | .endif 293 | 294 | 295 | # Check for proj_MPOSTSRCS and proj_MPOSTDIRS 296 | 297 | .for __tmp__ in ${NAME} 298 | .if defined(${__tmp__}_MPOSTSRCS) || defined(${__tmp__}_MPOSTDIRS) 299 | _USE_MPOST_MK= YES 300 | .endif 301 | .endfor 302 | 303 | 304 | # pull in mpost.[g]mk if needed 305 | 306 | .if defined(_USE_MPOST_MK) 307 | .include "${LATEX_MK_DIR}/mpost.mk" 308 | .endif 309 | 310 | ####################################### 311 | # 312 | # Check for tgif 313 | # 314 | ####################################### 315 | 316 | # Check for TGIFSRCS and TGIFDIRS 317 | 318 | .if defined(TGIFSRCS) || defined(TGIFDIRS) 319 | _USE_TGIF_MK= YES 320 | .endif 321 | 322 | 323 | # Check for proj_TGIFSRCS and proj_TGIFDIRS 324 | 325 | .for __tmp__ in ${NAME} 326 | .if defined(${__tmp__}_TGIFSRCS) || defined(${__tmp__}_TGIFDIRS) 327 | _USE_TGIF_MK= YES 328 | .endif 329 | .endfor 330 | 331 | 332 | # pull in tgif.[g]mk if needed 333 | 334 | .if defined(_USE_TGIF_MK) 335 | .include "${LATEX_MK_DIR}/tgif.mk" 336 | .endif 337 | 338 | ####################################### 339 | # 340 | # Check for xfig 341 | # 342 | ####################################### 343 | 344 | # Check for XFIGSRCS and XFIGDIRS 345 | 346 | .if defined(XFIGSRCS) || defined(XFIGDIRS) 347 | _USE_XFIG_MK= YES 348 | .endif 349 | 350 | 351 | # Check for proj_XFIGSRCS and proj_XFIGDIRS 352 | 353 | .for __tmp__ in ${NAME} 354 | .if defined(${__tmp__}_XFIGSRCS) || defined(${__tmp__}_XFIGDIRS) 355 | _USE_XFIG_MK= YES 356 | .endif 357 | .endfor 358 | 359 | 360 | # pull in xfig.[g]mk if needed 361 | 362 | .if defined(_USE_XFIG_MK) 363 | .include "${LATEX_MK_DIR}/xfig.mk" 364 | .endif 365 | 366 | ####################################### 367 | # 368 | # Targets 369 | # 370 | ####################################### 371 | 372 | ####################################### 373 | # target: view_ 374 | ####################################### 375 | 376 | .for __tmp__ in ${NAME} 377 | .PHONY: view_${__tmp__} 378 | .if defined(USE_PDFLATEX) 379 | view_${__tmp__}: viewpdf_${__tmp__} 380 | .else 381 | view_${__tmp__}: ${__tmp__}.dvi 382 | ${XDVI:Q} ${XDVI_FLAGS} ${__tmp__}.dvi 383 | .endif 384 | DEFAULTVIEW?= view_${__tmp__} 385 | ALLVIEW+= view_${__tmp__} 386 | .endfor 387 | 388 | 389 | ####################################### 390 | # target: viewps_ 391 | ####################################### 392 | 393 | .for __tmp__ in ${NAME} 394 | .PHONY: viewps_${__tmp__} 395 | viewps_${__tmp__}: ${__tmp__}.ps 396 | ${GV:Q} ${GV_FLAGS} ${__tmp__}.ps 397 | DEFAULTVIEWPS?= viewps_${__tmp__} 398 | ALLVIEWPS+= viewps_${__tmp__} 399 | .PHONY: viewps_${__tmp__}-draft 400 | viewps_${__tmp__}-draft: ${__tmp__}-draft.ps 401 | ${GV:Q} ${GV_FLAGS} ${__tmp__}-draft.ps 402 | DEFAULTVIEWPS_DRAFT?= viewps_${__tmp__}-draft 403 | ALLVIEWPS_DRAFT+= viewps_${__tmp__}-draft 404 | ${__tmp__}-draft.ps: ${__tmp__}.dvi ${DATED_DRAFT_PS} 405 | sed "s;DATE;`date`;g" ${DATED_DRAFT_PS:Q} > ${DRAFT_STAMP_PS:Q} 406 | ${ENV_PROG:Q} ${DVIPS_ENV} ${DVIPS:Q} -h ${DRAFT_STAMP_PS:Q} ${$*_DVIPS_FLAGS} ${DVIPS_FLAGS} -o $@ ${__tmp__}.dvi 407 | .endfor 408 | 409 | 410 | ####################################### 411 | # target: viewpdf_ 412 | ####################################### 413 | 414 | .for __tmp__ in ${NAME} 415 | .PHONY: viewpdf_${__tmp__} 416 | viewpdf_${__tmp__}: ${__tmp__}.pdf 417 | ${VIEWPDF:Q} ${VIEWPDF_FLAGS} ${__tmp__}.pdf 418 | DEFAULTVIEWPDF?= viewpdf_${__tmp__} 419 | ALLVIEWPDF+= viewpdf_${__tmp__} 420 | .PHONY: viewpdf_${__tmp__}-draft 421 | viewpdf_${__tmp__}-draft: ${__tmp__}-draft.pdf 422 | ${VIEWPDF:Q} ${VIEWPDF_FLAGS} ${__tmp__}-draft.pdf 423 | DEFAULTVIEWPDF_DRAFT?= viewpdf_${__tmp__}-draft 424 | ALLVIEWPDF_DRAFT+= viewpdf_${__tmp__}-draft 425 | .endfor 426 | 427 | 428 | ####################################### 429 | # target: print_ 430 | ####################################### 431 | 432 | .for __tmp__ in ${NAME} 433 | .PHONY: print_${__tmp__} 434 | print_${__tmp__}: ${__tmp__}.ps 435 | ${LPR:Q} ${LPR_FLAGS} ${__tmp__}.ps 436 | DEFAULTPRINT?= print_${__tmp__} 437 | ALLPRINT+= print_${__tmp__} 438 | .PHONY: print_${__tmp__}-draft 439 | print_${__tmp__}-draft: ${__tmp__}-draft.ps 440 | ${LPR:Q} ${LPR_FLAGS} ${__tmp__}-draft.ps 441 | DEFAULTPRINT_DRAFT?= print_${__tmp__}-draft 442 | ALLPRINT_DRAFT+= print_${__tmp__}-draft 443 | .endfor 444 | 445 | 446 | 447 | ####################################### 448 | 449 | ALLTEXSRCS= ${TEXSRCS} 450 | ALLBIBTEXSRCS= ${BIBTEXSRCS} 451 | 452 | ####################################### 453 | # 454 | # master name for the distfile 455 | # 456 | ####################################### 457 | 458 | .for __tmp__ in ${NAME} 459 | .if defined(ALLNAME) 460 | ALLNAME:= ${ALLNAME}_${__tmp__} 461 | .else 462 | ALLNAME= ${__tmp__} 463 | .endif 464 | .endfor 465 | 466 | 467 | .if ${ALLNAME} != ${NAME} 468 | dist: ${ALLNAME}.tar.gz 469 | ${ALLNAME}.tar.gz: ${NAME:=.tar.gz} 470 | ${RM:Q} -fr ${ALLNAME:Q} 471 | mkdir ${ALLNAME:Q} 472 | for f in ${NAME:=.tar.gz} ; do \ 473 | ${GZCAT:Q} $$f | (cd ${ALLNAME:Q} && ${TAR:Q} xpf -) ; \ 474 | done 475 | ${TAR:Q} cf - ${ALLNAME:Q} | ${GZIP:Q} > $@ 476 | ${RM:Q} -fr ${ALLNAME:Q} 477 | @${ECHO:Q} "******* Distfile left in ${ALLNAME}.tar.gz *******" 478 | .endif 479 | 480 | ####################################### 481 | # 482 | # add the dependencies for each documents .dvi file 483 | # 484 | ####################################### 485 | 486 | .for __tmp__ in ${NAME} 487 | ${__tmp__}.dvi: ${__tmp__}.tex ${TEXSRCS} ${${__tmp__}_TEXSRCS} ${OTHER} ${${__tmp__}_OTHER} 488 | # some older bmake versions will fail on the empty test if these variables 489 | # do not already exist 490 | BIBTEXSRCS?= 491 | ${__tmp__}_BIBTEXSRCS?= 492 | .if !empty(BIBTEXSRCS) || !empty(${__tmp__}_BIBTEXSRCS) 493 | ${__tmp__}.dvi: ${__tmp__}.bib-stamp 494 | ${__tmp__}.html-stamp: ${__tmp__}.bib-stamp 495 | .endif 496 | .if defined(USE_PDFLATEX) 497 | ${__tmp__}.pdf: ${__tmp__}.tex ${TEXSRCS} ${${__tmp__}_TEXSRCS} ${OTHER} ${${__tmp__}_OTHER} 498 | . if !empty(BIBTEXSRCS) || !empty(${__tmp__}_BIBTEXSRCS) 499 | ${__tmp__}.pdf: ${__tmp__}.bib-stamp 500 | . endif 501 | .endif 502 | ${__tmp__}.html-stamp: ${__tmp__}.tex ${TEXSRCS} ${${__tmp__}_TEXSRCS} ${OTHER} ${${__tmp__}_OTHER} 503 | ${__tmp__}.bib-stamp: ${BIBTEXSRCS} ${${__tmp__}_BIBTEXSRCS} 504 | .if defined(USE_PDFLATEX) 505 | ${ENV_PROG:Q} ${REAL_PDFLATEX_ENV} ${LATEX_MK:Q} ${LATEX_MK_FLAGS} --pdflatex --bibtex ${__tmp__}.tex 506 | .else 507 | ${ENV_PROG:Q} ${REAL_LATEX_ENV} ${LATEX_MK:Q} ${LATEX_MK_FLAGS} --bibtex ${__tmp__}.tex 508 | .endif 509 | touch $@ 510 | 511 | ALLTEXSRCS+= ${__tmp__}.tex ${${__tmp__}_TEXSRCS} 512 | ALLBIBTEXSRCS+= ${${__tmp__}_BIBTEXSRCS} 513 | dist: ${__tmp__}.tar.gz 514 | dvi: ${__tmp__}.dvi 515 | html: ${__tmp__}.html-stamp 516 | .PHONY: ${__tmp__}.html 517 | ${__tmp__}.html: ${__tmp__}.html-stamp 518 | 519 | # latex2html needs latex to run first because it makes use of the 520 | # .aux file. It seems that tex2page and hevea do not require this. 521 | .if defined(USE_LATEX2HTML) 522 | ${__tmp__}.html-stamp: ${__tmp__}.dvi 523 | .endif 524 | ps: ${__tmp__}.ps 525 | pdf: ${__tmp__}.pdf 526 | ps-draft: ${__tmp__}-draft.ps 527 | pdf-draft: ${__tmp__}-draft.pdf 528 | ${__tmp__}.rtf: ${__tmp__}.dvi 529 | rtf: ${__tmp__}.rtf 530 | clean:: 531 | if [ -f ${__tmp__}.www_files ]; then \ 532 | for f in `${AWK:Q} '{print $$2}' ${__tmp__}.www_files` ; do \ 533 | if [ -f $$f ]; then ${RM:Q} -f $$f ; fi ;\ 534 | done ;\ 535 | fi 536 | ${RM:Q} -f ${__tmp__}.www_files 537 | .if defined(USE_LATEX2HTML) 538 | ${RM:Q} -f ${__tmp__}.html_dir/images.aux 539 | ${RM:Q} -f ${__tmp__}.html_dir/images.bbl 540 | ${RM:Q} -f ${__tmp__}.html_dir/images.log 541 | ${RM:Q} -f ${__tmp__}.html_dir/images.out 542 | ${RM:Q} -f ${__tmp__}.html_dir/images.tex 543 | .endif 544 | if [ -d ${__tmp__}.html_dir ]; then ${RMDIR:Q} ${__tmp__}.html_dir ; fi 545 | 546 | # And add dependencies for a source tarball 547 | ${__tmp__}_DIST+= ${__tmp__}.tex ${TEXSRCS} ${${__tmp__}_TEXSRCS} ${BIBTEXSRCS} ${${__tmp__}_BIBTEXSRCS} ${OTHER} ${${__tmp__}_OTHER} ${MAKEFILE} ${${__tmp__}_EXTRA_DIST} ${EXTRA_DIST} 548 | ALL_DIST+= ${${__tmp__}_DIST} 549 | 550 | ${__tmp__}.tar.gz: ${${__tmp__}_DIST} 551 | ${TAR:Q} cf - ${${__tmp__}_DIST} | ${GZIP:Q} > $@ 552 | @${ECHO:Q} "******* Distfile left in $@ *******" 553 | .endfor 554 | 555 | 556 | 557 | ####################################### 558 | # target: view, view-all 559 | ####################################### 560 | 561 | .PHONY: view 562 | view: ${DEFAULTVIEW} 563 | .PHONY: view-all 564 | view-all: ${ALLVIEW} 565 | 566 | 567 | ####################################### 568 | # target: viewps, viewps-all 569 | ####################################### 570 | 571 | .PHONY: viewps 572 | viewps: ${DEFAULTVIEWPS} 573 | .PHONY: viewps-all 574 | viewps-all: ${ALLVIEWPS} 575 | 576 | ####################################### 577 | # target: viewpdf, viewpdf-all 578 | ####################################### 579 | 580 | .PHONY: viewpdf 581 | viewpdf: ${DEFAULTVIEWPDF} 582 | .PHONY: viewpdf-all 583 | viewpdf-all: ${ALLVIEWPDF} 584 | 585 | ####################################### 586 | # target: viewps-draft, viewps-all-draft 587 | ####################################### 588 | 589 | .PHONY: viewps-draft 590 | viewps-draft: ${DEFAULTVIEWPS_DRAFT} 591 | .PHONY: viewps-all-draft 592 | viewps-all-draft: ${ALLVIEWPS_DRAFT} 593 | 594 | ####################################### 595 | # target: viewpdf-draft, viewpdf-all-draft 596 | ####################################### 597 | 598 | .PHONY: viewpdf-draft 599 | viewpdf-draft: ${DEFAULTVIEWPDF_DRAFT} 600 | .PHONY: viewpdf-all-draft 601 | viewpdf-all-draft: ${ALLVIEWPDF_DRAFT} 602 | 603 | ####################################### 604 | # target: print, print-all 605 | ####################################### 606 | 607 | .PHONY: print 608 | print: ${DEFAULTPRINT} 609 | .PHONY: print-all 610 | print-all: ${ALLPRINT} 611 | 612 | ####################################### 613 | # target: print-draft, print-all-draft 614 | ####################################### 615 | 616 | .PHONY: print-draft 617 | print-draft: ${DEFAULTPRINT_DRAFT} 618 | .PHONY: print-all-draft 619 | print-all-draft: ${ALLPRINT_DRAFT} 620 | 621 | ####################################### 622 | # 623 | ####################################### 624 | 625 | .SUFFIXES : .tex .dvi .ps .pdf .rtf .html-stamp .png .jpg .eps 626 | 627 | .if defined(IGNORE_LATEX_ERRORS) 628 | LATEX_MK_FLAGS+= --ignore-errors 629 | .endif 630 | 631 | ####################################### 632 | # 633 | # Graphic file conversions 634 | # 635 | ####################################### 636 | .jpg.eps : 637 | ${JPG2EPS:Q} $< $@ 638 | 639 | .png.eps : 640 | ${PNG2EPS:Q} $< $@ 641 | 642 | ####################################### 643 | # 644 | # Distribution output (tarfile) 645 | # 646 | ####################################### 647 | .PHONY: dist 648 | 649 | ####################################### 650 | # 651 | # DVI Output (latex) 652 | # 653 | ####################################### 654 | .PHONY: dvi 655 | .tex.dvi : 656 | ${ENV_PROG:Q} ${REAL_LATEX_ENV} ${LATEX_MK:Q} ${LATEX_MK_FLAGS} $< 657 | 658 | ####################################### 659 | # 660 | # HTML Output (latex2html or HeVeA) 661 | # 662 | ####################################### 663 | 664 | # note: we have to use a time stamp file here to keep track of what files 665 | # get created by the html conversion. Neither latex2html nor hevea provide 666 | # a convenient way to get a list of files to clean. In addition, hevea 667 | # does not currently provide a DESTDIR type functionality which is needed 668 | # for dealing with multiple top level documents. 669 | 670 | 671 | .PHONY: html 672 | .tex.html-stamp : 673 | touch $@1 674 | .if defined(USE_LATEX2HTML) 675 | @${ECHO:Q} LaTeX-Mk: Creating HTML output using latex2html 676 | ${ENV_PROG:Q} ${LATEX2HTML_ENV} ${LATEX2HTML:Q} ${LATEX2HTML_FLAGS} -mkdir -dir $*.html_dir $< 677 | .elif defined(USE_TEX2PAGE) 678 | @${ECHO:Q} LaTeX-Mk: Creating HTML output using tex2page 679 | ${ECHO:Q} "$*.html_dir" > $*.hdir 680 | ${ENV_PROG:Q} ${REAL_TEX2PAGE_ENV} ${LATEX_MK:Q} --tex2page ${LATEX_MK_FLAGS} $< 681 | .elif defined(USE_HEVEA) 682 | @${ECHO:Q} LaTeX-Mk: Creating HTML output using HeVeA 683 | mkdir -p $*.html_dir 684 | -${ENV_PROG:Q} ${HEVEA_ENV} ${HEVEA:Q} $(HEVEA_FLAGS) $< 685 | -${ENV_PROG:Q} ${HEVEA_ENV} ${IMAGEN:Q} `basename $< .tex` 686 | -${ENV_PROG:Q} ${HEVEA_ENV} ${HEVEA:Q} $(HEVEA_FLAGS) $< 687 | .endif 688 | if [ ! -f $*.www_files ]; then touch $*.www_files ; fi 689 | for f in `${FIND:Q} . -type f \( -name \*.html -o -name \*.htm -o -name \*.gif \ 690 | -o -name \*.png -o -name \*.css -o -name \*.pl -o -name WARNINGS \ 691 | -o -name \*.scm -o -name \*.hlog \) \ 692 | -newer $@1 -print` ; do \ 693 | fn=`basename $$f` ; \ 694 | if ${GREP:Q} "^$$f " $*.www_files >/dev/null ; then \ 695 | echo "$$f already recorded" ; \ 696 | else \ 697 | echo "recording file $$f ($*.html_dir/$$fn)" ; \ 698 | echo "$$f $*.html_dir/$$fn" >> $*.www_files ; \ 699 | fi ;\ 700 | done 701 | .if defined(USE_TEX2PAGE) 702 | for f in `${FIND} . -type f \( -name \*-Z-G-\*.tex -o -name \*-Z-G-\*.aux \ 703 | -o -name \*-Z-G-\*.log -o -name \*-Z-G-\*.dvi -o -name \*-Z-G-\*.ps \ 704 | -o -name .Z\*.tex \) -newer $@1 -print` ; do \ 705 | fn=`basename $$f` ; \ 706 | if ${GREP:Q} "^$$f " $*.www_files >/dev/null ; then \ 707 | echo "$$f already recorded" ; \ 708 | elif test "`dirname $$f`" != "." ; then \ 709 | echo "$$f is not in this directory, skipping" ; \ 710 | else \ 711 | echo "recording file $$f (./$$fn)" ; \ 712 | echo "$$f ./$$fn" >> $*.www_files ; \ 713 | fi ;\ 714 | done 715 | .endif 716 | .if defined(USE_HEVEA) 717 | for f in `${AWK:Q} '{print $$1}' $*.www_files` ; do \ 718 | ${ECHO:Q} "Moving $$f to $*.html_dir" ; mv $$f $*.html_dir ; \ 719 | done 720 | .endif 721 | mv $@1 $@ 722 | 723 | ####################################### 724 | # 725 | # Postscript Output (dvips) 726 | # 727 | ####################################### 728 | .PHONY: ps 729 | 730 | # if we're doing a *-draft target, then add the 731 | # DRAFT watermark and time stamp 732 | .if make(*-draft) 733 | __DRAFT= yes 734 | .endif 735 | 736 | .dvi.ps : 737 | .if defined(__DRAFT) 738 | sed "s;DATE;`date`;g" ${DATED_DRAFT_PS:Q} > ${DRAFT_STAMP_PS:Q} 739 | ${DVIPS:Q} -h ${DRAFT_STAMP_PS:Q} ${$*_DVIPS_FLAGS} ${DVIPS_FLAGS} -o $*-draft.ps $< 740 | .else 741 | ${ENV_PROG:Q} ${DVIPS_ENV} ${DVIPS:Q} ${$*_DVIPS_FLAGS} ${DVIPS_FLAGS} -o $@ $< 742 | .endif 743 | 744 | ####################################### 745 | # 746 | # PDF Output (ps2pdf) 747 | # 748 | ####################################### 749 | .PHONY: pdf 750 | 751 | .if defined(USE_DVIPDFM) 752 | .dvi.pdf : 753 | ${ENV_PROG:Q} ${DVIPDFM_ENV} ${DVIPDFM:Q} ${$*_DVIPDFM_FLAGS} ${DVIPDFM_FLAGS} $< 754 | .elif defined(USE_PDFLATEX) 755 | .tex.pdf : 756 | ${ENV_PROG:Q} ${REAL_PDFLATEX_ENV} ${LATEX_MK:Q} --pdflatex ${LATEX_MK_FLAGS} $< 757 | .else 758 | .ps.pdf : 759 | ${PS2PDF:Q} ${PS2PDF_FLAGS} $< 760 | .endif 761 | 762 | ####################################### 763 | # 764 | # RTF (Rich Text Format) output (latex2rtf) 765 | # 766 | ####################################### 767 | .PHONY: rtf 768 | 769 | .dvi.rtf : 770 | ${ENV_PROG:Q} ${LATEX2RTF_ENV} ${LATEX2RTF:Q} ${LATEX2RTF_FLAGS} -o $@ $*.tex 771 | 772 | ####################################### 773 | # 774 | # Clean up (clean) 775 | # 776 | ####################################### 777 | CLEAN_FILES+= ${ALLTEXSRCS:.tex=.aux} 778 | CLEAN_FILES+= ${BIBTEXSRCS:.bib=.aux} 779 | CLEAN_FILES+= ${NAME:=.ps} 780 | CLEAN_FILES+= ${NAME:=-draft.ps} 781 | CLEAN_FILES+= ${NAME:=.pdf} 782 | CLEAN_FILES+= ${NAME:=-draft.pdf} 783 | CLEAN_FILES+= ${NAME:=.rtf} 784 | CLEAN_FILES+= ${NAME:=.aux} 785 | CLEAN_FILES+= ${NAME:=.log} 786 | CLEAN_FILES+= ${NAME:=.dvi} 787 | CLEAN_FILES+= ${NAME:=.log} 788 | CLEAN_FILES+= ${NAME:=.bbl} 789 | CLEAN_FILES+= ${NAME:=.blg} 790 | CLEAN_FILES+= ${NAME:=.glo} 791 | CLEAN_FILES+= ${NAME:=.gls} 792 | CLEAN_FILES+= ${NAME:=.ilg} 793 | CLEAN_FILES+= ${NAME:=.idx} 794 | CLEAN_FILES+= ${NAME:=.ind} 795 | CLEAN_FILES+= ${NAME:=.lof} 796 | CLEAN_FILES+= ${NAME:=.lot} 797 | CLEAN_FILES+= ${NAME:=.toc} 798 | CLEAN_FILES+= ${NAME:=.out} 799 | CLEAN_FILES+= $(DRAFT_STAMP_PS) 800 | CLEAN_FILES+= ${NAME:=.bib-stamp} 801 | 802 | # HTML generation 803 | CLEAN_FILES+= ${NAME:=.html-stamp} 804 | CLEAN_FILES+= ${NAME:=.www_files} 805 | 806 | .ifdef USE_HEVEA 807 | CLEAN_FILES+= ${NAME:=.haux} 808 | CLEAN_FILES+= ${NAME:=.image.tex} 809 | .endif 810 | 811 | .ifdef USE_LATEX2HTML 812 | CLEAN_FILES+= ${NAME:=.haux} 813 | CLEAN_FILES+= ${NAME:=.image.tex} 814 | .endif 815 | 816 | 817 | .ifdef USE_TEX2PAGE 818 | CLEAN_FILES+= ${NAME:=.hdir} 819 | .endif 820 | 821 | 822 | .PHONY: clean 823 | 824 | clean:: 825 | 826 | clean:: 827 | .for __tmp__ in ${NAME} 828 | ${LATEX_MK:Q} --clean ${__tmp__} 829 | .endfor 830 | ${RM:Q} -f *~ texput.log ${CLEAN_FILES} 831 | 832 | .PHONY: distclean 833 | distclean: clean 834 | 835 | ####################################### 836 | # 837 | # Some helpful debugging targets 838 | # 839 | ####################################### 840 | .PHONY: show-var 841 | show-var: 842 | @${ECHO:Q} ${${VARNAME}} 843 | 844 | -------------------------------------------------------------------------------- /config/make/latex-mk/latex.subdir.gmk: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # $Id: latex.subdir.mk.in.in,v 1.4 2006/01/28 04:43:18 dan Exp $ 3 | # 4 | # Copyright (c) 2002, 2006 Dan McMahill 5 | # All rights reserved. 6 | # 7 | # This code is derived from software written by Dan McMahill 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions 11 | # are met: 12 | # 1. Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 3. All advertising materials mentioning features or use of this software 18 | # must display the following acknowledgement: 19 | # This product includes software developed by Dan McMahill 20 | # 4. The name of the author may not be used to endorse or promote products 21 | # derived from this software without specific prior written permission. 22 | # 23 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 30 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 31 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 | # SUCH DAMAGE. 34 | # 35 | 36 | ECHO?= /bin/echo 37 | 38 | # 39 | # This Makefile fragment is included at the very end of users custom 40 | # Makefiles in subdirectories of a top level latex-mk Makefile. This 41 | # makes sure the standard set of targets exist so a recursive make 42 | # will not fail due to undefined targets 43 | 44 | # An example is: 45 | # 46 | # SUBDIR+= document1 47 | # SUBDIR+= document2 48 | # SUBDIR+= document3 49 | # include /path/to/latex.subdir.gmk 50 | # 51 | 52 | 53 | # note: we put "default" first because when we do not specify a target 54 | # we want to use "default" because thats what latex.mk has for its own 55 | # default 56 | _ALL_TARGETS= default all clean dist distclean dvi html pdf print print-all \ 57 | ps rtf show-var view viewall viewpdf viewps 58 | 59 | 60 | 61 | 62 | define _SUBDIRUSE_TEMPLATE 63 | .PHONY: $(1) 64 | $(1): 65 | @for entry in "" ${SUBDIR} ; do \ 66 | if [ "$$$$entry" != "" ] ; then \ 67 | OK=""; \ 68 | if [ -d $$$${entry} ]; then \ 69 | edir=$$$${entry}; \ 70 | else \ 71 | OK="false"; \ 72 | ${ECHO} "===> ${_THISDIR_}$$$${entry} non-existent"; \ 73 | fi; \ 74 | if [ "$$$$OK" = "" ]; then \ 75 | (cd $$$${edir}; \ 76 | ${ECHO} "===> ${_THISDIR_}$$$${edir}"; \ 77 | ${MAKE} ${MAKEFLAGS:%=-%} "_THISDIR_=${_THISDIR_}$$$${edir}/" \ 78 | $(1) || true;) \ 79 | fi; \ 80 | fi ; \ 81 | done 82 | endef 83 | $(foreach __tmp__,$(_ALL_TARGETS),$(eval $(call _SUBDIRUSE_TEMPLATE,$(__tmp__)))) 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /config/make/latex-mk/latex.subdir.mk: -------------------------------------------------------------------------------- 1 | # -*- makefile -*- 2 | # $Id: latex.subdir.mk.in.in,v 1.4 2006/01/28 04:43:18 dan Exp $ 3 | # 4 | # Copyright (c) 2002, 2006 Dan McMahill 5 | # All rights reserved. 6 | # 7 | # This code is derived from software written by Dan McMahill 8 | # 9 | # Redistribution and use in source and binary forms, with or without 10 | # modification, are permitted provided that the following conditions 11 | # are met: 12 | # 1. Redistributions of source code must retain the above copyright 13 | # notice, this list of conditions and the following disclaimer. 14 | # 2. Redistributions in binary form must reproduce the above copyright 15 | # notice, this list of conditions and the following disclaimer in the 16 | # documentation and/or other materials provided with the distribution. 17 | # 3. All advertising materials mentioning features or use of this software 18 | # must display the following acknowledgement: 19 | # This product includes software developed by Dan McMahill 20 | # 4. The name of the author may not be used to endorse or promote products 21 | # derived from this software without specific prior written permission. 22 | # 23 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 28 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 29 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 30 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 31 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 | # SUCH DAMAGE. 34 | # 35 | 36 | ECHO?= /bin/echo 37 | 38 | # 39 | # This Makefile fragment is included at the very end of users custom 40 | # Makefiles in subdirectories of a top level latex-mk Makefile. This 41 | # makes sure the standard set of targets exist so a recursive make 42 | # will not fail due to undefined targets 43 | 44 | # An example is: 45 | # 46 | # SUBDIR+= document1 47 | # SUBDIR+= document2 48 | # SUBDIR+= document3 49 | # .include "/path/to/latex.subdir.mk" 50 | # 51 | 52 | 53 | # note: we put "default" first because when we do not specify a target 54 | # we want to use "default" because thats what latex.mk has for its own 55 | # default 56 | _ALL_TARGETS= default all clean dist distclean dvi html pdf print print-all \ 57 | ps rtf show-var view viewall viewpdf viewps 58 | 59 | .for __target in ${_ALL_TARGETS} 60 | .if !target(${__target}) 61 | .PHONY: ${__target} 62 | ${__target}: _SUBDIRUSE 63 | .endif 64 | .endfor 65 | 66 | # 67 | # Derived from NetBSD Id: bsd.pkg.subdir.mk,v 1.60 2005/11/14 04:44:25 rillig Exp 68 | # Which in turn says: 69 | # Derived from: FreeBSD Id: bsd.port.subdir.mk,v 1.19 1997/03/09 23:10:56 wosch Exp 70 | # from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91 71 | 72 | .if !target(_SUBDIRUSE) 73 | _SUBDIRUSE: .USE 74 | @for entry in "" ${SUBDIR} ; do \ 75 | if [ "$$entry" != "" ] ; then \ 76 | OK=""; \ 77 | if [ -d ${.CURDIR}/$${entry} ]; then \ 78 | edir=$${entry}; \ 79 | else \ 80 | OK="false"; \ 81 | ${ECHO} "===> ${_THISDIR_}$${entry} non-existent"; \ 82 | fi; \ 83 | if [ "$$OK" = "" ]; then \ 84 | cd ${.CURDIR}/$${edir}; \ 85 | ${ECHO} "===> ${_THISDIR_}$${edir}"; \ 86 | ${MAKE} ${MAKEFLAGS} "_THISDIR_=${_THISDIR_}$${edir}/" \ 87 | ${.TARGET} || true; \ 88 | fi; \ 89 | fi ; \ 90 | done 91 | .endif 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /config/make/latex-mk/lgrind.gmk: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # $Id: lgrind.mk.in.in,v 1.7 2010/09/21 12:14:58 dan Exp $ 3 | # 4 | # Makefile fragment for processing lgrind files to produce postscript 5 | # 6 | # Copyright (c) 2005, 2010 Dan McMahill 7 | # 8 | # Copyright (c) 2005 Peter Bex 9 | # All rights reserved. 10 | # 11 | # This code is derived from software written by Dan McMahill 12 | # 13 | # Redistribution and use in source and binary forms, with or without 14 | # modification, are permitted provided that the following conditions 15 | # are met: 16 | # 1. Redistributions of source code must retain the above copyright 17 | # notice, this list of conditions and the following disclaimer. 18 | # 2. Redistributions in binary form must reproduce the above copyright 19 | # notice, this list of conditions and the following disclaimer in the 20 | # documentation and/or other materials provided with the distribution. 21 | # 3. All advertising materials mentioning features or use of this software 22 | # must display the following acknowledgement: 23 | # This product includes software developed by Dan McMahill 24 | # 4. The name of the author may not be used to endorse or promote products 25 | # derived from this software without specific prior written permission. 26 | # 27 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 28 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 31 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 32 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 34 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 35 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 | # SUCH DAMAGE. 38 | # 39 | 40 | 41 | ####################################### 42 | # 43 | # TODO: 44 | # - Add a way to deal with specifying the language on a per-file 45 | # or maybe per-directory basis. Maybe per-directory is a good 46 | # start. 47 | # 48 | # - Add support for files with no extension. Need to make sure 49 | # we don't have problems with CVS/ directories. In fact, we 50 | # need to make sure we don't have issues with foo.bar directories. 51 | # 52 | # - Add support for inline lgrind sources using the %(...)% notation 53 | # 54 | # README: 55 | # 56 | # To use this makefile fragment, set the variable: 57 | # LGRINDSRCS = the source files to process 58 | # in your top level Makefile. You can also specify 59 | # LGRINDDIRS which is a list of directories containing 60 | # source files. All source files in the specified directories 61 | # are added to LGRINDSRCS 62 | # 63 | # The following variables may be overridden in your top level Makefile 64 | # 65 | # LGRIND = the lgrind executable 66 | # LGRIND_FLAGS = flags passed to lgrind for exporting to tex 67 | # 68 | ####################################### 69 | 70 | 71 | # how to call lgrind to convert source files to TeX 72 | LGRIND?= lgrind 73 | LGRIND_FLAGS?= -i 74 | 75 | ####################################### 76 | # 77 | # Process LGRINDDIRS, adding to LGRINDSRCS 78 | # 79 | ####################################### 80 | 81 | # pick out $(LGRINDDIRS)/*.* except for *.tex for each 82 | # specified directory. This is how we will 83 | # deal with basically any source code file type. The 84 | # exception will be things like Makefiles which do not 85 | # have an extension usually. 86 | 87 | # While we're processing these directories, check for a directory 88 | # specific LGRIND_FLAGS (i.e. mydir_LGRIND_FLAGS). If it is defined 89 | # then assign it to the file specific lgrind flags for each source 90 | # file if the source file does not already have its own file specific 91 | # flags 92 | 93 | 94 | 95 | define lgrinddir_flag_template 96 | $(1)_LGRIND_FLAGS?= $($(2)_LGRIND_FLAGS) 97 | endef 98 | 99 | define lgrindsrcs_add_template 100 | LGRINDSRCS+= ${_LGRIND_ADD_$(1)} 101 | ifdef $(1)_LGRIND_FLAGS 102 | $(foreach __tmp2__,$(_LGRIND_ADD_$(1)),$(eval $(call lgrinddir_flag_template,$(__tmp2__),$(1)))) 103 | endif 104 | endef 105 | 106 | define lgrinddirs_template 107 | _LGRIND_ADD_$(1)= $(filter-out %.tex,$(wildcard $(1)/*.*)) 108 | endef 109 | $(foreach __tmp__,$(LGRINDDIRS),$(eval $(call lgrinddirs_template,$(__tmp__)))) 110 | $(foreach __tmp__,$(LGRINDDIRS),$(eval $(call lgrindsrcs_add_template,$(__tmp__)))) 111 | 112 | 113 | ####################################### 114 | # 115 | # Process proj_LGRINDDIRS, adding to proj_LGRINDSRCS 116 | # 117 | ####################################### 118 | 119 | 120 | 121 | define proj_lgrindsrcs_add_template 122 | $(2)_LGRINDSRCS+= ${_LGRIND_ADD2_$(1)} 123 | ifdef $(1)_LGRIND_FLAGS 124 | $(foreach __tmp2__,$(_LGRIND_ADD2_$(1)),$(eval $(call lgrinddir_flag_template,$(__tmp2__),$(1)))) 125 | endif 126 | endef 127 | 128 | define proj_lgrinddirs_template 129 | _LGRIND_ADD2_$(1)= $(filter-out %.tex,$(wildcard $(1)/*.*)) 130 | endef 131 | 132 | define proj_lgrind_template 133 | ifdef $(1)_LGRINDDIRS 134 | $(foreach __tmp2__,$($(1)_LGRINDDIRS),$(eval $(call proj_lgrinddirs_template,$(__tmp2__)))) 135 | $(foreach __tmp2__,$($(1)_LGRINDDIRS),$(eval $(call proj_lgrindsrcs_add_template,$(__tmp2__),$(1)))) 136 | endif 137 | $(1)_DIST+= $($(1)_LGRINDSRCS) $(LGRINDSRCS) 138 | endef 139 | $(foreach __tmp__,$(NAME),$(eval $(call proj_lgrind_template,$(__tmp__)))) 140 | 141 | 142 | ####################################### 143 | # 144 | # Process proj_LGRINDSRCS to add to 145 | # prog_OTHER dependencies 146 | # 147 | ####################################### 148 | 149 | LGRINDOBJS?= $(LGRINDSRCS:=.tex) 150 | ALLLGRINDOBJS+= $(LGRINDOBJS) 151 | 152 | 153 | # note, this had to be done in two steps (create proj_LGRINDOBJS, 154 | # and then add to proj_OTHER and ALLLGRINDOBJS) with GNU make 3.80 155 | # don't really know why. 156 | define lgrindobjs_template 157 | ifdef $(1)_LGRINDSRCS 158 | $(1)_LGRINDOBJS?= ${$(1)_LGRINDSRCS:=.tex} 159 | endif 160 | endef 161 | $(foreach __tmp__,$(NAME),$(eval $(call lgrindobjs_template,$(__tmp__)))) 162 | 163 | define lgrinddeps_template 164 | ifdef $(1)_LGRINDSRCS 165 | $(1)_OTHER+= ${$(1)_LGRINDOBJS} 166 | ALLLGRINDOBJS+= ${$(1)_LGRINDOBJS} 167 | endif 168 | endef 169 | $(foreach __tmp__,$(NAME),$(eval $(call lgrinddeps_template,$(__tmp__)))) 170 | 171 | 172 | ####################################### 173 | # 174 | # Add the dependencies 175 | # 176 | ####################################### 177 | 178 | 179 | OTHER+= $(LGRINDOBJS) 180 | all:: $(ALLLGRINDOBJS) 181 | 182 | clean:: 183 | $(RM) -f $(ALLLGRINDOBJS) 184 | 185 | 186 | ####################################### 187 | # 188 | # And add the build rules. 189 | # 190 | # Note that we do this as a loop with explicit 191 | # rules for each file rather than a suffix 192 | # rule because we want to work on any input 193 | # file that lgrind can deal with 194 | # 195 | ####################################### 196 | 197 | 198 | define lgrindrun_template 199 | $(1): $(1:.tex=) 200 | $(LGRIND) $(LGRIND_FLAGS) $($(1:.tex=)_LGRIND_FLAGS) -o $(1) $(1:.tex=) 201 | endef 202 | $(foreach __tmp__,$(ALLLGRINDOBJS),$(eval $(call lgrindrun_template,$(__tmp__)))) 203 | 204 | -------------------------------------------------------------------------------- /config/make/latex-mk/lgrind.mk: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # $Id: lgrind.mk.in.in,v 1.7 2010/09/21 12:14:58 dan Exp $ 3 | # 4 | # Makefile fragment for processing lgrind files to produce postscript 5 | # 6 | # Copyright (c) 2005, 2010 Dan McMahill 7 | # 8 | # Copyright (c) 2005 Peter Bex 9 | # All rights reserved. 10 | # 11 | # This code is derived from software written by Dan McMahill 12 | # 13 | # Redistribution and use in source and binary forms, with or without 14 | # modification, are permitted provided that the following conditions 15 | # are met: 16 | # 1. Redistributions of source code must retain the above copyright 17 | # notice, this list of conditions and the following disclaimer. 18 | # 2. Redistributions in binary form must reproduce the above copyright 19 | # notice, this list of conditions and the following disclaimer in the 20 | # documentation and/or other materials provided with the distribution. 21 | # 3. All advertising materials mentioning features or use of this software 22 | # must display the following acknowledgement: 23 | # This product includes software developed by Dan McMahill 24 | # 4. The name of the author may not be used to endorse or promote products 25 | # derived from this software without specific prior written permission. 26 | # 27 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 28 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 29 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 30 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 31 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 32 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 33 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 34 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 35 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 36 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 37 | # SUCH DAMAGE. 38 | # 39 | 40 | 41 | ####################################### 42 | # 43 | # TODO: 44 | # - Add a way to deal with specifying the language on a per-file 45 | # or maybe per-directory basis. Maybe per-directory is a good 46 | # start. 47 | # 48 | # - Add support for files with no extension. Need to make sure 49 | # we don't have problems with CVS/ directories. In fact, we 50 | # need to make sure we don't have issues with foo.bar directories. 51 | # 52 | # - Add support for inline lgrind sources using the %(...)% notation 53 | # 54 | # README: 55 | # 56 | # To use this makefile fragment, set the variable: 57 | # LGRINDSRCS = the source files to process 58 | # in your top level Makefile. You can also specify 59 | # LGRINDDIRS which is a list of directories containing 60 | # source files. All source files in the specified directories 61 | # are added to LGRINDSRCS 62 | # 63 | # The following variables may be overridden in your top level Makefile 64 | # 65 | # LGRIND = the lgrind executable 66 | # LGRIND_FLAGS = flags passed to lgrind for exporting to tex 67 | # 68 | ####################################### 69 | 70 | 71 | # how to call lgrind to convert source files to TeX 72 | LGRIND?= lgrind 73 | LGRIND_FLAGS?= -i 74 | 75 | ####################################### 76 | # 77 | # Process LGRINDDIRS, adding to LGRINDSRCS 78 | # 79 | ####################################### 80 | 81 | # pick out $(LGRINDDIRS)/*.* except for *.tex for each 82 | # specified directory. This is how we will 83 | # deal with basically any source code file type. The 84 | # exception will be things like Makefiles which do not 85 | # have an extension usually. 86 | 87 | # While we're processing these directories, check for a directory 88 | # specific LGRIND_FLAGS (i.e. mydir_LGRIND_FLAGS). If it is defined 89 | # then assign it to the file specific lgrind flags for each source 90 | # file if the source file does not already have its own file specific 91 | # flags 92 | 93 | .if defined(LGRINDDIRS) 94 | .for __tmp__ in ${LGRINDDIRS} 95 | .if exists(${__tmp__}) 96 | _LGRIND_ADDALL_${__tmp__}!= ls ${__tmp__}/*.* 97 | _LGRIND_ADD_${__tmp__}= ${_LGRIND_ADDALL_${__tmp__}:C/.*.tex$//g} 98 | LGRINDSRCS+= ${_LGRIND_ADD_${__tmp__}} 99 | . if defined(${__tmp__}_LGRIND_FLAGS) 100 | . for __tmp2__ in ${_LGRIND_ADD_${__tmp__}} 101 | ${__tmp2__}_LGRIND_FLAGS?= ${${__tmp__}_LGRIND_FLAGS} 102 | . endfor 103 | . endif 104 | .endif 105 | .endfor 106 | .endif 107 | 108 | 109 | 110 | 111 | 112 | 113 | ####################################### 114 | # 115 | # Process proj_LGRINDDIRS, adding to proj_LGRINDSRCS 116 | # 117 | ####################################### 118 | 119 | .for __name__ in ${NAME} 120 | .if defined(${__name__}_LGRINDDIRS) 121 | .for __tmp__ in ${${__name__}_LGRINDDIRS} 122 | .if exists(${__tmp__}) 123 | _LGRIND_ADDALL2_${__tmp__}!=ls ${__tmp__}/*.* 124 | _LGRIND_ADD2_${__tmp__}= ${_LGRIND_ADDALL2_${__tmp__}:C/.*.tex$//g} 125 | ${__name__}_LGRINDSRCS+= ${_LGRIND_ADD2_${__tmp__}} 126 | . if defined(${__tmp__}_LGRIND_FLAGS) 127 | . for __tmp2__ in ${_LGRIND_ADD2_${__tmp__}} 128 | ${__tmp2__}_LGRIND_FLAGS?= ${${__tmp__}_LGRIND_FLAGS} 129 | . endfor 130 | . endif 131 | .endif 132 | .endfor 133 | .endif 134 | ${__name__}_DIST+= ${${__name__}_LGRINDSRCS} ${LGRINDSRCS} 135 | .endfor 136 | 137 | 138 | 139 | 140 | 141 | 142 | ####################################### 143 | # 144 | # Process proj_LGRINDSRCS to add to 145 | # prog_OTHER dependencies 146 | # 147 | ####################################### 148 | 149 | LGRINDOBJS?= $(LGRINDSRCS:=.tex) 150 | ALLLGRINDOBJS+= $(LGRINDOBJS) 151 | 152 | .for __tmp__ in ${NAME} 153 | .if defined(${__tmp__}_LGRINDSRCS) 154 | ${__tmp__}_LGRINDOBJS?= ${${__tmp__}_LGRINDSRCS:=.tex} 155 | ${__tmp__}_OTHER+= ${${__tmp__}_LGRINDOBJS} 156 | ALLLGRINDOBJS+= ${${__tmp__}_LGRINDOBJS} 157 | .endif 158 | .endfor 159 | 160 | 161 | 162 | 163 | ####################################### 164 | # 165 | # Add the dependencies 166 | # 167 | ####################################### 168 | 169 | 170 | OTHER+= $(LGRINDOBJS) 171 | all:: $(ALLLGRINDOBJS) 172 | 173 | clean:: 174 | .for __tmp__ in $(ALLLGRINDOBJS) 175 | $(RM) -f $(__tmp__:Q) 176 | .endfor 177 | 178 | 179 | ####################################### 180 | # 181 | # And add the build rules. 182 | # 183 | # Note that we do this as a loop with explicit 184 | # rules for each file rather than a suffix 185 | # rule because we want to work on any input 186 | # file that lgrind can deal with 187 | # 188 | ####################################### 189 | 190 | .for __tmp__ in ${ALLLGRINDOBJS} 191 | ${__tmp__}: ${__tmp__:.tex=} 192 | $(LGRIND:Q) $(LGRIND_FLAGS) ${${__tmp__:.tex=}_LGRIND_FLAGS} \ 193 | -o $@ ${__tmp__:.tex=} 194 | .endfor 195 | 196 | 197 | -------------------------------------------------------------------------------- /config/make/latex-mk/mpost.gmk: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # $Id: mpost.mk.in.in,v 1.4 2007/08/26 20:38:26 dan Exp $ 3 | # 4 | # Makefile fragment for processing METAPOST files to produce postscript 5 | # 6 | # Copyright (c) 2007 Dan McMahill 7 | # All rights reserved. 8 | # 9 | # This code is derived from software written by Dan McMahill 10 | # 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 3. All advertising materials mentioning features or use of this software 20 | # must display the following acknowledgement: 21 | # This product includes software developed by Dan McMahill 22 | # 4. The name of the author may not be used to endorse or promote products 23 | # derived from this software without specific prior written permission. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 | # SUCH DAMAGE. 36 | # 37 | 38 | 39 | ####################################### 40 | # 41 | # README: 42 | # 43 | # To use this makefile fragment, set the variable: 44 | # MPOSTSRCS = the METAPOST input files (.mp files) 45 | # in your top level Makefile. You can also specify 46 | # MPOSTDIRS which is a list of directories containing 47 | # METAPOST files. All mpost files in the specified directories 48 | # are added to MPOSTSRCS 49 | # 50 | # The following variables may be overridden in your top level Makefile 51 | # 52 | # MPOST = the METAPOST executable 53 | # MPOST_FLAGS = flags passed to ${MPOST} 54 | # 55 | ####################################### 56 | 57 | 58 | # how to call METAPOST 59 | MPOST?= /usr/texbin/mpost 60 | MPOST_FLAGS?= 61 | 62 | ####################################### 63 | # 64 | # Process MPOSTDIRS, adding to MPOSTSRCS 65 | # 66 | ####################################### 67 | 68 | 69 | ifdef MPOSTDIRS 70 | MPOSTSRCS+= $(foreach __tmp__,$(MPOSTDIRS),$(wildcard $(__tmp__)/*.mp)) 71 | endif 72 | 73 | ####################################### 74 | # 75 | # Process proj_MPOSTDIRS, adding to proj_MPOSTSRCS 76 | # 77 | ####################################### 78 | 79 | 80 | define mpostdirs_template 81 | ifdef $(1)_MPOSTDIRS 82 | $(1)_MPOSTSRCS+= $(foreach __tmp2__,$($(1)_MPOSTDIRS),$(wildcard $(__tmp2__)/*.mp)) 83 | endif 84 | endef 85 | $(foreach __tmp__,$(NAME),$(eval $(call mpostdirs_template,$(__tmp__)))) 86 | 87 | ####################################### 88 | # 89 | # Process proj_MPOSTSRCS to add to 90 | # proj_OTHER dependencies 91 | # 92 | ####################################### 93 | 94 | 95 | MPOSTOBJS?= $(MPOSTSRCS:.mp=.mpx) 96 | ALLMPOSTOBJS+= $(MPOSTOBJS) 97 | 98 | 99 | # note, this had to be done in two steps (create proj_MPOSTOBJS, 100 | # and then add to proj_OTHER and ALLMPOSTOBJS) with GNU make 3.80 101 | # don't really know why. 102 | define mpostobjs_template 103 | ifdef $(1)_MPOSTSRCS 104 | $(1)_MPOSTOBJS?= ${$(1)_MPOSTSRCS:.mp=.mpx} 105 | endif 106 | $(1)_DIST+= ${$(1)_MPOSTSRCS} ${MPOSTSRCS} 107 | endef 108 | $(foreach __tmp__,$(NAME),$(eval $(call mpostobjs_template,$(__tmp__)))) 109 | 110 | define mpostdeps_template 111 | ifdef $(1)_MPOSTSRCS 112 | $(1)_OTHER+= ${$(1)_MPOSTOBJS} 113 | ALLMPOSTOBJS+= ${$(1)_MPOSTOBJS} 114 | endif 115 | endef 116 | $(foreach __tmp__,$(NAME),$(eval $(call mpostdeps_template,$(__tmp__)))) 117 | 118 | 119 | ####################################### 120 | # 121 | # Add the dependencies 122 | # 123 | ####################################### 124 | 125 | 126 | OTHER+= $(MPOSTOBJS) 127 | all:: $(ALLMPOSTOBJS) 128 | 129 | 130 | # we do this funny thing because neither BSD make nor GNU make 131 | # seem to like make conditionals in the middle of shell code 132 | ifdef USE_PDFLATEX 133 | _MPOST_PDF_REMOVE_= $$fn 134 | endif 135 | 136 | clean:: 137 | $(RM) -f $(ALLMPOSTOBJS) 138 | for mp in $(ALLMPOSTOBJS) ; do \ 139 | mpb=`basename $${mp} .mpx` ; \ 140 | for f in $${mpb}.ps $${mpb}.[0-9]* "" ; do \ 141 | if test "X$$f" != "X" ; then \ 142 | fn=`basename $$f .ps` ; \ 143 | fn=$${fn}.pdf ; \ 144 | $(RM) -f $$f ${_MPOST_PDF_REMOVE_}; \ 145 | fi ; \ 146 | done ; \ 147 | done 148 | 149 | ####################################### 150 | # 151 | # The suffix rules 152 | # 153 | ####################################### 154 | 155 | .SUFFIXES : .mp .mpx 156 | 157 | # if we are using pdflatex, then we probably need to convert our 158 | # postscript output to PDF 159 | 160 | .mp.mpx : 161 | $(MPOST) $(MPOST_FLAGS) $(MPOST_EPS_FLAGS) $*.mp 162 | ifdef MPOST_TWICE 163 | $(MPOST) $(MPOST_FLAGS) $(MPOST_EPS_FLAGS) $*.mp 164 | endif 165 | ifdef USE_PDFLATEX 166 | for f in $*.ps $*.[0-9]* "" ; do \ 167 | if test "X$$f" != "X" ; then \ 168 | fn=`basename $$f .ps` ; \ 169 | fn=$${fn}.pdf ; \ 170 | ${PS2PDF} ${PS2PDF_FLAGS} $$f $$fn ; \ 171 | fi ; \ 172 | done 173 | endif 174 | 175 | 176 | -------------------------------------------------------------------------------- /config/make/latex-mk/mpost.mk: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # $Id: mpost.mk.in.in,v 1.4 2007/08/26 20:38:26 dan Exp $ 3 | # 4 | # Makefile fragment for processing METAPOST files to produce postscript 5 | # 6 | # Copyright (c) 2007 Dan McMahill 7 | # All rights reserved. 8 | # 9 | # This code is derived from software written by Dan McMahill 10 | # 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 3. All advertising materials mentioning features or use of this software 20 | # must display the following acknowledgement: 21 | # This product includes software developed by Dan McMahill 22 | # 4. The name of the author may not be used to endorse or promote products 23 | # derived from this software without specific prior written permission. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 | # SUCH DAMAGE. 36 | # 37 | 38 | 39 | ####################################### 40 | # 41 | # README: 42 | # 43 | # To use this makefile fragment, set the variable: 44 | # MPOSTSRCS = the METAPOST input files (.mp files) 45 | # in your top level Makefile. You can also specify 46 | # MPOSTDIRS which is a list of directories containing 47 | # METAPOST files. All mpost files in the specified directories 48 | # are added to MPOSTSRCS 49 | # 50 | # The following variables may be overridden in your top level Makefile 51 | # 52 | # MPOST = the METAPOST executable 53 | # MPOST_FLAGS = flags passed to ${MPOST} 54 | # 55 | ####################################### 56 | 57 | 58 | # how to call METAPOST 59 | MPOST?= /usr/texbin/mpost 60 | MPOST_FLAGS?= 61 | 62 | ####################################### 63 | # 64 | # Process MPOSTDIRS, adding to MPOSTSRCS 65 | # 66 | ####################################### 67 | 68 | .if defined(MPOSTDIRS) 69 | .for __tmp__ in ${MPOSTDIRS} 70 | .if exists(${__tmp__}) 71 | _MPOST_ADD_${__tmp__}!= ls ${__tmp__}/*.mp 72 | MPOSTSRCS+= ${_MPOST_ADD_${__tmp__}} 73 | .endif 74 | .endfor 75 | .endif 76 | 77 | 78 | ####################################### 79 | # 80 | # Process proj_MPOSTDIRS, adding to proj_MPOSTSRCS 81 | # 82 | ####################################### 83 | 84 | .for __name__ in ${NAME} 85 | .if defined(${__name__}_MPOSTDIRS) 86 | .for __tmp__ in ${${__name__}_MPOSTDIRS} 87 | .if exists(${__tmp__}) 88 | _MPOST_ADD2_${__tmp__}!= ls ${__tmp__}/*.mp 89 | ${__name__}_MPOSTSRCS+= ${_MPOST_ADD2_${__tmp__}} 90 | .endif 91 | .endfor 92 | .endif 93 | .endfor 94 | 95 | 96 | ####################################### 97 | # 98 | # Process proj_MPOSTSRCS to add to 99 | # proj_OTHER dependencies 100 | # 101 | ####################################### 102 | 103 | 104 | MPOSTOBJS?= $(MPOSTSRCS:.mp=.mpx) 105 | ALLMPOSTOBJS+= $(MPOSTOBJS) 106 | 107 | .for __tmp__ in ${NAME} 108 | .if defined(${__tmp__}_MPOSTSRCS) 109 | ${__tmp__}_MPOSTOBJS?= ${${__tmp__}_MPOSTSRCS:.mp=.mpx} 110 | ${__tmp__}_OTHER+= ${${__tmp__}_MPOSTOBJS} 111 | ALLMPOSTOBJS+= ${${__tmp__}_MPOSTOBJS} 112 | .endif 113 | ${__tmp__}_DIST+= ${${__tmp__}_MPOSTSRCS} ${MPOSTSRCS} 114 | .endfor 115 | 116 | 117 | 118 | 119 | ####################################### 120 | # 121 | # Add the dependencies 122 | # 123 | ####################################### 124 | 125 | 126 | OTHER+= $(MPOSTOBJS) 127 | all:: $(ALLMPOSTOBJS) 128 | 129 | 130 | # we do this funny thing because neither BSD make nor GNU make 131 | # seem to like make conditionals in the middle of shell code 132 | .if defined(USE_PDFLATEX) 133 | _MPOST_PDF_REMOVE_= $$fn 134 | .endif 135 | 136 | clean:: 137 | .for __tmp__ in $(ALLMPOSTOBJS) 138 | $(RM) -f $(__tmp__:Q) 139 | .endfor 140 | for mp in $(ALLMPOSTOBJS) ; do \ 141 | mpb=`basename $${mp} .mpx` ; \ 142 | for f in $${mpb}.ps $${mpb}.[0-9]* "" ; do \ 143 | if test "X$$f" != "X" ; then \ 144 | fn=`basename $$f .ps` ; \ 145 | fn=$${fn}.pdf ; \ 146 | $(RM) -f $$f ${_MPOST_PDF_REMOVE_}; \ 147 | fi ; \ 148 | done ; \ 149 | done 150 | 151 | ####################################### 152 | # 153 | # The suffix rules 154 | # 155 | ####################################### 156 | 157 | .SUFFIXES : .mp .mpx 158 | 159 | # if we are using pdflatex, then we probably need to convert our 160 | # postscript output to PDF 161 | 162 | .mp.mpx : 163 | $(MPOST:Q) $(MPOST_FLAGS) $(MPOST_EPS_FLAGS) $*.mp 164 | .if defined(MPOST_TWICE) 165 | $(MPOST:Q) $(MPOST_FLAGS) $(MPOST_EPS_FLAGS) $*.mp 166 | .endif 167 | .if defined(USE_PDFLATEX) 168 | for f in $*.ps $*.[0-9]* "" ; do \ 169 | if test "X$$f" != "X" ; then \ 170 | fn=`basename $$f .ps` ; \ 171 | fn=$${fn}.pdf ; \ 172 | ${PS2PDF:Q} ${PS2PDF_FLAGS} $$f $$fn ; \ 173 | fi ; \ 174 | done 175 | .endif 176 | 177 | 178 | -------------------------------------------------------------------------------- /config/make/latex-mk/tgif.gmk: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # $Id: tgif.mk.in.in,v 1.15 2006/09/21 13:48:13 dan Exp $ 3 | # 4 | # Makefile fragment for processing tgif files to produce postscript 5 | # 6 | # Copyright (c) 2001, 2002, 2003, 2005, 2006 Dan McMahill 7 | # All rights reserved. 8 | # 9 | # This code is derived from software written by Dan McMahill 10 | # 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 3. All advertising materials mentioning features or use of this software 20 | # must display the following acknowledgement: 21 | # This product includes software developed by Dan McMahill 22 | # 4. The name of the author may not be used to endorse or promote products 23 | # derived from this software without specific prior written permission. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 | # SUCH DAMAGE. 36 | # 37 | 38 | 39 | ####################################### 40 | # 41 | # README: 42 | # 43 | # To use this makefile fragment, set the variable: 44 | # TGIFSRCS = the tgif drawing files (.obj files) 45 | # in your top level Makefile. You can also specify 46 | # TGIFDIRS which is a list of directories containing 47 | # tgif files. All tgif files in the specified directories 48 | # are added to TGIFSRCS 49 | # 50 | # The following variables may be overridden in your top level Makefile 51 | # 52 | # TGIF = the tgif executable 53 | # TGIF_FLAGS = flags passed to tgif for any exporting 54 | # TGIF_EPS_FLAGS = flags passed to tgif for exporting to eps 55 | # TGIF_PDF_FLAGS = flags passed to tgif for exporting to pdf 56 | # 57 | ####################################### 58 | 59 | 60 | # how to call tgif to convert tgif files to postscript 61 | TGIF?= tgif 62 | TGIF_FLAGS?= -color -print 63 | TGIF_EPS_FLAGS?= -eps 64 | TGIF_PDF_FLAGS?= -pdf 65 | 66 | ####################################### 67 | # 68 | # Process TGIFDIRS, adding to TGIFSRCS 69 | # 70 | ####################################### 71 | 72 | 73 | ifdef TGIFDIRS 74 | TGIFSRCS+= $(foreach __tmp__,$(TGIFDIRS),$(wildcard $(__tmp__)/*.obj)) 75 | endif 76 | 77 | ####################################### 78 | # 79 | # Process proj_TGIFDIRS, adding to proj_TGIFSRCS 80 | # 81 | ####################################### 82 | 83 | 84 | define tgifdirs_template 85 | ifdef $(1)_TGIFDIRS 86 | $(1)_TGIFSRCS+= $(foreach __tmp2__,$($(1)_TGIFDIRS),$(wildcard $(__tmp2__)/*.obj)) 87 | endif 88 | endef 89 | $(foreach __tmp__,$(NAME),$(eval $(call tgifdirs_template,$(__tmp__)))) 90 | 91 | ####################################### 92 | # 93 | # Process proj_TGIFSRCS to add to 94 | # proj_OTHER dependencies 95 | # 96 | ####################################### 97 | 98 | # if we are using pdflatex, then don't bother with the .eps files 99 | # but create .pdf files instead 100 | 101 | ifdef USE_PDFLATEX 102 | TGIFOBJS?= $(TGIFSRCS:.obj=.pdf) 103 | else 104 | TGIFOBJS?= $(TGIFSRCS:.obj=.eps) 105 | endif 106 | ALLTGIFOBJS+= $(TGIFOBJS) 107 | 108 | 109 | # note, this had to be done in two steps (create proj_TGIFOBJS, 110 | # and then add to proj_OTHER and ALLTGIFOBJS) with GNU make 3.80 111 | # don't really know why. 112 | define tgifobjs_template 113 | ifdef $(1)_TGIFSRCS 114 | ifdef USE_PDFLATEX 115 | $(1)_TGIFOBJS?= ${$(1)_TGIFSRCS:.obj=.pdf} 116 | else 117 | $(1)_TGIFOBJS?= ${$(1)_TGIFSRCS:.obj=.eps} 118 | endif 119 | endif 120 | $(1)_DIST+= ${$(1)_TGIFSRCS} ${TGIFSRCS} 121 | endef 122 | $(foreach __tmp__,$(NAME),$(eval $(call tgifobjs_template,$(__tmp__)))) 123 | 124 | define tgifdeps_template 125 | ifdef $(1)_TGIFSRCS 126 | $(1)_OTHER+= ${$(1)_TGIFOBJS} 127 | ALLTGIFOBJS+= ${$(1)_TGIFOBJS} 128 | endif 129 | endef 130 | $(foreach __tmp__,$(NAME),$(eval $(call tgifdeps_template,$(__tmp__)))) 131 | 132 | 133 | ####################################### 134 | # 135 | # Add the dependencies 136 | # 137 | ####################################### 138 | 139 | 140 | OTHER+= $(TGIFOBJS) 141 | all:: $(ALLTGIFOBJS) 142 | 143 | clean:: 144 | $(RM) -f $(ALLTGIFOBJS) 145 | 146 | ####################################### 147 | # 148 | # The suffix rules 149 | # 150 | ####################################### 151 | 152 | .SUFFIXES : .obj .eps .pdf 153 | 154 | .obj.eps : 155 | $(TGIF) $(TGIF_FLAGS) $(TGIF_EPS_FLAGS) $*.obj 156 | 157 | .obj.pdf : 158 | $(TGIF) $(TGIF_FLAGS) $(TGIF_PDF_FLAGS) $*.obj 159 | 160 | -------------------------------------------------------------------------------- /config/make/latex-mk/tgif.mk: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # $Id: tgif.mk.in.in,v 1.15 2006/09/21 13:48:13 dan Exp $ 3 | # 4 | # Makefile fragment for processing tgif files to produce postscript 5 | # 6 | # Copyright (c) 2001, 2002, 2003, 2005, 2006 Dan McMahill 7 | # All rights reserved. 8 | # 9 | # This code is derived from software written by Dan McMahill 10 | # 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 3. All advertising materials mentioning features or use of this software 20 | # must display the following acknowledgement: 21 | # This product includes software developed by Dan McMahill 22 | # 4. The name of the author may not be used to endorse or promote products 23 | # derived from this software without specific prior written permission. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 | # SUCH DAMAGE. 36 | # 37 | 38 | 39 | ####################################### 40 | # 41 | # README: 42 | # 43 | # To use this makefile fragment, set the variable: 44 | # TGIFSRCS = the tgif drawing files (.obj files) 45 | # in your top level Makefile. You can also specify 46 | # TGIFDIRS which is a list of directories containing 47 | # tgif files. All tgif files in the specified directories 48 | # are added to TGIFSRCS 49 | # 50 | # The following variables may be overridden in your top level Makefile 51 | # 52 | # TGIF = the tgif executable 53 | # TGIF_FLAGS = flags passed to tgif for any exporting 54 | # TGIF_EPS_FLAGS = flags passed to tgif for exporting to eps 55 | # TGIF_PDF_FLAGS = flags passed to tgif for exporting to pdf 56 | # 57 | ####################################### 58 | 59 | 60 | # how to call tgif to convert tgif files to postscript 61 | TGIF?= tgif 62 | TGIF_FLAGS?= -color -print 63 | TGIF_EPS_FLAGS?= -eps 64 | TGIF_PDF_FLAGS?= -pdf 65 | 66 | ####################################### 67 | # 68 | # Process TGIFDIRS, adding to TGIFSRCS 69 | # 70 | ####################################### 71 | 72 | .if defined(TGIFDIRS) 73 | .for __tmp__ in ${TGIFDIRS} 74 | .if exists(${__tmp__}) 75 | _TGIF_ADD_${__tmp__}!= ls ${__tmp__}/*.obj 76 | TGIFSRCS+= ${_TGIF_ADD_${__tmp__}} 77 | .endif 78 | .endfor 79 | .endif 80 | 81 | 82 | ####################################### 83 | # 84 | # Process proj_TGIFDIRS, adding to proj_TGIFSRCS 85 | # 86 | ####################################### 87 | 88 | .for __name__ in ${NAME} 89 | .if defined(${__name__}_TGIFDIRS) 90 | .for __tmp__ in ${${__name__}_TGIFDIRS} 91 | .if exists(${__tmp__}) 92 | _TGIF_ADD2_${__tmp__}!= ls ${__tmp__}/*.obj 93 | ${__name__}_TGIFSRCS+= ${_TGIF_ADD2_${__tmp__}} 94 | .endif 95 | .endfor 96 | .endif 97 | .endfor 98 | 99 | 100 | ####################################### 101 | # 102 | # Process proj_TGIFSRCS to add to 103 | # proj_OTHER dependencies 104 | # 105 | ####################################### 106 | 107 | # if we are using pdflatex, then don't bother with the .eps files 108 | # but create .pdf files instead 109 | 110 | .if defined(USE_PDFLATEX) 111 | TGIFOBJS?= $(TGIFSRCS:.obj=.pdf) 112 | .else 113 | TGIFOBJS?= $(TGIFSRCS:.obj=.eps) 114 | .endif 115 | ALLTGIFOBJS+= $(TGIFOBJS) 116 | 117 | .for __tmp__ in ${NAME} 118 | .if defined(${__tmp__}_TGIFSRCS) 119 | .if defined(USE_PDFLATEX) 120 | ${__tmp__}_TGIFOBJS?= ${${__tmp__}_TGIFSRCS:.obj=.pdf} 121 | .else 122 | ${__tmp__}_TGIFOBJS?= ${${__tmp__}_TGIFSRCS:.obj=.eps} 123 | .endif 124 | ${__tmp__}_OTHER+= ${${__tmp__}_TGIFOBJS} 125 | ALLTGIFOBJS+= ${${__tmp__}_TGIFOBJS} 126 | .endif 127 | ${__tmp__}_DIST+= ${${__tmp__}_TGIFSRCS} ${TGIFSRCS} 128 | .endfor 129 | 130 | 131 | 132 | 133 | ####################################### 134 | # 135 | # Add the dependencies 136 | # 137 | ####################################### 138 | 139 | 140 | OTHER+= $(TGIFOBJS) 141 | all:: $(ALLTGIFOBJS) 142 | 143 | clean:: 144 | .for __tmp__ in $(ALLTGIFOBJS) 145 | $(RM) -f $(__tmp__:Q) 146 | .endfor 147 | 148 | ####################################### 149 | # 150 | # The suffix rules 151 | # 152 | ####################################### 153 | 154 | .SUFFIXES : .obj .eps .pdf 155 | 156 | .obj.eps : 157 | $(TGIF:Q) $(TGIF_FLAGS) $(TGIF_EPS_FLAGS) $*.obj 158 | 159 | .obj.pdf : 160 | $(TGIF:Q) $(TGIF_FLAGS) $(TGIF_PDF_FLAGS) $*.obj 161 | 162 | -------------------------------------------------------------------------------- /config/make/latex-mk/xfig.gmk: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # $Id: xfig.mk.in.in,v 1.14 2010/03/12 21:21:41 dan Exp $ 3 | # 4 | # Makefile fragment for processing xfig files to produce postscript 5 | # 6 | # Copyright (c) 2002, 2003, 2004, 2005, 2006 Dan McMahill 7 | # All rights reserved. 8 | # 9 | # This code is derived from software written by Dan McMahill 10 | # 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 3. All advertising materials mentioning features or use of this software 20 | # must display the following acknowledgement: 21 | # This product includes software developed by Dan McMahill 22 | # 4. The name of the author may not be used to endorse or promote products 23 | # derived from this software without specific prior written permission. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 | # SUCH DAMAGE. 36 | # 37 | 38 | 39 | ####################################### 40 | # 41 | # README: 42 | # 43 | # To use this makefile fragment, set the variable: 44 | # XFIGSRCS = the xfig drawing files (.fig files) 45 | # in your top level Makefile. You can also specify 46 | # XFIGDIRS which is a list of directories containing 47 | # xfig files. All xfig files in the specified directories 48 | # are added to XFIGSRCS 49 | # 50 | # The following variables may be overridden in your top level Makefile 51 | # 52 | # FIG2DEV = the fig2dev executable 53 | # FIG2DEV_FLAGS = flags passed to fig2dev for all exporting 54 | # FIG2DEV_EPS_FLAGS = flags passed to fig2dev for exporting to eps 55 | # FIG2DEV_PDF_FLAGS = flags passed to fig2dev for exporting to pdf 56 | # 57 | ####################################### 58 | 59 | 60 | # how to call fig2dev to convert xfig files to postscript 61 | FIG2DEV?= fig2dev 62 | FIG2DEV_FLAGS?= 63 | FIG2DEV_EPS_FLAGS?= -L eps 64 | FIG2DEV_PDF_FLAGS?= -L pdf 65 | 66 | ####################################### 67 | # 68 | # Process XFIGDIRS, adding to XFIGSRCS 69 | # 70 | ####################################### 71 | 72 | 73 | ifdef XFIGDIRS 74 | XFIGSRCS+= $(foreach __tmp__,$(XFIGDIRS),$(wildcard $(__tmp__)/*.fig)) 75 | endif 76 | 77 | ####################################### 78 | # 79 | # Process proj_XFIGDIRS, adding to proj_XFIGSRCS 80 | # 81 | ####################################### 82 | 83 | 84 | define xfigdirs_template 85 | ifdef $(1)_XFIGDIRS 86 | $(1)_XFIGSRCS+= $(foreach __tmp2__,$($(1)_XFIGDIRS),$(wildcard $(__tmp2__)/*.fig)) 87 | endif 88 | endef 89 | $(foreach __tmp__,$(NAME),$(eval $(call xfigdirs_template,$(__tmp__)))) 90 | 91 | ####################################### 92 | # 93 | # Process proj_XFIGSRCS to add to 94 | # proj_OTHER dependencies 95 | # 96 | ####################################### 97 | 98 | # if we are using pdflatex, then don't bother with the .eps files 99 | # but create .pdf files instead 100 | 101 | ifdef USE_PDFLATEX 102 | XFIGOBJS?= $(XFIGSRCS:.fig=.pdf) 103 | else 104 | XFIGOBJS?= $(XFIGSRCS:.fig=.eps) 105 | endif 106 | ALLXFIGOBJS+= $(XFIGOBJS) 107 | 108 | 109 | # note, this had to be done in two steps (create proj_XFIGOBJS, 110 | # and then add to proj_OTHER and ALLXFIGOBJS) with GNU make 3.80 111 | # don't really know why. 112 | define xfigobjs_template 113 | ifdef $(1)_XFIGSRCS 114 | ifdef USE_PDFLATEX 115 | $(1)_XFIGOBJS?= ${$(1)_XFIGSRCS:.fig=.pdf} 116 | else 117 | $(1)_XFIGOBJS?= ${$(1)_XFIGSRCS:.fig=.eps} 118 | endif 119 | endif 120 | $(1)_DIST+= ${$(1)_XFIGSRCS} ${XFIGSRCS} 121 | endef 122 | $(foreach __tmp__,$(NAME),$(eval $(call xfigobjs_template,$(__tmp__)))) 123 | 124 | define xfigdeps_template 125 | ifdef $(1)_XFIGSRCS 126 | $(1)_OTHER+= ${$(1)_XFIGOBJS} 127 | ALLXFIGOBJS+= ${$(1)_XFIGOBJS} 128 | endif 129 | endef 130 | $(foreach __tmp__,$(NAME),$(eval $(call xfigdeps_template,$(__tmp__)))) 131 | 132 | 133 | ####################################### 134 | # 135 | # Add the dependencies 136 | # 137 | ####################################### 138 | 139 | 140 | OTHER+= $(XFIGOBJS) 141 | all:: $(ALLXFIGOBJS) 142 | 143 | clean:: 144 | $(RM) -f $(ALLXFIGOBJS) 145 | 146 | ####################################### 147 | # 148 | # The suffix rules 149 | # 150 | ####################################### 151 | 152 | .SUFFIXES : .fig .eps .pdf 153 | 154 | .fig.eps : 155 | $(FIG2DEV) $(FIG2DEV_FLAGS) $(FIG2DEV_EPS_FLAGS) $*.fig $*.eps 156 | 157 | .fig.pdf : 158 | $(FIG2DEV) $(FIG2DEV_FLAGS) $(FIG2DEV_PDF_FLAGS) $*.fig $*.pdf 159 | 160 | -------------------------------------------------------------------------------- /config/make/latex-mk/xfig.mk: -------------------------------------------------------------------------------- 1 | # -*- Makefile -*- 2 | # $Id: xfig.mk.in.in,v 1.14 2010/03/12 21:21:41 dan Exp $ 3 | # 4 | # Makefile fragment for processing xfig files to produce postscript 5 | # 6 | # Copyright (c) 2002, 2003, 2004, 2005, 2006 Dan McMahill 7 | # All rights reserved. 8 | # 9 | # This code is derived from software written by Dan McMahill 10 | # 11 | # Redistribution and use in source and binary forms, with or without 12 | # modification, are permitted provided that the following conditions 13 | # are met: 14 | # 1. Redistributions of source code must retain the above copyright 15 | # notice, this list of conditions and the following disclaimer. 16 | # 2. Redistributions in binary form must reproduce the above copyright 17 | # notice, this list of conditions and the following disclaimer in the 18 | # documentation and/or other materials provided with the distribution. 19 | # 3. All advertising materials mentioning features or use of this software 20 | # must display the following acknowledgement: 21 | # This product includes software developed by Dan McMahill 22 | # 4. The name of the author may not be used to endorse or promote products 23 | # derived from this software without specific prior written permission. 24 | # 25 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 26 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 27 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 28 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 29 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 30 | # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 32 | # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 | # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 | # SUCH DAMAGE. 36 | # 37 | 38 | 39 | ####################################### 40 | # 41 | # README: 42 | # 43 | # To use this makefile fragment, set the variable: 44 | # XFIGSRCS = the xfig drawing files (.fig files) 45 | # in your top level Makefile. You can also specify 46 | # XFIGDIRS which is a list of directories containing 47 | # xfig files. All xfig files in the specified directories 48 | # are added to XFIGSRCS 49 | # 50 | # The following variables may be overridden in your top level Makefile 51 | # 52 | # FIG2DEV = the fig2dev executable 53 | # FIG2DEV_FLAGS = flags passed to fig2dev for all exporting 54 | # FIG2DEV_EPS_FLAGS = flags passed to fig2dev for exporting to eps 55 | # FIG2DEV_PDF_FLAGS = flags passed to fig2dev for exporting to pdf 56 | # 57 | ####################################### 58 | 59 | 60 | # how to call fig2dev to convert xfig files to postscript 61 | FIG2DEV?= fig2dev 62 | FIG2DEV_FLAGS?= 63 | FIG2DEV_EPS_FLAGS?= -L eps 64 | FIG2DEV_PDF_FLAGS?= -L pdf 65 | 66 | ####################################### 67 | # 68 | # Process XFIGDIRS, adding to XFIGSRCS 69 | # 70 | ####################################### 71 | 72 | .if defined(XFIGDIRS) 73 | .for __tmp__ in ${XFIGDIRS} 74 | .if exists(${__tmp__}) 75 | _XFIG_ADD_${__tmp__}!= ls ${__tmp__}/*.fig 76 | XFIGSRCS+= ${_XFIG_ADD_${__tmp__}} 77 | .endif 78 | .endfor 79 | .endif 80 | 81 | 82 | ####################################### 83 | # 84 | # Process proj_XFIGDIRS, adding to proj_XFIGSRCS 85 | # 86 | ####################################### 87 | 88 | .for __name__ in ${NAME} 89 | .if defined(${__name__}_XFIGDIRS) 90 | .for __tmp__ in ${${__name__}_XFIGDIRS} 91 | .if exists(${__tmp__}) 92 | _XFIG_ADD2_${__tmp__}!= ls ${__tmp__}/*.fig 93 | ${__name__}_XFIGSRCS+= ${_XFIG_ADD2_${__tmp__}} 94 | .endif 95 | .endfor 96 | .endif 97 | .endfor 98 | 99 | 100 | ####################################### 101 | # 102 | # Process proj_XFIGSRCS to add to 103 | # proj_OTHER dependencies 104 | # 105 | ####################################### 106 | 107 | # if we are using pdflatex, then don't bother with the .eps files 108 | # but create .pdf files instead 109 | 110 | .if defined(USE_PDFLATEX) 111 | XFIGOBJS?= $(XFIGSRCS:.fig=.pdf) 112 | .else 113 | XFIGOBJS?= $(XFIGSRCS:.fig=.eps) 114 | .endif 115 | ALLXFIGOBJS+= $(XFIGOBJS) 116 | 117 | .for __tmp__ in ${NAME} 118 | .if defined(${__tmp__}_XFIGSRCS) 119 | .if defined(USE_PDFLATEX) 120 | ${__tmp__}_XFIGOBJS?= ${${__tmp__}_XFIGSRCS:.fig=.pdf} 121 | .else 122 | ${__tmp__}_XFIGOBJS?= ${${__tmp__}_XFIGSRCS:.fig=.eps} 123 | .endif 124 | ${__tmp__}_OTHER+= ${${__tmp__}_XFIGOBJS} 125 | ALLXFIGOBJS+= ${${__tmp__}_XFIGOBJS} 126 | .endif 127 | ${__tmp__}_DIST+= ${${__tmp__}_XFIGSRCS} ${XFIGSRCS} 128 | .endfor 129 | 130 | 131 | 132 | 133 | ####################################### 134 | # 135 | # Add the dependencies 136 | # 137 | ####################################### 138 | 139 | 140 | OTHER+= $(XFIGOBJS) 141 | all:: $(ALLXFIGOBJS) 142 | 143 | clean:: 144 | .for __tmp__ in $(ALLXFIGOBJS) 145 | $(RM) -f $(__tmp__:Q) 146 | .endfor 147 | 148 | ####################################### 149 | # 150 | # The suffix rules 151 | # 152 | ####################################### 153 | 154 | .SUFFIXES : .fig .eps .pdf 155 | 156 | .fig.eps : 157 | $(FIG2DEV:Q) $(FIG2DEV_FLAGS) $(FIG2DEV_EPS_FLAGS) $*.fig $*.eps 158 | 159 | .fig.pdf : 160 | $(FIG2DEV:Q) $(FIG2DEV_FLAGS) $(FIG2DEV_PDF_FLAGS) $*.fig $*.pdf 161 | 162 | -------------------------------------------------------------------------------- /config/make/latex.mk: -------------------------------------------------------------------------------- 1 | LILYDIR = lily 2 | FIGSDIR = figs 3 | DATADIR = data 4 | 5 | DIA_PNG= $(patsubst %.dia,%.png,$(wildcard $(FIGSDIR)/*.dia)) 6 | DIA_EPS= $(patsubst %.dia,%.eps,$(wildcard $(FIGSDIR)/*.dia)) 7 | CLEAN_FILES+= $(DIA_EPS:.dia=.eps) 8 | CLEAN_FILES+= $(DIA_PNG:.dia=.png) 9 | 10 | PNG_EPS= $(patsubst %.png,%.eps,$(wildcard $(FIGSDIR)/*.png)) 11 | PNG_PDF= $(patsubst %.png,%.pdf,$(wildcard $(FIGSDIR)/*.png)) 12 | CLEAN_FILES+= $(PNG_EPS:.plot=.eps) 13 | CLEAN_FILES+= $(PNG_PDF:.plot=.pdf) 14 | 15 | EPS_PDF= $(patsubst %.eps,%.pdf,$(wildcard $(FIGSDIR)/*.eps)) 16 | CLEAN_FILES+= $(PNG_PDF:.plot=.pdf) 17 | 18 | GNUPLOT_PDF= $(patsubst %.plot,%.pdf,$(wildcard $(DATADIR)/*.plot)) 19 | GNUPLOT_EPS= $(patsubst %.plot,%.eps,$(wildcard $(DATADIR)/*.plot)) 20 | CLEAN_FILES+= $(GNUPLOT_PDF:.plot=.pdf) 21 | CLEAN_FILES+= $(GNUPLOT_EPS:.plot=.eps) 22 | 23 | LILY_EPS= $(patsubst %.ly,%.eps,$(wildcard $(LILYDIR)/*.ly)) 24 | LILY_PNG= $(patsubst %.ly,%.png,$(wildcard $(LILYDIR)/*.ly)) 25 | LILY_PS = $(patsubst %.ly,%.ps,$(wildcard $(LILYDIR)/*.ly)) 26 | LILY_PDF= $(patsubst %.ly,%.pdf,$(wildcard $(LILYDIR)/*.ly)) 27 | LILY_SVG= $(patsubst %.ly,%.svg,$(wildcard $(LILYDIR)/*.ly)) 28 | LILY_WAV= $(patsubst %.ly,%.wav,$(wildcard $(LILYDIR)/*.ly)) 29 | CLEAN_FILES+= $(LILY_EPS:.ly=.eps) 30 | CLEAN_FILES+= $(LILY_PNG:.ly=.png) 31 | CLEAN_FILES+= $(LILY_PS:.ly=.ps) 32 | CLEAN_FILES+= $(LILY_PDF:.ly=.pdf) 33 | CLEAN_FILES+= $(LILY_PDF:.ly=.wav) 34 | 35 | TXT_HTML= $(patsubst %.txt,%.html,$(wildcard *.txt)) 36 | CLEAN_FILES+= $(TXT_HTML:.txt=.html) 37 | 38 | SVG_PNG= $(patsubst %.svg,%.png,$(wildcard $(FIGSDIR)/*.svg)) 39 | SVG_PDF= $(patsubst %.svg,%.pdf,$(wildcard $(FIGSDIR)/*.svg)) 40 | SVG_EPS= $(patsubst %.svg,%.eps,$(wildcard $(FIGSDIR)/*.svg)) 41 | CLEAN_FILES+= $(SVG_PNG:.svg=.pdf) 42 | CLEAN_FILES+= $(SVG_PDF:.svg=.png) 43 | CLEAN_FILES+= $(SVG_EPS:.svg=.eps) 44 | 45 | CLEAN_BEAMER = .nav .snm .vrb 46 | CLEAN_FILES+= $(foreach suffix,$(CLEAN_BEAMER),$(addsuffix $(suffix),$(NAME))) 47 | 48 | vpath %.eps $(FIGSDIR) 49 | vpath %.eps $(DATADIR) 50 | vpath %.pdf $(FIGSDIR) 51 | vpath %.pdf $(DATADIR) 52 | vpath %.ly $(LILYDIR) 53 | vpath %.svg $(FIGSDIR) 54 | 55 | #BIBTEXSRCS = 56 | #USE_HEVEA = 1 57 | #USE_LATEX2HTML = 1 58 | #USE_PDFLATEX = 1 59 | #USE_TEX2PAGE = 1 60 | #USE_DVIPDFM = 1 61 | #VIEWPDF 62 | 63 | doc: pdf 64 | 65 | %.html: %.tex 66 | htlatex $< 67 | 68 | %.pdf: %.eps 69 | epstopdf $< 70 | 71 | %.txt: %.html 72 | lynx -dump $< > $@ 73 | 74 | %.eps: %.plot %.dat 75 | gnuplot $< 76 | 77 | %.pdf: %.plot %.dat 78 | gnuplot $< 79 | epstopdf --outfile=$@ $(patsubst %.plot,%.eps, $<) 80 | 81 | %.eps: %.svg 82 | inkscape -T --export-eps=$@ $< 83 | 84 | %.png: %.svg 85 | inkscape -T --export-area-drawing --export-png=$@ $< 86 | 87 | %.pdf: %.svg 88 | inkscape -T --export-area-snap --export-pdf=$@ $< 89 | 90 | %.pdf: %.plot 91 | gnuplot $< 92 | convert $(subst plot,eps, $<) $@ 93 | 94 | %.eps: %.dia 95 | dia --export=$@ $< 96 | 97 | %.eps: %.png 98 | convert $< $@ 99 | 100 | %.png: %.dia 101 | dia --export=$@ $< 102 | 103 | %.png: %.ly 104 | lilypond --png -o $(basename $@) $< 105 | 106 | %.eps: %.ly 107 | lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts -o $(basename $@) $< 108 | 109 | %.ps: %.ly 110 | lilypond -f ps -o $(basename $@) $< 111 | 112 | %.pdf: %.ly 113 | lilypond --pdf -o $(basename $@) $< 114 | 115 | %.svg: %.ly 116 | lilypond -b svg -o $(basename $@) $< 117 | 118 | %.wav: %.midi 119 | timidity -Ow $< 120 | 121 | %.wav: %.mid 122 | timidity -Ow $< 123 | -------------------------------------------------------------------------------- /python-logo-notext.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sarabander/python-quick-ref/eec290ed59b49ce3e4ce9778060aaa956abd99d5/python-logo-notext.pdf -------------------------------------------------------------------------------- /python-logo-notext.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | image/svg+xml 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /python-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sarabander/python-quick-ref/eec290ed59b49ce3e4ce9778060aaa956abd99d5/python-logo.png -------------------------------------------------------------------------------- /python-quick-ref.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sarabander/python-quick-ref/eec290ed59b49ce3e4ce9778060aaa956abd99d5/python-quick-ref.pdf -------------------------------------------------------------------------------- /python-quick-ref.tex: -------------------------------------------------------------------------------- 1 | % Pedro Kroger 2010 2 | 3 | \documentclass{article} 4 | \usepackage{multicol} 5 | \usepackage{color} 6 | \usepackage{graphicx} 7 | \usepackage{url} 8 | \usepackage{dirtree} 9 | \usepackage[landscape,top=1cm, bottom=2cm, left=2cm, right=2cm]{geometry} 10 | \usepackage[T1]{fontenc} 11 | \usepackage[scaled=0.85]{beramono} 12 | %\usepackage{bera} 13 | \usepackage{fourier} 14 | \usepackage{tikz} 15 | 16 | \setlength\columnseprule{.4pt} 17 | \setlength\parindent{0pt} 18 | 19 | \definecolor{pythonblue}{RGB}{54,112,160} 20 | 21 | \renewcommand{\columnseprulecolor}{\color{pythonblue}} 22 | 23 | \pagestyle{empty} 24 | 25 | \definecolor{shade}{HTML}{D4D7FE} 26 | %\renewcommand*\DTstyle{\seriesdefault\tiny} 27 | 28 | \newcommand{\py}[2]{ 29 | \texttt{#1}(\textit{#2})\\ 30 | } 31 | 32 | \newcommand{\pyc}[1]{ 33 | \texttt{#1}\\ 34 | } 35 | 36 | \newcommand{\header}[1]{ 37 | \begin{tikzpicture} 38 | \node [fill=pythonblue!20,rounded corners=5pt] 39 | {\parbox{.95\linewidth}{\large \textcolor{pythonblue}{\sf \textbf{\hspace*{1ex}\raisebox{-15pt}{#1}}}\vspace*{1ex}} 40 | }; 41 | \end{tikzpicture} 42 | \par 43 | } 44 | 45 | \begin{document} 46 | 47 | \begin{minipage}[b]{0.1\linewidth} 48 | \includegraphics[scale=.64]{python-logo-notext} 49 | \end{minipage} 50 | \hfill 51 | \begin{minipage}[b]{0.9\linewidth} 52 | {\Huge \textcolor{pythonblue}{\textsf{\textbf{Python 3.1 Quick Reference}}}} \\ 53 | {\large available at \url{http://pedrokroger.net/python-quick-reference.html}} \\ 54 | \vspace{.8em} 55 | \end{minipage} 56 | 57 | \hrulefill 58 | 59 | \begin{multicols*}{4} 60 | 61 | \header{Built-in functions} 62 | 63 | \py{abs}{x} 64 | \py{all}{iter} 65 | \py{any}{iter} 66 | \py{ascii}{obj} 67 | \py{bin}{x} 68 | \py{bool}{[x]} 69 | \py{bytearray}{[arg,\,[encoding,\,[errors]]]} 70 | \py{bytes}{[arg,\,[encoding,\,[errors]]]} 71 | \py{chr}{i} 72 | \py{classmethod}{fn} 73 | \py{compile}{source,\,filename,\,mode} 74 | \py{complex}{real,\,[imag]} 75 | \py{dict}{[arg]} 76 | \py{dir}{[object]} 77 | \py{divmod}{x,\,y} 78 | \py{enumerate}{iter,\,start=0} 79 | \py{eval}{source,\,[globals,\,[locals]]} 80 | \py{filter}{fn,\,iter} 81 | \py{float}{[x]} 82 | \py{format}{alue,\,[format\_spec]} 83 | \py{frozenset}{[iter]} 84 | \py{getattr}{object,\,name,\,[default]} 85 | \py{globals}{} 86 | \py{hasattr}{object,\,name} 87 | \py{hash}{object} 88 | \py{help}{[object]} 89 | \py{hex}{x} 90 | \py{id}{object} 91 | \py{input}{[prompt]} 92 | \py{int}{[number | string,\,[base]]} 93 | \py{isinstance}{object,\,classinfo} 94 | \py{issubclass}{class,\,classinfo} 95 | \py{iter}{object,\,sentinel} 96 | \py{len}{object} 97 | \py{list}{[iter]} 98 | \py{locals}{} 99 | \py{map}{func,\,iter,\,\ldots} 100 | \py{max}{iter,\,[args...],\,*,\,[key]} 101 | \py{memoryview}{obj} 102 | \py{min}{iter,\,[args...],\,*,\,[key]} 103 | \py{next}{iterator,\,[default]} 104 | \py{object}{} 105 | \py{oct}{number} 106 | \py{open}{file, **keys} 107 | \py{ord}{c} 108 | \py{pow}{x,\,y,\,[z]} 109 | \py{print}{[obj,\,\ldots,\,sep,\,end,\,file]} 110 | \py{property}{**keys} 111 | \py{range}{[start,] stop,\,[step]} 112 | \py{repr}{object} 113 | \py{reversed}{sequence} 114 | \py{round}{x,\,[n]} 115 | \py{set}{iter} 116 | \py{setattr}{object,\,name,\,value} 117 | \py{slice}{[start],\,stop,\,[step]} 118 | \py{sorted}{iter,\,[key],\,[reverse]} 119 | \py{staticmethod}{unction} 120 | \py{str}{[object,\,[encoding,\,[errors]]]} 121 | \py{sum}{terable,\,[start]} 122 | \py{super}{[type,\,[object-or-type]]} 123 | \py{tuple}{[iter]} 124 | \py{type}{object} 125 | \py{type}{name,\,bases,\,dict} 126 | \py{vars}{[object]} 127 | \py{zip}{*iters} 128 | 129 | \header{Built-in constants} 130 | \texttt{False}, \texttt{True}, \texttt{None}\\ 131 | \texttt{Ellipsis}, \texttt{NotImplemented} 132 | 133 | \header{Boolean operations} 134 | 135 | \begin{tabular}{ll} 136 | \texttt{not x} & \\ 137 | \texttt{x or y} & \\ 138 | \texttt{x and y} & \\ 139 | \end{tabular} 140 | 141 | \header{Comparisons} 142 | 143 | \begin{tabular}{ll} 144 | \texttt{x < y} & \\ 145 | \texttt{x <= y} & \\ 146 | \texttt{x > y} & \\ 147 | \texttt{x >= y} & \\ 148 | \texttt{x == y} & \\ 149 | \texttt{x != y} & \\ 150 | \texttt{x is y} & \\ 151 | \texttt{x is not y} & \\ 152 | \texttt{x < y < z} & \\ 153 | \end{tabular} 154 | 155 | \header{Numeric operations} 156 | 157 | \begin{tabular}{ll} 158 | \texttt{x + y} & sum \\ 159 | \texttt{x - y} & subtraction \\ 160 | \texttt{x * y} & multiplication \\ 161 | \texttt{x / y} & quotient \\ 162 | \texttt{x // y} & floored quotient \\ 163 | \texttt{x \% y} & remainder \\ 164 | \texttt{-x} & negation \\ 165 | \texttt{+x} & identity \\ 166 | \texttt{x ** y} & x to the power y \\ 167 | \end{tabular} 168 | 169 | \header{Bit-string Operations} 170 | 171 | \begin{tabular}{ll} 172 | \texttt{x | y} & or \\ 173 | \texttt{x \& y} & and \\ 174 | \verb!x ^ y! & exclusive or \\ 175 | \verb!x << n! & bitwise left-shift \\ 176 | \verb!x >> n! & right-shift \\ 177 | \verb+~x+ & bitwise invert (integers) \\ 178 | \end{tabular} 179 | 180 | \header{Extended Assignment} 181 | 182 | \begin{tabular}{lll} 183 | \texttt{x += y} & & \texttt{x /= y} \\ 184 | \texttt{x \&= y} & & \verb!x >>= y! \\ 185 | \texttt{x -= y} & & \texttt{x \%= y} \\ 186 | \texttt{x |= y} & & \verb!x <<= y! \\ 187 | \texttt{x *= y} & & \texttt{x **= y} \\ 188 | \verb!x ^= y! & & \texttt{x //= y} \\ 189 | \end{tabular} 190 | 191 | \header{Sequence Assignment} 192 | 193 | \texttt{w = [1, 2, 3, 4]} 194 | 195 | \begin{tabular}{ll} 196 | \texttt{a, *b = w} & \texttt{(1, [2, 3, 4])} \\ 197 | \texttt{a, *b, c = w} & \texttt{(1, [2, 3], 4)} \\ 198 | \end{tabular} 199 | 200 | \header{Sequence Operations} 201 | 202 | \begin{tabular}{ll} 203 | \texttt{x in s} & membership \\ 204 | \texttt{x not in s} & membership \\ 205 | \texttt{s + t} & concatenation \\ 206 | \texttt{s * n, n * s} & copy s \texttt{n} times \\ 207 | \texttt{s[n]} & nth item of s \\ 208 | \texttt{s[i:j]} & from i to j \\ 209 | \texttt{s[i:j:k]} & from i to j, step k \\ 210 | \end{tabular} 211 | 212 | \header{Slice examples} 213 | 214 | \texttt{s = ['a', 'b', 'c']} 215 | 216 | \begin{tabular}{lll} 217 | \texttt{s[0]} & \texttt{'a'} & first \\ 218 | \texttt{s[-1]} & \texttt{'c'} & last \\ 219 | \texttt{s[1:]} & \texttt{['b', 'c']} & rest \\ 220 | \texttt{s[:-1]} & \texttt{['a', 'b']} & butlast \\ 221 | \end{tabular} 222 | 223 | \header{Float methods} 224 | 225 | \py{float.as\_integer\_ratio}{} 226 | \py{float.hex}{} 227 | \py{float.fromhex}{s} 228 | \header{List methods} 229 | 230 | \py{append}{obj} 231 | \py{extend}{iter} 232 | \py{count}{value} 233 | \py{index}{value,\,[start,\,[stop]]} 234 | \py{insert}{pos, obj} 235 | \py{pop}{[index]} 236 | \py{remove}{value} 237 | \py{reverse}{} 238 | \py{sort}{key=None, reverse=False} 239 | 240 | \header{String methods} 241 | 242 | \py{capitalize}{} 243 | \py{center}{width,\,[fillchar]} 244 | \py{count}{sub,\,[start,\,[end]]} 245 | \py{decode}{[encoding,\,[errors]]} 246 | \py{encode}{[encoding[,errors]]} 247 | \py{endswith}{suffix,\,[start,\,[end]]} 248 | \py{expandtabs}{[tabsize]} 249 | \py{find}{sub,\,[start,\,[end]]} 250 | \py{format}{*args,\,**kwargs} 251 | \py{index}{sub,\,[start,\,[end]]} 252 | \py{isalnum}{} 253 | \py{isalpha}{} 254 | \py{isdigit}{} 255 | \py{islower}{} 256 | \py{isspace}{} 257 | \py{istitle}{} 258 | \py{isupper}{} 259 | \py{join}{iterable} 260 | \py{ljust}{width,\,[fillchar]} 261 | \py{lower}{} 262 | \py{lstrip}{[chars]} 263 | \py{partition}{sep} 264 | \py{replace}{old,\,new,\,[count]} 265 | \py{rfind}{sub [,start [,end]]} 266 | \py{rindex}{sub,\,[start,\,[end]]} 267 | \py{rjust}{width,\,[fillchar]} 268 | \py{rpartition}{sep} 269 | \py{rsplit}{[sep [,maxsplit]]} 270 | \py{rstrip}{[chars]} 271 | \py{split}{[sep,\,[maxsplit]]} 272 | \py{splitlines}{[keepends]} 273 | \py{startswith}{prefix,\,[start,\,[end]]} 274 | \py{strip}{[chars]} 275 | \py{swapcase}{} 276 | \py{title}{} 277 | \py{translate}{table,\,[deletechars]} 278 | \py{upper}{} 279 | \py{zfill}{width} 280 | 281 | \header{Set methods} 282 | 283 | \py{add}{elem} 284 | \py{clear}{} 285 | \py{copy}{} 286 | \py{difference}{other,\,\ldots} 287 | \py{difference\_update}{other,\,\ldots} 288 | \py{discard}{elem} 289 | \py{intersection}{other,\,\ldots} 290 | \py{intersection\_update}{other,\,\ldots} 291 | \py{isdisjoint}{other} 292 | \py{issubset}{other} 293 | \py{issuperset}{other} 294 | \py{pop}{} 295 | \py{remove}{elem} 296 | \py{symmetric\_difference}{other} 297 | \py{symmetric\_difference\_update}{other} 298 | \py{union}{other,\,\ldots} 299 | \py{update}{other,\,\ldots} 300 | 301 | \header{Dictionary methods} 302 | 303 | \py{clear}{} 304 | \py{copy}{} 305 | \py{fromkeys}{seq,\,[value]} 306 | \py{get}{key,\,[default]} 307 | \py{items}{} 308 | %\py{iteritems}{} 309 | %\py{iterkeys}{} 310 | %\py{itervalues}{} 311 | \py{keys}{} 312 | \py{popitem}{} 313 | \py{pop}{key,\,[default]} 314 | \py{setdefault}{key,\,[default]} 315 | \py{update}{[other]} 316 | \py{values}{} 317 | %\py{viewitems}{} 318 | %\py{viewkeys}{} 319 | %\py{viewvalues}{} 320 | \header{File methods} 321 | 322 | \py{close}{} 323 | \py{flush}{} 324 | \py{fileno}{} 325 | \py{isatty}{} 326 | \py{next}{} 327 | \py{read}{[size]} 328 | \py{readline}{[size]} 329 | \py{readlines}{[sizehint]} 330 | \py{xreadlines}{} 331 | \py{seek}{offset, [whence]} 332 | \py{tell}{} 333 | \py{truncate}{[size]} 334 | \py{write}{str} 335 | \py{writelines}{sequence} 336 | 337 | \header{From future (python 2.6)} 338 | 339 | \texttt{from \_\_future\_\_ import } 340 | 341 | \begin{tabular}{ll} 342 | \texttt{absolute\_import} & PEP 328\\ 343 | \texttt{division} & PEP 238\\ 344 | \texttt{print\_function} & PEP 3105\\ 345 | \texttt{unicode\_literals} & PEP 3112\\ 346 | \end{tabular} 347 | 348 | \header{Keywords (keyword.kwlist)} 349 | \begin{verbatim} 350 | False None True and as assert 351 | break class continue def del in 352 | elif else except finally for is 353 | from global if import lambda 354 | nonlocal not or pass raise 355 | return try while with yield 356 | \end{verbatim} 357 | 358 | \header{Built-in exceptions} 359 | 360 | \dirtree{% 361 | .1 BaseException. 362 | .2 SystemExit. 363 | .2 KeyboardInterrupt. 364 | .2 GeneratorExit. 365 | .2 Exception. 366 | .2 StopIteration. 367 | } 368 | 369 | \dirtree{% 370 | .1 BaseException. 371 | .2 AssertionError. 372 | .2 AttributeError. 373 | .2 BufferError. 374 | .2 ArithmeticError. 375 | .3 FloatingPointError. 376 | .3 OverflowError. 377 | .3 ZeroDivisionError. 378 | .2 EnvironmentError. 379 | .3 IOError. 380 | .3 OSError. 381 | .3 WindowsError (Windows). 382 | .3 VMSError (VMS). 383 | .2 EOFError. 384 | .2 ImportError. 385 | .2 LookupError. 386 | .3 IndexError. 387 | .3 KeyError. 388 | .2 MemoryError. 389 | .2 NameError. 390 | .3 UnboundLocalError. 391 | .2 ReferenceError. 392 | .2 RuntimeError. 393 | .3 NotImplementedError. 394 | .2 SyntaxError. 395 | .3 IndentationError. 396 | .3 TabError. 397 | .2 SystemError. 398 | .2 TypeError. 399 | .2 ValueError. 400 | .3 UnicodeError. 401 | .3 UnicodeDecodeError. 402 | .3 UnicodeEncodeError. 403 | .3 UnicodeTranslateError. 404 | .2 Warning. 405 | .2 DeprecationWarning. 406 | .2 PendingDeprecationWarning. 407 | .2 RuntimeWarning. 408 | .2 SyntaxWarning. 409 | .2 UserWarning. 410 | .2 FutureWarning. 411 | .2 ImportWarning. 412 | .2 UnicodeWarning. 413 | .2 BytesWarning. 414 | } 415 | 416 | \end{multicols*} 417 | \end{document} 418 | 419 | \newpage 420 | 421 | \header{The string module} 422 | 423 | \pyc{ascii\_letters} 424 | \pyc{ascii\_lowercase} 425 | \pyc{ascii\_uppercase} 426 | \pyc{digits} 427 | \pyc{hexdigits} 428 | \pyc{octdigits} 429 | \pyc{printable} 430 | \pyc{punctuation} 431 | \pyc{whitespace} 432 | \py{format}{} 433 | \py{capwords}{} 434 | \py{maketrans}{} 435 | 436 | 437 | %%% Local Variables: 438 | %%% mode: latex 439 | %%% TeX-master: t 440 | %%% End: 441 | --------------------------------------------------------------------------------