/usr/share/latex-mk/latex.gmk is in latex-mk 2.1-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 | # -*- Makefile -*-
# $Id: latex.mk.in.in,v 1.68 2010/03/28 05:51:58 dan Exp $
#
# Makefile fragment for handling LaTeX projects
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Dan McMahill
# All rights reserved.
#
# This code is derived from software written by Dan McMahill
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Dan McMahill
# 4. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#######################################
#
# README:
#
# To use this makefile fragment, set the variable:
# NAME = Top level project name. Your top level LaTeX
# file should be called $(NAME).tex
#
# TEXSRCS = Additional LaTeX input files (.tex)
#
# and add the line:
# .include "latex.mk"
# in your top level Makefile
#
# The following variables may be overridden in your top level Makefile
#
# BIBTEX = the BibTeX executable
# BIBEX_FLAGS = flags passed to the BibTeX executable
# CONVERT = the 'convert' program which is part of ImageMagick
# DVIPDFM = the dvipdfm executable
# DVIPDFM_ENV = environment variables set when running the dvipdfm executable
# DVIPDFM_FLAGS= flags passed to the dvipdfm executable
# DVIPS = the dvips executable
# DVIPS_ENV = environment variables set when running the dvips executable
# DVIPS_FLAGS = flags passed to the dvips executable
# GZIP = gzip program
# GV = a postscript previewer executable
# GV_FLAGS = flags passed to the postscript previewer executable
# JPG2EPS = program and flags used to convert JPEG files to EPS
# LATEX = the LaTeX executable
# LATEX_ENV = environment variables set when running the LaTeX executable
# LATEX_FLAGS = flags passed to the LaTeX executable
# LATEX2HTML = LaTeX2HTML executable
# LATEX2HTML_ENV
# = environment variables set when running LATEX2HTML
# LATEX2HTML_FLAGS
# = flags passed to LATEX2HTML
# LATEX2RTF = LaTeX2RTF executable
# LATEX2RTF_ENV
# = environment variables set when running LATEX2RTF
# LATEX2RTF_FLAGS
# = flags passed to LATEX2RTF
# LPR = executable to print postscript files
# LPR_FLAGS = flags passed to the executable to print postscript files
# MAKEIDX = the makeindex executable
# MAKEIDX_FLAGS= flags passed to the makeindex executable
# MAKEGLS = executable to create glossary
# MAKEGLS_FLAGS= flags passed to the executable to create glossary
# PDFLATEX = pdflatex executable
# PDFLATEX_ENV = environment variables set when running the PDFLaTeX executable
# PDFLATEX_FLAGS= flags passed to the PDFLaTeX executable
# PNG2EPS = program and flags used to convert PNG files to EPS
# PS2PDF = ps2pdf executable
# PS2PDF_FLAGS = flags passed to the ps2pdf executable
# TAR = tape archiver program
# VIEWPDF = PDF viewer
# VIEWPDF_FLAGS= PDF viewer flags
# XDVI = a .dvi previewer executable
# XDVI_FLAGS = flags passed to the .dvi previewer executable
#
# USE_DVIPDFM = set to use dvipdfm to create pdf files from dvi
# instead of using dvips and ps2pdf
# USE_PDFLATEX = set to use pdflatex to create pdf files from .tex
# files instead of using latex, dvips and ps2pdf
#
#######################################
# figure out the name of the Makefile. We'll need this to include
# in the tar file created as part of the 'dist' target
MAKEFILE:= $(word 1,${MAKEFILE_LIST})
MAKECONF?= /etc/latex-gmk.conf
USER_MAKECONF?= ${HOME}/.latex-gmk.conf
_CONFS= $(wildcard ${MAKECONF})
_CONFS+= $(wildcard ${USER_MAKECONF})
include ${_CONFS}
# Make sure we set at least 1 way for creating html files
ifndef USE_HEVEA
ifndef USE_TEX2PAGE
USE_LATEX2HTML= YES
endif
endif
# The location of the latex-mk .mk and .gmk files
# we do this instead of hard coding so the package
# can be tested before installation by setting this
# variable in a test config file
LATEX_MK_DIR?= /usr/share/latex-mk
AWK?= /usr/bin/awk
BIBTEX?= /usr/bin/bibtex
CONVERT?= /usr/bin/convert
DVIPDFM?= /usr/bin/dvipdfm
DVIPDFM_ENV?=
DVIPDFM_FLAGS+=
DVIPDFM_LANDSCAPE_FLAGS?= -l
DVIPS?= /usr/bin/dvips
DVIPS_ENV?=
DVIPS_FLAGS+= -j0
DVIPS_LANDSCAPE_FLAGS?= -t landscape
ECHO?= /bin/echo
ENV_PROG?= /usr/bin/env
FALSE?= /bin/false
FIND?= /usr/bin/find
GREP?= /bin/grep
GV?= /usr/bin/gv
GV_FLAGS?=
GV_LANDSCAPE_FLAGS?= -landscape
GZCAT?= gunzip -c
GZIP?= /bin/gzip
HACHA?= /usr/bin/hacha
HACHA_ENV?=
HACHA_FLAGS?=
HEVEA?= /usr/bin/hevea
HEVEA_ENV?=
HEVEA_FLAGS?= -fix
IMAGEN?= /usr/bin/imagen
JPG2EPS?= ${CONVERT}
LATEX_MK?= /usr/bin/latex-mk
LATEX_MK_FLAGS?=
LATEX?= /usr/bin/latex
LATEX_ENV?=
LATEX2HTML?= latex2html
LATEX2HTML_ENV?=
LATEX2HTML_FLAGS?=-image_type png -local_icons -show_section_numbers
LATEX2RTF?= /usr/bin/latex2rtf
LATEX2RTF_ENV?=
LATEX2RTF_FLAGS?=
LPR?= /usr/bin/lpr
LPR_FLAGS?=
MAKEIDX?= /usr/bin/makeindex
MAKEIDX_FLAGS?=
MAKEGLS?= /usr/bin/makeindex
MAKEGLS_FLAGS?=
PDFLATEX?= /usr/bin/pdflatex
PDFLATEX_ENV?=
PDFLATEX_FLAGS?=
PNG2EPS?= ${CONVERT}
POST_BIBTEX_HOOK?=
RM?= /bin/rm
RMDIR?= /bin/rmdir
PS2PDF?= /usr/bin/ps2pdf
PS2PDF_FLAGS?=
TAR?= /bin/tar
TEX2PAGE?= tex2page
TEX2PAGE_ENV?=
TEX2PAGE_FLAGS?=
XDVI?= /usr/bin/xdvi
XDVI_FLAGS?=
XDVI_LANDSCAPE_FLAGS?= -paper usr
VIEWPDF?= ${GV}
VIEWPDF_FLAGS?= ${GV_FLAGS}
VIEWPDF_LANDSCAPE_FLAGS?= ${GV_LANDSCAPE_FLAGS}
DRAFT_STAMP_PS?= draft_stamp.ps
DATED_DRAFT_PS?= ${LATEX_MK_DIR}/dated_draft.ps
.PHONY: default
default: all
.MAIN: all
.PHONY: all
all:: view-all
ifdef LANDSCAPE
DVIPS_FLAGS+= ${DVIPS_LANDSCAPE_FLAGS}
DVIPDFM_FLAGS+= ${DVIPDFM_LANDSCAPE_FLAGS}
GV_FLAGS+= ${GV_LANDSCAPE_FLAGS}
XDVI_FLAGS+= ${XDVI_LANDSCAPE_FLAGS}
VIEWPDF_FLAGS+= ${VIEWPDF_LANDSCAPE_FLAGS}
endif
REAL_LATEX_ENV+= LATEX=${LATEX}
REAL_LATEX_ENV+= LATEX_FLAGS=${LATEX_FLAGS}
REAL_LATEX_ENV+= BIBTEX=${BIBTEX}
REAL_LATEX_ENV+= BIBTEX_FLAGS=${BIBTEX_FLAGS}
REAL_LATEX_ENV+= MAKEIDX=${MAKEIDX}
REAL_LATEX_ENV+= MAKEIDX_FLAGS=${MAKEIDX_FLAGS}
REAL_LATEX_ENV+= MAKEGLS=${MAKEGLS}
REAL_LATEX_ENV+= MAKEGLS_FLAGS=${MAKEGLS_FLAGS}
REAL_LATEX_ENV+= POST_BIBTEX_HOOK=${POST_BIBTEX_HOOK}
REAL_LATEX_ENV+= ${LATEX_ENV}
REAL_PDFLATEX_ENV+= PDFLATEX=${PDFLATEX}
REAL_PDFLATEX_ENV+= PDFLATEX_FLAGS=${PDFLATEX_FLAGS}
REAL_PDFLATEX_ENV+= BIBTEX=${BIBTEX}
REAL_PDFLATEX_ENV+= BIBTEX_FLAGS=${BIBTEX_FLAGS}
REAL_PDFLATEX_ENV+= MAKEIDX=${MAKEIDX}
REAL_PDFLATEX_ENV+= MAKEIDX_FLAGS=${MAKEIDX_FLAGS}
REAL_PDFLATEX_ENV+= MAKEGLS=${MAKEGLS}
REAL_PDFLATEX_ENV+= MAKEGLS_FLAGS=${MAKEGLS_FLAGS}
REAL_PDFLATEX_ENV+= POST_BIBTEX_HOOK=${POST_BIBTEX_HOOK}
REAL_PDFLATEX_ENV+= ${PDFLATEX_ENV}
REAL_TEX2PAGE_ENV+= TEX2PAGE=${TEX2PAGE}
REAL_TEX2PAGE_ENV+= TEX2PAGE_FLAGS=${TEX2PAGE_FLAGS}
REAL_TEX2PAGE_ENV+= BIBTEX=${BIBTEX}
REAL_TEX2PAGE_ENV+= BIBTEX_FLAGS=${BIBTEX_FLAGS}
REAL_TEX2PAGE_ENV+= MAKEIDX=${MAKEIDX}
REAL_TEX2PAGE_ENV+= MAKEIDX_FLAGS=${MAKEIDX_FLAGS}
REAL_TEX2PAGE_ENV+= MAKEGLS=${MAKEGLS}
REAL_TEX2PAGE_ENV+= MAKEGLS_FLAGS=${MAKEGLS_FLAGS}
REAL_TEX2PAGE_ENV+= POST_BIBTEX_HOOK=${POST_BIBTEX_HOOK}
REAL_TEX2PAGE_ENV+= ${TEX2PAGE_ENV}
# Include other .mk files often times used with LaTeX
#######################################
#
# Check for lgrind
#
#######################################
# Check for LGRINDSRCS and LGRINDDIRS
ifdef LGRINDSRCS
_USE_LGRIND_MK+= YES
endif
ifdef LGRINDDIRS
_USE_LGRIND_MK+= YES
endif
# Check for proj_LGRINDSRCS and proj_LGRINDDIRS
define add_lgrind_mk_template
ifdef $(1)_LGRINDSRCS
_USE_LGRIND_MK= YES
endif
ifdef $(1)_LGRINDDIRS
_USE_LGRIND_MK= YES
endif
endef
$(foreach __tmp__,$(NAME),$(eval $(call add_lgrind_mk_template,$(__tmp__))))
# pull in lgrind.[g]mk if needed
ifdef _USE_LGRIND_MK
include ${LATEX_MK_DIR}/lgrind.gmk
endif
#######################################
#
# Check for METAPOST
#
#######################################
# Check for MPOSTSRCS and MPOSTDIRS
ifdef MPOSTSRCS
_USE_MPOST_MK+= YES
endif
ifdef MPOSTDIRS
_USE_MPOST_MK+= YES
endif
# Check for proj_MPOSTSRCS and proj_MPOSTDIRS
define add_mpost_mk_template
ifdef $(1)_MPOSTSRCS
_USE_MPOST_MK= YES
endif
ifdef $(1)_MPOSTDIRS
_USE_MPOST_MK= YES
endif
endef
$(foreach __tmp__,$(NAME),$(eval $(call add_mpost_mk_template,$(__tmp__))))
# pull in mpost.[g]mk if needed
ifdef _USE_MPOST_MK
include ${LATEX_MK_DIR}/mpost.gmk
endif
#######################################
#
# Check for tgif
#
#######################################
# Check for TGIFSRCS and TGIFDIRS
ifdef TGIFSRCS
_USE_TGIF_MK+= YES
endif
ifdef TGIFDIRS
_USE_TGIF_MK+= YES
endif
# Check for proj_TGIFSRCS and proj_TGIFDIRS
define add_tgif_mk_template
ifdef $(1)_TGIFSRCS
_USE_TGIF_MK= YES
endif
ifdef $(1)_TGIFDIRS
_USE_TGIF_MK= YES
endif
endef
$(foreach __tmp__,$(NAME),$(eval $(call add_tgif_mk_template,$(__tmp__))))
# pull in tgif.[g]mk if needed
ifdef _USE_TGIF_MK
include ${LATEX_MK_DIR}/tgif.gmk
endif
#######################################
#
# Check for xfig
#
#######################################
# Check for XFIGSRCS and XFIGDIRS
ifdef XFIGSRCS
_USE_XFIG_MK+= YES
endif
ifdef XFIGDIRS
_USE_XFIG_MK+= YES
endif
# Check for proj_XFIGSRCS and proj_XFIGDIRS
define add_xfig_mk_template
ifdef $(1)_XFIGSRCS
_USE_XFIG_MK= YES
endif
ifdef $(1)_XFIGDIRS
_USE_XFIG_MK= YES
endif
endef
$(foreach __tmp__,$(NAME),$(eval $(call add_xfig_mk_template,$(__tmp__))))
# pull in xfig.[g]mk if needed
ifdef _USE_XFIG_MK
include ${LATEX_MK_DIR}/xfig.gmk
endif
#######################################
#
# Targets
#
#######################################
#######################################
# target: view_<proj>
#######################################
define view_template
.PHONY: view_$(1)
ifdef USE_PDFLATEX
view_$(1): viewpdf_$(1)
else
view_$(1): $(1).dvi
$(XDVI) $(XDVI_FLAGS) $(1).dvi
endif
ALLVIEW+= view_$(1)
DEFAULTVIEW?= view_$(1)
endef
$(foreach __tmp__,$(NAME),$(eval $(call view_template,$(__tmp__))))
#######################################
# target: viewps_<proj>
#######################################
define viewps_template
.PHONY: viewps_$(1)
viewps_$(1): $(1).ps
$(GV) $(GV_FLAGS) $(1).ps
DEFAULTVIEWPS?= viewps_$(1)
ALLVIEWPS+= viewps_$(1)
.PHONY: viewps_$(1)-draft
viewps_$(1)-draft: $(1)-draft.ps
$(GV) $(GV_FLAGS) $(1)-draft.ps
DEFAULTVIEWPS_DRAFT?= viewps_$(1)-draft
ALLVIEWPS_DRAFT+= viewps_$(1)-draft
$(1)-draft.ps: $(1).dvi ${DATED_DRAFT_PS}
sed "s;DATE;`date`;g" ${DATED_DRAFT_PS} > ${DRAFT_STAMP_PS}
${ENV_PROG} ${DVIPS_ENV} $(DVIPS) -h ${DRAFT_STAMP_PS} ${$*_DVIPS_FLAGS} $(DVIPS_FLAGS) -o $(1)-draft.ps $(1).dvi
endef
$(foreach __tmp__,$(NAME),$(eval $(call viewps_template,$(__tmp__))))
#######################################
# target: viewpdf_<proj>
#######################################
define viewpdf_template
.PHONY: viewpdf_$(1)
viewpdf_$(1): $(1).pdf
$(VIEWPDF) $(VIEWPDF_FLAGS) $(1).pdf
DEFAULTVIEWPDF?= viewpdf_$(1)
ALLVIEWPDF+= viewpdf_$(1)
.PHONY: viewpdf_$(1)-draft
viewpdf_$(1)-draft: $(1)-draft.pdf
$(VIEWPDF) $(VIEWPDF_FLAGS) $(1)-draft.pdf
DEFAULTVIEWPDF_DRAFT?= viewpdf_$(1)-draft
ALLVIEWPDF_DRAFT+= viewpdf_$(1)-draft
endef
$(foreach __tmp__,$(NAME),$(eval $(call viewpdf_template,$(__tmp__))))
#######################################
# target: print_<proj>
#######################################
define print_template
.PHONY: print_$(1)
print_$(1): $(1).ps
$(LPR) $(LPR_FLAGS) $(1).ps
DEFAULTPRINT?= print_$(1)
ALLPRINT+= print_$(1)
.PHONY: print_$(1)-draft
print_$(1)-draft: $(1)-draft.ps
$(LPR) $(LPR_FLAGS) $(1)-draft.ps
DEFAULTPRINT_DRAFT?= print_$(1)-draft
ALLPRINT_DRAFT+= print_$(1)-draft
endef
$(foreach __tmp__,$(NAME),$(eval $(call print_template,$(__tmp__))))
#######################################
ALLTEXSRCS= ${TEXSRCS}
ALLBIBTEXSRCS= ${BIBTEXSRCS}
#######################################
#
# master name for the distfile
#
#######################################
define distname_template
ifdef ALLNAME
ALLNAME:= ${ALLNAME}_$(1)
else
ALLNAME= $(1)
endif
endef
$(foreach __tmp__,$(NAME),$(eval $(call distname_template,$(__tmp__))))
ifneq (${ALLNAME}, ${NAME})
dist: ${ALLNAME}.tar.gz
${ALLNAME}.tar.gz: ${NAME:=.tar.gz}
${RM} -fr ${ALLNAME}
mkdir ${ALLNAME}
for f in ${NAME:=.tar.gz} ; do \
${GZCAT} $$f | (cd ${ALLNAME} && ${TAR} xpf -) ; \
done
${TAR} cf - ${ALLNAME} | ${GZIP} > $@
${RM} -fr ${ALLNAME}
@${ECHO} "******* Distfile left in ${ALLNAME}.tar.gz *******"
endif
#######################################
#
# add the dependencies for each documents .dvi file
#
#######################################
define dvideps_template
$(1).dvi: $(1).tex ${TEXSRCS} ${$(1)_TEXSRCS} ${OTHER} ${$(1)_OTHER}
ifneq ($(strip $(BIBTEXSRCS)$($(1)_BIBTEXSRCS)),)
$(1).dvi: $(1).bib-stamp
$(1).html-stamp: $(1).bib-stamp
endif
ifdef USE_PDFLATEX
$(1).pdf: $(1).tex ${TEXSRCS} ${$(1)_TEXSRCS} ${OTHER} ${$(1)_OTHER}
ifneq ($(strip $(BIBTEXSRCS)$($(1)_BIBTEXSRCS)),)
$(1).pdf: $(1).bib-stamp
endif
endif
$(1).html-stamp: $(1).tex ${TEXSRCS} ${$(1)_TEXSRCS} ${OTHER} ${$(1)_OTHER}
$(1).bib-stamp: ${BIBTEXSRCS} ${$(1)_BIBTEXSRCS}
ifdef USE_PDFLATEX
$(ENV_PROG) $(REAL_PDFLATEX_ENV) $(LATEX_MK) $(LATEX_MK_FLAGS) --pdflatex --bibtex $(1).tex
else
$(ENV_PROG) $(REAL_LATEX_ENV) $(LATEX_MK) $(LATEX_MK_FLAGS) --bibtex $(1).tex
endif
touch $(1).bib-stamp
ALLTEXSRCS+= $(1).tex ${$(1)_TEXSRCS}
ALLBIBTEXSRCS+= ${$(1)_BIBTEXSRCS}
dist: $(1).tar.gz
dvi: $(1).dvi
html: $(1).html-stamp
# latex2html needs latex to run first because it makes use of the
# .aux file. It seems that tex2page and hevea do not require this.
ifdef USE_LATEX2HTML
$(1).html-stamp: $(1).dvi
endif
.PHONY: $(1).html
$(1).html: $(1).html-stamp
ps: $(1).ps
pdf: $(1).pdf
ps-draft: $(1)-draft.ps
pdf-draft: $(1)-draft.pdf
$(1).rtf: $(1).dvi
rtf: $(1).rtf
clean::
if [ -f $(1).www_files ]; then \
for f in `${AWK} '{print $$2}' $(1).www_files` ; do \
if [ -f $$$$f ]; then ${RM} -f $$$$f ; fi ;\
done ;\
fi
${RM} -f $(1).www_files
ifdef USE_LATEX2HTML
${RM} -f $(1).html_dir/images.aux
${RM} -f $(1).html_dir/images.bbl
${RM} -f $(1).html_dir/images.log
${RM} -f $(1).html_dir/images.out
${RM} -f $(1).html_dir/images.tex
endif
if [ -d $(1).html_dir ] ; then ${RMDIR} $(1).html_dir ; fi
# And add dependencies for a source tarball
$(1)_DIST+= $(1).tex ${TEXSRCS} ${$(1)_TEXSRCS} ${BIBTEXSRCS} ${$(1)_BIBTEXSRCS} ${OTHER} ${$(1)_OTHER} ${MAKEFILE} ${$(1)_EXTRA_DIST} ${EXTRA_DIST}
endef
$(foreach __tmp__,$(NAME),$(eval $(call dvideps_template,$(__tmp__))))
define dist_template
ALL_DIST+= $($(1)_DIST)
$(1).tar.gz: $($(1)_DIST)
${TAR} cf - ${$(1)_DIST} | ${GZIP} > $(1).tar.gz
@${ECHO} "******* Distfile left in $(1).tar.gz *******"
endef
$(foreach __tmp__,$(NAME),$(eval $(call dist_template,$(__tmp__))))
#######################################
# target: view, view-all
#######################################
.PHONY: view
view: ${DEFAULTVIEW}
.PHONY: view-all
view-all: ${ALLVIEW}
#######################################
# target: viewps, viewps-all
#######################################
.PHONY: viewps
viewps: ${DEFAULTVIEWPS}
.PHONY: viewps-all
viewps-all: ${ALLVIEWPS}
#######################################
# target: viewpdf, viewpdf-all
#######################################
.PHONY: viewpdf
viewpdf: ${DEFAULTVIEWPDF}
.PHONY: viewpdf-all
viewpdf-all: ${ALLVIEWPDF}
#######################################
# target: viewps-draft, viewps-all-draft
#######################################
.PHONY: viewps-draft
viewps-draft: ${DEFAULTVIEWPS_DRAFT}
.PHONY: viewps-all-draft
viewps-all-draft: ${ALLVIEWPS_DRAFT}
#######################################
# target: viewpdf-draft, viewpdf-all-draft
#######################################
.PHONY: viewpdf-draft
viewpdf-draft: ${DEFAULTVIEWPDF_DRAFT}
.PHONY: viewpdf-all-draft
viewpdf-all-draft: ${ALLVIEWPDF_DRAFT}
#######################################
# target: print, print-all
#######################################
.PHONY: print
print: ${DEFAULTPRINT}
.PHONY: print-all
print-all: ${ALLPRINT}
#######################################
# target: print-draft, print-all-draft
#######################################
.PHONY: print-draft
print-draft: ${DEFAULTPRINT_DRAFT}
.PHONY: print-all-draft
print-all-draft: ${ALLPRINT_DRAFT}
#######################################
#
#######################################
.SUFFIXES : .tex .dvi .ps .pdf .rtf .html-stamp .png .jpg .eps
ifdef IGNORE_LATEX_ERRORS
LATEX_MK_FLAGS+= --ignore-errors
endif
#######################################
#
# Graphic file conversions
#
#######################################
.jpg.eps :
$(JPG2EPS) $< $@
.png.eps :
$(PNG2EPS) $< $@
#######################################
#
# Distribution output (tarfile)
#
#######################################
.PHONY: dist
#######################################
#
# DVI Output (latex)
#
#######################################
.PHONY: dvi
.tex.dvi :
$(ENV_PROG) $(REAL_LATEX_ENV) $(LATEX_MK) $(LATEX_MK_FLAGS) $<
#######################################
#
# HTML Output (latex2html or HeVeA)
#
#######################################
# note: we have to use a time stamp file here to keep track of what files
# get created by the html conversion. Neither latex2html nor hevea provide
# a convenient way to get a list of files to clean. In addition, hevea
# does not currently provide a DESTDIR type functionality which is needed
# for dealing with multiple top level documents.
.PHONY: html
.tex.html-stamp :
touch $@1
ifdef USE_LATEX2HTML
@${ECHO} LaTeX-Mk: Creating HTML output using latex2html
$(ENV_PROG) $(LATEX2HTML_ENV) $(LATEX2HTML) $(LATEX2HTML_FLAGS) -mkdir -dir $*.html_dir $<
else
ifdef USE_TEX2PAGE
@${ECHO} LaTeX-Mk: Creating HTML output using tex2page
${ECHO} "$*.html_dir" > $*.hdir
$(ENV_PROG) $(REAL_TEX2PAGE_ENV) $(LATEX_MK) --tex2page $(LATEX_MK_FLAGS) $<
else
ifdef USE_HEVEA
@${ECHO} LaTeX-Mk: Creating HTML output using HeVeA
mkdir -p $*.html_dir
-$(ENV_PROG) $(HEVEA_ENV) $(HEVEA) $(HEVEA_FLAGS) $<
-$(ENV_PROG) $(HEVEA_ENV) ${IMAGEN} `basename $< .tex`
-$(ENV_PROG) $(HEVEA_ENV) $(HEVEA) $(HEVEA_FLAGS) $<
endif
endif
endif
if [ ! -f $*.www_files ]; then touch $*.www_files ; fi
for f in `${FIND} . -type f \( -name \*.html -o -name \*.htm -o -name \*.gif \
-o -name \*.png -o -name \*.css -o -name \*.pl -o -name WARNINGS \
-o -name \*.scm -o -name \*.hlog \) \
-newer $@1 -print` ; do \
fn=`basename $$f` ; \
if ${GREP} "^$$f " $*.www_files >/dev/null ; then \
echo "$$f already recorded" ; \
else \
echo "recording file $$f ($*.html_dir/$$fn)" ; \
echo "$$f $*.html_dir/$$fn" >> $*.www_files ; \
fi ;\
done
ifdef USE_TEX2PAGE
for f in `${FIND} . -type f \( -name \*-Z-G-\*.tex -o -name \*-Z-G-\*.aux \
-o -name \*-Z-G-\*.log -o -name \*-Z-G-\*.dvi -o -name \*-Z-G-\*.ps \
-o -name .Z\*.tex \) -newer $@1 -print` ; do \
fn=`basename $$f` ; \
if ${GREP} "^$$f " $*.www_files >/dev/null ; then \
echo "$$f already recorded" ; \
elif test "`dirname $$f`" != "." ; then \
echo "$$f is not in this directory, skipping" ; \
else \
echo "recording file $$f (./$$fn)" ; \
echo "$$f ./$$fn" >> $*.www_files ; \
fi ;\
done
endif
ifdef USE_HEVEA
for f in `${AWK} '{print $$1}' $*.www_files` ; do \
${ECHO} "Moving $$f to $*.html_dir" ; mv $$f $*.html_dir ; \
done
endif
mv $@1 $@
#######################################
#
# Postscript Output (dvips)
#
#######################################
.PHONY: ps
# if we're doing a *-draft target, then add the
# DRAFT watermark and time stamp
ifeq ($(findstring -draft,${MAKECMDGOALS}),-draft)
__DRAFT= yes
endif
.dvi.ps :
ifdef __DRAFT
sed "s;DATE;`date`;g" ${DATED_DRAFT_PS} > ${DRAFT_STAMP_PS}
${ENV_PROG} ${DVIPS_ENV} $(DVIPS) -h ${DRAFT_STAMP_PS} ${$*_DVIPS_FLAGS} $(DVIPS_FLAGS) -o $*-draft.ps $<
else
${ENV_PROG} ${DVIPS_ENV} $(DVIPS) ${$*_DVIPS_FLAGS} $(DVIPS_FLAGS) -o $@ $<
endif
#######################################
#
# PDF Output (ps2pdf)
#
#######################################
.PHONY: pdf
ifdef USE_DVIPDFM
.dvi.pdf :
$(ENV_PROG) $(DVIPDFM_ENV) $(DVIPDFM) ${$*_DVIPDFM_FLAGS} $(DVIPDFM_FLAGS) $<
else
ifdef USE_PDFLATEX
.tex.pdf :
$(ENV_PROG) $(REAL_PDFLATEX_ENV) $(LATEX_MK) --pdflatex $(LATEX_MK_FLAGS) $<
else
.ps.pdf :
$(PS2PDF) $(PS2PDF_FLAGS) $<
endif
endif
#######################################
#
# RTF (Rich Text Format) output (latex2rtf)
#
#######################################
.PHONY: rtf
.dvi.rtf :
$(ENV_PROG) $(LATEX2RTF_ENV) $(LATEX2RTF) $(LATEX2RTF_FLAGS) -o $@ $*.tex
#######################################
#
# Clean up (clean)
#
#######################################
CLEAN_FILES+= ${ALLTEXSRCS:.tex=.aux}
CLEAN_FILES+= ${BIBTEXSRCS:.bib=.aux}
CLEAN_FILES+= ${NAME:=.ps}
CLEAN_FILES+= ${NAME:=-draft.ps}
CLEAN_FILES+= ${NAME:=.pdf}
CLEAN_FILES+= ${NAME:=-draft.pdf}
CLEAN_FILES+= ${NAME:=.rtf}
CLEAN_FILES+= ${NAME:=.aux}
CLEAN_FILES+= ${NAME:=.log}
CLEAN_FILES+= ${NAME:=.dvi}
CLEAN_FILES+= ${NAME:=.log}
CLEAN_FILES+= ${NAME:=.bbl}
CLEAN_FILES+= ${NAME:=.blg}
CLEAN_FILES+= ${NAME:=.glo}
CLEAN_FILES+= ${NAME:=.gls}
CLEAN_FILES+= ${NAME:=.ilg}
CLEAN_FILES+= ${NAME:=.idx}
CLEAN_FILES+= ${NAME:=.ind}
CLEAN_FILES+= ${NAME:=.lof}
CLEAN_FILES+= ${NAME:=.lot}
CLEAN_FILES+= ${NAME:=.toc}
CLEAN_FILES+= ${NAME:=.out}
CLEAN_FILES+= $(DRAFT_STAMP_PS)
CLEAN_FILES+= ${NAME:=.bib-stamp}
# HTML generation
CLEAN_FILES+= ${NAME:=.html-stamp}
CLEAN_FILES+= ${NAME:=.www_files}
ifdef USE_HEVEA
CLEAN_FILES+= ${NAME:=.haux}
CLEAN_FILES+= ${NAME:=.image.tex}
endif
ifdef USE_LATEX2HTML
CLEAN_FILES+= ${NAME:=.haux}
CLEAN_FILES+= ${NAME:=.image.tex}
endif
ifdef USE_TEX2PAGE
CLEAN_FILES+= ${NAME:=.hdir}
endif
.PHONY: clean
define latex_mk_clean_template
clean::
${LATEX_MK} --clean $(1)
endef
$(foreach __tmp__,$(NAME),$(eval $(call latex_mk_clean_template,$(__tmp__))))
clean::
$(RM) -f *~ texput.log $(CLEAN_FILES)
.PHONY: distclean
distclean: clean
#######################################
#
# Some helpful debugging targets
#
#######################################
.PHONY: show-var
show-var:
@${ECHO} ${${VARNAME}}
|