| 1 |
## Frankenfile -- common part of a Makefile for LaTeX and BibTeX bundles |
| 2 |
# |
| 3 |
# Author: Matt Swift <[email protected]> |
| 4 |
# |
| 5 |
# This file is given into the public domain. |
| 6 |
# Please acknowledge my work when appropriate. |
| 7 |
# Such reflected glory is all I get from releasing this work to you. |
| 8 |
# |
| 9 |
# Version: $Revision: 1.10 $ $Date: 2001/08/31 01:27:17 $ |
| 10 |
# See the file ChangeLog-Frankenbundle for revision history. |
| 11 |
# |
| 12 |
# This file is distributed in two ways: |
| 13 |
# |
| 14 |
# 1) With LaTeX filesets. In normal circumstances, you do not need |
| 15 |
# to read this file or alter it See the README or INSTALL file that |
| 16 |
# came with this file instead. |
| 17 |
# |
| 18 |
# 2) As part of the Frankenbundle suite, which helps developers make and |
| 19 |
# distribute LaTeX and BibTeX filesets. In normal circumstances, you |
| 20 |
# should not need to alter this file. Please see the README file |
| 21 |
# in the suite for further documentation. |
| 22 |
|
| 23 |
# |
| 24 |
## Basic variable definitions |
| 25 |
# |
| 26 |
|
| 27 |
# NOTE: to override these definitions, use environment variables or the Make |
| 28 |
# command line. The values here should be the most common ones in general, so |
| 29 |
# that the least number of users have to override them. If you think I could |
| 30 |
# choose better values, please write me. |
| 31 |
|
| 32 |
# NOTE: I use the $(...) construct for command substitution, supported by |
| 33 |
# POSIX, ksh, bash. I can rewrite with nested backquotes if someone insists. |
| 34 |
|
| 35 |
# NOTE: ?= is broken in Make 3.77, so we use the more verbose ifndef |
| 36 |
# construction. |
| 37 |
|
| 38 |
# NOTE: We don't bother to abstract the 'kpsewhich', 'echo', 'cd', 'pwd', |
| 39 |
# 'test', or '[' commands. Any reason to? |
| 40 |
|
| 41 |
# Eliminating built-in implicit rules speeds up Make and makes debugging output |
| 42 |
# much briefer. Recusive Making turns on -w which traces what directory we're |
| 43 |
# in, but we're always in this directory, so we turn off those messages. |
| 44 |
MAKEFLAGS += --no-builtin-rules --no-print-directory |
| 45 |
|
| 46 |
# We don't need all the old-fashioned suffix rules -- removing them makes |
| 47 |
# things more efficient. |
| 48 |
.SUFFIXES: |
| 49 |
|
| 50 |
# Make debugging option. Uncomment to use. |
| 51 |
# MAKEFLAGS += --warn-undefined-variables |
| 52 |
|
| 53 |
# Hmm, this doesn't seem to work when defined in this way. Seems to work only |
| 54 |
# on the command line. |
| 55 |
# MAKEFLAGS += --print-database |
| 56 |
|
| 57 |
# ifeq ($(OS),WIN32) |
| 58 |
# variant defs |
| 59 |
# endif |
| 60 |
|
| 61 |
# RM is defined by Make as 'rm -f'. You could redefine it. |
| 62 |
# ls is often aliased, so use /bin/ls |
| 63 |
ifndef LS |
| 64 |
LS = /bin/ls |
| 65 |
endif |
| 66 |
ifndef TAR |
| 67 |
TAR = tar |
| 68 |
endif |
| 69 |
ifndef LN |
| 70 |
LN = ln |
| 71 |
endif |
| 72 |
ifndef M4 |
| 73 |
M4 = m4 |
| 74 |
endif |
| 75 |
ifndef SYMLINK |
| 76 |
SYMLINK = $(LN) -f -s |
| 77 |
endif |
| 78 |
ifndef SED |
| 79 |
SED = sed |
| 80 |
endif |
| 81 |
ifndef AWK |
| 82 |
AWK = awk |
| 83 |
endif |
| 84 |
ifndef FGREP |
| 85 |
FGREP = fgrep |
| 86 |
endif |
| 87 |
ifndef TEE |
| 88 |
TEE = tee |
| 89 |
endif |
| 90 |
ifndef XARGS |
| 91 |
XARGS = xargs |
| 92 |
endif |
| 93 |
ifndef EXPR |
| 94 |
EXPR = expr |
| 95 |
endif |
| 96 |
ifndef HEAD |
| 97 |
HEAD = head |
| 98 |
endif |
| 99 |
ifndef TR |
| 100 |
TR = tr |
| 101 |
endif |
| 102 |
ifndef GREP |
| 103 |
GREP = grep |
| 104 |
endif |
| 105 |
ifndef CAT |
| 106 |
CAT = cat |
| 107 |
endif |
| 108 |
ifndef TOUCH |
| 109 |
TOUCH = touch |
| 110 |
endif |
| 111 |
ifndef REHASH |
| 112 |
REHASH = texconfig rehash |
| 113 |
endif |
| 114 |
ifndef DIRNAME |
| 115 |
DIRNAME = dirname |
| 116 |
endif |
| 117 |
ifndef BASENAME |
| 118 |
BASENAME = basename |
| 119 |
endif |
| 120 |
ifndef INSTALL |
| 121 |
INSTALL = install |
| 122 |
endif |
| 123 |
# -p = preserve timestamps |
| 124 |
ifndef INSTALLOPTS |
| 125 |
INSTALLOPTS = -p -m $(MKFILEMODE) |
| 126 |
endif |
| 127 |
ifndef CHMOD |
| 128 |
CHMOD = chmod |
| 129 |
endif |
| 130 |
ifndef MKFILEMODE |
| 131 |
# mode rw-rw-r--, i.e. 664 |
| 132 |
MKFILEMODE = 664 |
| 133 |
endif |
| 134 |
ifndef MKDIRP |
| 135 |
MKDIRP = $(INSTALL) -d -m $(MKDIRMODE) |
| 136 |
endif |
| 137 |
ifndef MKDIRMODE |
| 138 |
MKDIRMODE = 755 |
| 139 |
endif |
| 140 |
ifndef LATEX |
| 141 |
LATEX = latex |
| 142 |
endif |
| 143 |
ifndef TEX |
| 144 |
TEX = tex |
| 145 |
endif |
| 146 |
ifndef BIBTEX |
| 147 |
BIBTEX = bibtex |
| 148 |
endif |
| 149 |
ifndef BIBTOOL |
| 150 |
BIBTOOL = bibtool |
| 151 |
endif |
| 152 |
ifndef MAKEINDEX |
| 153 |
MAKEINDEX = makeindex $(MAKEINDEXOPTS) |
| 154 |
endif |
| 155 |
ifndef MAKEINDEXOPTS |
| 156 |
MAKEINDEXOPTS = -s gind.ist |
| 157 |
endif |
| 158 |
# Subdirectory of the main directory in which to build the distribution: |
| 159 |
# don't call it "distrib" or the name of any other target! |
| 160 |
ifndef distribution-dir |
| 161 |
distribution-dir = distribution |
| 162 |
endif |
| 163 |
|
| 164 |
# |
| 165 |
## internal variables naming files |
| 166 |
# |
| 167 |
|
| 168 |
# FIX: I suppose we could make this faster for the end user by figuring out |
| 169 |
# which of these many definitions are only used by the developer. |
| 170 |
|
| 171 |
dist-extra-files = $(stable-extra-files) |
| 172 |
ifeq ($(USER),$(DEVELOPER)) |
| 173 |
dist-extra-files += $(beta-extra-files) |
| 174 |
else |
| 175 |
ifdef USE_UNSUP |
| 176 |
dist-extra-files += $(beta-extra-files) |
| 177 |
endif |
| 178 |
endif |
| 179 |
|
| 180 |
# may not exist |
| 181 |
bundle-bib.bib = $(bundle-bib).bib |
| 182 |
|
| 183 |
packages.sty = $(addsuffix .sty, $(packages)) |
| 184 |
packages.stq = $(addsuffix .stq, $(packages)) |
| 185 |
packages.ins = $(addsuffix .ins, $(packages)) |
| 186 |
packages.dvi = $(addsuffix .dvi, $(packages)) |
| 187 |
packages.tex = $(addsuffix .tex, $(packages)) |
| 188 |
stos.sto = $(addsuffix .sto, $(stos)) |
| 189 |
stos.sqo = $(addsuffix .sqo, $(stos)) |
| 190 |
|
| 191 |
classes.cls = $(addsuffix .cls, $(classes)) |
| 192 |
classes.clq = $(addsuffix .clq, $(classes)) |
| 193 |
classes.ins = $(addsuffix .ins, $(classes)) |
| 194 |
classes.dvi = $(addsuffix .dvi, $(classes)) |
| 195 |
classes.tex = $(addsuffix .tex, $(classes)) |
| 196 |
clos.clo = $(addsuffix .clo, $(clos)) |
| 197 |
clos.cqo = $(addsuffix .cqo, $(clos)) |
| 198 |
|
| 199 |
bibstyles-bst = $(addsuffix -bst, $(bibstyles)) |
| 200 |
bibstyles.bst = $(addsuffix .bst, $(bibstyles)) |
| 201 |
bibstyles.bsq = $(addsuffix .bsq, $(bibstyles)) |
| 202 |
bibstyles.ins = $(addsuffix .ins, $(bibstyles-bst)) |
| 203 |
bibstyles.dvi = $(addsuffix .dvi, $(bibstyles-bst)) |
| 204 |
bibstyles.tex = $(addsuffix .tex, $(bibstyles-bst)) |
| 205 |
bibstyles.ver = $(addsuffix .ver, $(bibstyles-bst)) |
| 206 |
|
| 207 |
# everything depends on the makefiles |
| 208 |
# the "Frankenfile" in the next line is intended to refer to this file |
| 209 |
makefiles = Frankenfile $(calling-makefile) |
| 210 |
stable-extra-files += $(makefiles) $(bundle-bib.bib) |
| 211 |
|
| 212 |
stable-packages.sty = $(addsuffix .sty, $(stable-packages)) |
| 213 |
stable-packages.ins = $(addsuffix .ins, $(stable-packages)) |
| 214 |
stable-packages.dvi = $(addsuffix .dvi, $(stable-packages)) |
| 215 |
stable-packages.tex = $(addsuffix .tex, $(stable-packages)) |
| 216 |
|
| 217 |
stable-classes.cls = $(addsuffix .cls, $(stable-classes)) |
| 218 |
stable-classes.ins = $(addsuffix .ins, $(stable-classes)) |
| 219 |
stable-classes.dvi = $(addsuffix .dvi, $(stable-classes)) |
| 220 |
stable-classes.tex = $(addsuffix .tex, $(stable-classes)) |
| 221 |
|
| 222 |
stable-bibstyles-bst = $(addsuffix -bst, $(stable-bibstyles)) |
| 223 |
stable-bibstyles.bst = $(addsuffix .bst, $(stable-bibstyles)) |
| 224 |
stable-bibstyles.ins = $(addsuffix .ins, $(stable-bibstyles-bst)) |
| 225 |
stable-bibstyles.dvi = $(addsuffix .dvi, $(stable-bibstyles-bst)) |
| 226 |
stable-bibstyles.tex = $(addsuffix .tex, $(dist-bibstyles-bst)) |
| 227 |
stable-bibstyles.ver = $(addsuffix .ver, $(dist-bibstyles-bst)) |
| 228 |
|
| 229 |
stable-configs.cfg = $(addsuffix .cfg, $(stable-configs)) |
| 230 |
|
| 231 |
stable-filesets.ins = $(addsuffix .ins, $(stable-filesets)) |
| 232 |
stable-filesets.tex = $(addsuffix .tex, $(stable-filesets)) |
| 233 |
stable-filesets.dvi = $(addsuffix .dvi, $(stable-filesets)) |
| 234 |
|
| 235 |
beta-packages.sty = $(addsuffix .sty, $(beta-packages)) |
| 236 |
beta-packages.dvi = $(addsuffix .dvi, $(beta-packages)) |
| 237 |
|
| 238 |
beta-classes.cls = $(addsuffix .cls, $(beta-classes)) |
| 239 |
beta-classes.dvi = $(addsuffix .dvi, $(beta-classes)) |
| 240 |
|
| 241 |
beta-bibstyles-bst = $(addsuffix -bst, $(beta-bibstyles)) |
| 242 |
beta-bibstyles.bst = $(addsuffix .bst, $(beta-bibstyles)) |
| 243 |
beta-bibstyles.dvi = $(addsuffix .dvi, $(beta-bibstyles-bst)) |
| 244 |
beta-bibstyles.ver = $(addsuffix .ver, $(beta-bibstyles-bst)) |
| 245 |
|
| 246 |
beta-configs.cfg = $(addsuffix .cfg, $(beta-configs)) |
| 247 |
|
| 248 |
beta-filesets.ins = $(addsuffix .ins, $(beta-filesets)) |
| 249 |
beta-filesets.tex = $(addsuffix .tex, $(beta-filesets)) |
| 250 |
beta-filesets.dvi = $(addsuffix .dvi, $(beta-filesets)) |
| 251 |
|
| 252 |
filesets.tex = $(addsuffix .tex, $(filesets)) |
| 253 |
filesets.dvi = $(addsuffix .dvi, $(filesets)) |
| 254 |
filesets.ins = $(addsuffix .ins, $(filesets)) |
| 255 |
filesets.aux = $(addsuffix .aux, $(filesets)) |
| 256 |
filesets.t1 = $(addsuffix .t1, $(filesets)) |
| 257 |
filesets.t2 = $(addsuffix .t2, $(filesets)) |
| 258 |
filesets.t3 = $(addsuffix .t3, $(filesets)) |
| 259 |
|
| 260 |
dist-filesets.aux = $(addsuffix .aux, $(dist-filesets)) |
| 261 |
# cits for "have citations" |
| 262 |
dist-filesets-cits.aux = $(addsuffix .aux, $(dist-filesets-cits)) |
| 263 |
|
| 264 |
stable-stos.sto = $(addsuffix .sto, $(stable-stos)) |
| 265 |
beta-stos.sto = $(addsuffix .sto, $(beta-stos)) |
| 266 |
|
| 267 |
# We treat "X.cfg" as if it was a root name. |
| 268 |
configs.cfg = $(addsuffix .cfg, $(configs)) |
| 269 |
configs.cfg.install = $(addsuffix .cfg.install, $(configs)) |
| 270 |
configs.cfq = $(addsuffix .cfq, $(configs)) |
| 271 |
configs.cfq.install = $(addsuffix .cfq.install, $(configs)) |
| 272 |
|
| 273 |
# These files are part of the building process. |
| 274 |
part-1 = $(make-dir)/part-1.dtx |
| 275 |
part-2 = $(make-dir)/part-2.dtx |
| 276 |
part-3 = $(make-dir)/part-3.dtx |
| 277 |
parts = $(part-1) $(part-2) $(part-3) |
| 278 |
extractor = $(make-dir)/extractor.ins |
| 279 |
driver = $(make-dir)/driver.tex |
| 280 |
# |
| 281 |
## internal variables for phony targets |
| 282 |
# |
| 283 |
|
| 284 |
dist-bibstyles-bst = $(addsuffix -bst, $(stable-bibstyles)) |
| 285 |
dist-packages = $(stable-packages) |
| 286 |
dist-classes = $(stable-classes) |
| 287 |
dist-bibstyles = $(stable-bibstyles) |
| 288 |
dist-filesets = $(dist-packages) $(dist-classes) $(dist-bibstyles-bst) |
| 289 |
filesets = $(packages) $(classes) $(bibstyles-bst) |
| 290 |
ifeq ($(USER),$(DEVELOPER)) |
| 291 |
dist-bibstyles-bst += $(addsuffix -bst, $(beta-bibstyles)) |
| 292 |
dist-packages += $(beta-packages) |
| 293 |
dist-classes += $(beta-classes) |
| 294 |
dist-bibstyles += $(beta-bibstyles) |
| 295 |
# cits for "have citations" |
| 296 |
dist-filesets-cits = $(basename $(shell $(GREP) -l '\initelyHavECitationS' \ |
| 297 |
$(addsuffix .dtx, $(dist-filesets)))) |
| 298 |
else |
| 299 |
ifdef USE_UNSUP |
| 300 |
dist-bibstyles-bst += $(addsuffix -bst, $(beta-bibstyles)) |
| 301 |
dist-packages += $(beta-packages) |
| 302 |
dist-classes += $(beta-classes) |
| 303 |
dist-bibstyles += $(beta-bibstyles) |
| 304 |
endif |
| 305 |
endif |
| 306 |
|
| 307 |
|
| 308 |
# nondc = "non-dist-cits" |
| 309 |
nondc-filesets = $(filter-out $(dist-filesets-cits), $(filesets)) |
| 310 |
|
| 311 |
packages = $(dist-packages) $(alpha-packages) |
| 312 |
packages.clean = $(addsuffix .clean, $(packages)) |
| 313 |
packages.dev.clean = $(addsuffix .dev.clean, $(packages)) |
| 314 |
packages.macros = $(addsuffix .macros, $(packages)) |
| 315 |
packages.macros.q = $(addsuffix .macros.q, $(packages)) |
| 316 |
packages.install = $(addsuffix .install, $(packages)) |
| 317 |
packages.install.q = $(addsuffix .install.q, $(packages)) |
| 318 |
packages.doc.install= $(addsuffix .doc.install, $(packages)) |
| 319 |
packages.sty.install= $(addsuffix .sty.install, $(packages)) |
| 320 |
packages.stq.install= $(addsuffix .stq.install, $(packages)) |
| 321 |
packages.sto.install= $(addsuffix .sto.install, $(packages)) |
| 322 |
packages.sqo.install= $(addsuffix .sqo.install, $(packages)) |
| 323 |
packages.src.install= $(addsuffix .src.install, $(packages)) |
| 324 |
stable-stos = $(foreach f, $(stable-filesets), $($(f)-stos)) |
| 325 |
beta-stos = $(foreach f, $(beta-filesets), $($(f)-stos)) |
| 326 |
alpha-stos = $(foreach f, $(alpha-filesets), $($(f)-stos)) |
| 327 |
stos = $(stable-stos) $(beta-stos) $(alpha-stos) |
| 328 |
classes = $(dist-classes) $(alpha-classes) |
| 329 |
classes.clean = $(addsuffix .clean, $(classes)) |
| 330 |
classes.dev.clean = $(addsuffix .dev.clean, $(classes)) |
| 331 |
classes.macros = $(addsuffix .macros, $(classes)) |
| 332 |
classes.macros.q = $(addsuffix .macros.q, $(classes)) |
| 333 |
classes.install = $(addsuffix .install, $(classes)) |
| 334 |
classes.install.q = $(addsuffix .install.q, $(classes)) |
| 335 |
classes.doc.install = $(addsuffix .doc.install, $(classes)) |
| 336 |
classes.cls.install = $(addsuffix .cls.install, $(classes)) |
| 337 |
classes.clq.install = $(addsuffix .clq.install, $(classes)) |
| 338 |
classes.clo.install = $(addsuffix .clo.install, $(classes)) |
| 339 |
classes.cqo.install = $(addsuffix .cqo.install, $(classes)) |
| 340 |
classes.src.install = $(addsuffix .src.install, $(classes)) |
| 341 |
stable-clos = $(foreach f, $(stable-filesets), $($(f)-clos)) |
| 342 |
beta-clos = $(foreach f, $(beta-filesets), $($(f)-clos)) |
| 343 |
alpha-clos = $(foreach f, $(alpha-filesets), $($(f)-clos)) |
| 344 |
clos = $(stable-clos) $(beta-clos) $(alpha-clos) |
| 345 |
bibstyles = $(dist-bibstyles) $(alpha-bibstyles) |
| 346 |
bibstyles.clean = $(addsuffix .clean, $(bibstyles-bst)) |
| 347 |
bibstyles.dev.clean = $(addsuffix .dev.clean, $(bibstyles-bst)) |
| 348 |
bibstyles.macros = $(addsuffix .macros, $(bibstyles-bst)) |
| 349 |
bibstyles.macros.q = $(addsuffix .macros.q, $(bibstyles-bst)) |
| 350 |
bibstyles.install = $(addsuffix .install, $(bibstyles-bst)) |
| 351 |
bibstyles.bst.install= $(addsuffix .bst.install, $(bibstyles-bst)) |
| 352 |
bibstyles.bsq.install= $(addsuffix .bsq.install, $(bibstyles-bst)) |
| 353 |
bibstyles.install.q = $(addsuffix .install.q, $(bibstyles-bst)) |
| 354 |
bibstyles.doc.install = $(addsuffix .doc.install, $(bibstyles-bst)) |
| 355 |
bibstyles.src.install = $(addsuffix .src.install, $(bibstyles-bst)) |
| 356 |
configs = $(stable-configs) $(beta-configs) $(alpha-configs) |
| 357 |
|
| 358 |
# $(filesets-*) are NOT going to include $(bibstyles), but rather |
| 359 |
# $(bibstyles-bst). This is what we want. |
| 360 |
filesets.macros = $(addsuffix .macros, $(filesets)) |
| 361 |
filesets.macros.q = $(addsuffix .macros.q, $(filesets)) |
| 362 |
filesets.q = $(addsuffix .q, $(filesets)) |
| 363 |
filesets.dep = $(addsuffix .dep, $(filesets)) |
| 364 |
filesets.dep.q = $(addsuffix .dep.q, $(filesets)) |
| 365 |
filesets.dep.macros = $(addsuffix .dep.macros, $(filesets)) |
| 366 |
filesets.dep.macros.q= $(addsuffix .dep.macros.q, $(filesets)) |
| 367 |
filesets.dep.install = $(addsuffix .dep.install, $(filesets)) |
| 368 |
filesets.dep.install.q= $(addsuffix .dep.install.q, $(filesets)) |
| 369 |
filesets.cfg = $(addsuffix .cfg, $(filesets)) |
| 370 |
filesets.cfg.install = $(addsuffix .cfg.install, $(filesets)) |
| 371 |
filesets.cfq = $(addsuffix .cfq, $(filesets)) |
| 372 |
filesets.cfq.install = $(addsuffix .cfq.install, $(filesets)) |
| 373 |
filesets.install = $(addsuffix .install, $(filesets)) |
| 374 |
filesets.install.q = $(addsuffix .install.q, $(filesets)) |
| 375 |
filesets.doc = $(addsuffix .doc, $(filesets)) |
| 376 |
filesets.doc.install = $(addsuffix .doc.install, $(filesets)) |
| 377 |
filesets.src.install = $(addsuffix .src.install, $(filesets)) |
| 378 |
filesets.clean = $(addsuffix .clean, $(filesets)) |
| 379 |
filesets.dev.clean = $(addsuffix .dev.clean, $(filesets)) |
| 380 |
dist-filesets.clean = $(addsuffix .clean, $(dist-filesets)) |
| 381 |
dist-filesets.q = $(addsuffix .q, $(dist-filesets)) |
| 382 |
dist-filesets.macros = $(addsuffix .macros, $(dist-filesets)) |
| 383 |
dist-filesets.macros.q=$(addsuffix .macros.q, $(dist-filesets)) |
| 384 |
dist-filesets.install= $(addsuffix .install, $(dist-filesets)) |
| 385 |
dist-filesets.install.q = $(addsuffix .install.q, $(dist-filesets)) |
| 386 |
stable-filesets = $(stable-packages) $(stable-classes) \ |
| 387 |
$(stable-bibstyles-bst) |
| 388 |
beta-filesets = $(beta-packages) $(beta-classes) $(beta-bibstyles-bst) |
| 389 |
alpha-filesets = $(filter-out $(dist-filesets), $(filesets)) |
| 390 |
|
| 391 |
# |
| 392 |
## perc variables |
| 393 |
# |
| 394 |
|
| 395 |
# NOTE: This is some pretty backhanded Makefile programming. Doing things this |
| 396 |
# way avoids recursive invocations of Make. We still have to recurse to make |
| 397 |
# stos and clos because we cannot expand variable names with % in them in the |
| 398 |
# list of dependencies. This is unlikely to change in GNU Make. |
| 399 |
|
| 400 |
# "Perc" stands for "percent", that is, "%". The perc variables are used in |
| 401 |
# dependencies and expand to what they name with "%" for "perc"; or they expand |
| 402 |
# to nothing, a null dependency. The % if it's there will then get substituted |
| 403 |
# in the pattern rule. We handle NODEP and NODOC differently than the NOSRC |
| 404 |
# and NOMAC flags because they need to avoid building files as well as |
| 405 |
# installing them and. We could actually treat NOMAC the same way, because |
| 406 |
# right now NOMAC doesn't avoid building the macros, it just avoids installing |
| 407 |
# them. But the only circumstance where this would save time is when you just |
| 408 |
# want to install the sources and no macros and no dox. That seems like too |
| 409 |
# weird a case to bother to accommodate. |
| 410 |
|
| 411 |
# Notice we still have to use conditionals like "[ $(NODEP) ] ||" in rules |
| 412 |
# because NODEP might be set by a target-specific assignment, and therefore |
| 413 |
# these conditionals won't work. In those cases, we can't avoid building |
| 414 |
# dependencies, but those cases are exactly the ones where all the dependencies |
| 415 |
# are built anyway (e.g., "all:"). For NODOC, NOSRC, and NOMAC, we can use |
| 416 |
# ifeq constructions, which are determined when the Makefile is read in. |
| 417 |
ifeq ($(NODEP),) |
| 418 |
perc.dep = %.dep |
| 419 |
perc.dep.q = %.dep.q |
| 420 |
perc.dep.macros = %.dep.macros |
| 421 |
perc.dep.macros.q = %.dep.macros.q |
| 422 |
perc.dep.install = %.dep.install |
| 423 |
perc.dep.install.q = %.dep.install.q |
| 424 |
else |
| 425 |
perc.dep = |
| 426 |
perc.dep.q = |
| 427 |
perc.dep.macros = |
| 428 |
perc.dep.macros.q = |
| 429 |
perc.dep.install = |
| 430 |
perc.dep.install.q = |
| 431 |
endif |
| 432 |
ifeq ($(NODOC),) |
| 433 |
perc.doc = %.doc |
| 434 |
perc.doc.install = %.doc.install |
| 435 |
else |
| 436 |
perc.doc = |
| 437 |
perc.doc.install = |
| 438 |
endif |
| 439 |
|
| 440 |
# |
| 441 |
## definitions |
| 442 |
# |
| 443 |
|
| 444 |
# ROOT-NAME is the stem of the macro package, e.g., "foo" from |
| 445 |
# foo.{sty,cls,bst} |
| 446 |
|
| 447 |
ifeq ($(USER),$(DEVELOPER)) |
| 448 |
define transform-common |
| 449 |
-e 's/__ROOT-NAME__/$*/g' \ |
| 450 |
-e 's/__BUNDLE__/$(bundle-title)/g' \ |
| 451 |
-e 's/__BUNDLE-BIB__/$(bundle-bib)/g' |
| 452 |
endef |
| 453 |
define transform-cls |
| 454 |
$(SED) $(transform-common) \ |
| 455 |
-e 's/__POSTAMBLE__//g' \ |
| 456 |
-e 's/__NAME__/$*/g' \ |
| 457 |
-e 's/__SUFFIX__/cls/g' \ |
| 458 |
-e 's/__VERSION-INFO-SUFFIX__/cls/g' \ |
| 459 |
-e 's/__QSUFFIX__/clq/g' \ |
| 460 |
-e 's/__OSUFFIX__/clo/g' \ |
| 461 |
-e 's/__TYPE__/LaTeX class/g' \ |
| 462 |
-e 's/__PROG__/LaTeX/g' \ |
| 463 |
-e 's/__PROVIDES__/Class/g' |
| 464 |
endef |
| 465 |
define transform-sty |
| 466 |
$(SED) $(transform-common) \ |
| 467 |
-e 's/__POSTAMBLE__//g' \ |
| 468 |
-e 's/__NAME__/$*/g' \ |
| 469 |
-e 's/__SUFFIX__/sty/g' \ |
| 470 |
-e 's/__VERSION-INFO-SUFFIX__/sty/g' \ |
| 471 |
-e 's/__QSUFFIX__/stq/g' \ |
| 472 |
-e 's/__OSUFFIX__/sto/g' \ |
| 473 |
-e 's/__TYPE__/LaTeX package/g' \ |
| 474 |
-e 's/__PROG__/LaTeX/g' \ |
| 475 |
-e 's/__PROVIDES__/Package/g' |
| 476 |
endef |
| 477 |
define transform-bst |
| 478 |
$(SED) $(transform-common) \ |
| 479 |
-e 's/__POSTAMBLE__/\\nopostamble/g' \ |
| 480 |
-e 's/__NAME__/$*-bst/g' \ |
| 481 |
-e 's/__SUFFIX__/bst/g' \ |
| 482 |
-e 's/__VERSION-INFO-SUFFIX__/ver/g' \ |
| 483 |
-e 's/__QSUFFIX__/bsq/g' \ |
| 484 |
-e 's/__TYPE__/BibTeX style/g' \ |
| 485 |
-e 's/__PROG__/BibTeX/g' \ |
| 486 |
-e 's/__PROVIDES__/BibTeXstyle/g' |
| 487 |
endef |
| 488 |
endif # user ?= developer |
| 489 |
|
| 490 |
|
| 491 |
ifneq ($(HAVE_WEB2C),) |
| 492 |
|
| 493 |
# install-lsr = ./install-lsr --add |
| 494 |
# install-plain = ./install-lsr |
| 495 |
|
| 496 |
install-lsr = $(install-lsr-internal) --add |
| 497 |
install-plain = $(install-lsr-internal) |
| 498 |
|
| 499 |
# Usage: |
| 500 |
# |
| 501 |
# $progname [--add] <file> [<file>...] <dir> | <file> <file-full-pathname> |
| 502 |
# |
| 503 |
# This emulates install(1) with two differences. |
| 504 |
# If --add is given, also add the files to web2c ls-R database. |
| 505 |
# If the source file has execute permission, the destination will be given |
| 506 |
# u+x. |
| 507 |
|
| 508 |
define install-lsr-internal |
| 509 |
function mbuna () { \ |
| 510 |
if [ "$$1" = "--add" ]; then \ |
| 511 |
addlsr=true; \ |
| 512 |
shift; \ |
| 513 |
else \ |
| 514 |
unset addlsr; \ |
| 515 |
fi; \ |
| 516 |
if [ $$addlsr ]; then \ |
| 517 |
: $${MT_TEXMFMAIN=$$(kpsewhich --expand-path='$$TEXMFMAIN')}; \ |
| 518 |
: $${MT_MKTEX_OPT=$$(kpsewhich --format='web2c files' mktex.opt)};\ |
| 519 |
test -n "$$MT_MKTEX_OPT" || \ |
| 520 |
MT_MKTEX_OPT="$$MT_TEXMFMAIN/web2c/mktex.opt"; \ |
| 521 |
if [ ! -f "$$MT_MKTEX_OPT" ]; then \ |
| 522 |
echo "Cannot find mktex.opt; check your installation."; \ |
| 523 |
return 1; \ |
| 524 |
fi; \ |
| 525 |
mt_min_args=2; \ |
| 526 |
mt_max_args=1000; \ |
| 527 |
old=`pwd`; \ |
| 528 |
source "$$MT_MKTEX_OPT"; \ |
| 529 |
cd $$old; \ |
| 530 |
fi; \ |
| 531 |
lastarg=$$(eval echo '$$'{$$#}); \ |
| 532 |
echo $(INSTALL) $(INSTALLOPTS) "$$@"; \ |
| 533 |
if ! $(INSTALL) $(INSTALLOPTS) "$$@"; then \ |
| 534 |
echo "Install failed."; \ |
| 535 |
return 2; \ |
| 536 |
fi; \ |
| 537 |
if [ -d "$$lastarg" ]; then \ |
| 538 |
until [ "$$1" = "$$lastarg" ]; do \ |
| 539 |
if [ -x "$$1" ]; then \ |
| 540 |
echo -n adding user execute permission to $$lastarg/$$1...; \ |
| 541 |
$(CHMOD) u+x $$lastarg/$$1; \ |
| 542 |
echo . Done.; \ |
| 543 |
fi; \ |
| 544 |
if [ $$addlsr ]; then \ |
| 545 |
echo -n adding $$lastarg/$$1 to the ls-R database...; \ |
| 546 |
if ! "$$MT_MKTEXUPD" "$$lastarg" "$$1"; then \ |
| 547 |
echo "Problem updating the ls-R database."; \ |
| 548 |
return 3; \ |
| 549 |
fi; \ |
| 550 |
echo . Done.; \ |
| 551 |
fi; \ |
| 552 |
shift; \ |
| 553 |
done; \ |
| 554 |
else \ |
| 555 |
if [ $$# -ne 2 ]; then \ |
| 556 |
echo "Malformed arguments."; \ |
| 557 |
return 4; \ |
| 558 |
fi; \ |
| 559 |
if [ -x "$$1" ]; then \ |
| 560 |
echo -n adding user execute permission to $$2...; \ |
| 561 |
$(CHMOD) u+x $$2; \ |
| 562 |
echo . Done.; \ |
| 563 |
fi; \ |
| 564 |
if [ $$addlsr ]; then \ |
| 565 |
dir=`$(DIRNAME) $$lastarg`; \ |
| 566 |
file=`$(BASENAME) $$lastarg`; \ |
| 567 |
echo -n adding $$dir/$$file to the ls-R database...; \ |
| 568 |
if ! "$$MT_MKTEXUPD" $$dir $$file; then \ |
| 569 |
echo "Problem updating the ls-R database."; \ |
| 570 |
return 5; \ |
| 571 |
fi; \ |
| 572 |
echo . Done.; \ |
| 573 |
fi; \ |
| 574 |
fi; \ |
| 575 |
}; mbuna |
| 576 |
endef |
| 577 |
else |
| 578 |
|
| 579 |
# NOTE: this is going to fail if the dest is a directory that doesn't exist (it |
| 580 |
# will consider it a filename). So, install-plain and install-lsr must never |
| 581 |
# be called with a dest directory that doesn't exist. |
| 582 |
|
| 583 |
# We define these as functions and echo a message to the user, because in |
| 584 |
# the web2c case we have to use a big function that we definitely want to |
| 585 |
# suppress with @. |
| 586 |
|
| 587 |
define install-lsr |
| 588 |
function wicker () { \ |
| 589 |
echo $(INSTALL) $(INSTALL-OPTS) "$$@"; \ |
| 590 |
$(INSTALL) $(INSTALL-OPTS) "$$@"; \ |
| 591 |
}; wicker |
| 592 |
endef |
| 593 |
install-plain = $(install-lsr) |
| 594 |
endif |
| 595 |
|
| 596 |
# We check whether the file ACTUALLY has citations, and warn the developer if |
| 597 |
# he has failed to include an appropriate \def\initelyHavECitationS in the .dtx |
| 598 |
# file. |
| 599 |
# |
| 600 |
# There may be other or better ways to do the echoing and checking on the |
| 601 |
# bibtex process. You want bibtex's output to go out with all the usual Make |
| 602 |
# output, but you also want to pipe it to fgrep. Can use gawk and a rule of |
| 603 |
# {print; print > "/dev/stderr"}. I just don't think you can redirect stderr |
| 604 |
# to a pipe with sh like you can with csh. |
| 605 |
# |
| 606 |
# BibTeX doesn't put anything on stderr. |
| 607 |
# |
| 608 |
# args: <root-name> [<addindex-flag>] |
| 609 |
# |
| 610 |
# If <addindex-flag> is nonempty, then force inclusion of an index. |
| 611 |
# |
| 612 |
ifeq ($(USER),$(DEVELOPER)) |
| 613 |
define checkdtx |
| 614 |
if ! $(FGREP) -q '\def\initelyHavECitationS' $$root.dtx; then \ |
| 615 |
echo $(DEVELOPER), PUT \\def\\initelyHavECitationS \{\} IN $$root.dtx\!;\ |
| 616 |
$(RM) $$root.dvi; \ |
| 617 |
return 1; \ |
| 618 |
fi |
| 619 |
endef |
| 620 |
else |
| 621 |
define checkdtx |
| 622 |
: |
| 623 |
endef |
| 624 |
endif |
| 625 |
|
| 626 |
define latex-libll |
| 627 |
function bozo () { \ |
| 628 |
echo "Processing $$1 with LaTeX, BibTeX, & Makeindex as necessary.";\ |
| 629 |
root=$$($(EXPR) $$1 : '\([^\.]*\)\(\.[A-z]\+\)\?'); \ |
| 630 |
if [ $$2 ]; then \ |
| 631 |
echo "Forcing an index."; \ |
| 632 |
arg='\AtBeginDocument{\CodelineIndex\EnableCrossrefs} \ |
| 633 |
\AtEndDocument{\clearpage\PrintIndex}\input{'$$1'}'; \ |
| 634 |
else \ |
| 635 |
arg="$$1"; \ |
| 636 |
fi; \ |
| 637 |
$(TOUCH) $$root.aux $$root.ind; \ |
| 638 |
$(LATEX) $$arg; \ |
| 639 |
if $(FGREP) -q '\citation{' $$root.aux; then \ |
| 640 |
$(checkdtx); \ |
| 641 |
if $(BIBTEX) $$root | $(TEE) /dev/stderr | $(FGREP) -q \ |
| 642 |
'Warning--I didn'\''t find a database entry for'; then \ |
| 643 |
echo BIBTEX FAILED; \ |
| 644 |
$(RM) $$root.dvi; \ |
| 645 |
return 2; \ |
| 646 |
fi; \ |
| 647 |
$(LATEX) $$arg; \ |
| 648 |
fi; \ |
| 649 |
$(MAKEINDEX) $$root.idx; \ |
| 650 |
$(LATEX) $$arg; \ |
| 651 |
}; bozo |
| 652 |
endef |
| 653 |
|
| 654 |
define make-this-if-nonempty |
| 655 |
function bobo () { \ |
| 656 |
unset turtle; \ |
| 657 |
turtle="$$@"; \ |
| 658 |
if [ "$$turtle" ]; then \ |
| 659 |
echo "Starting recursive make on targets: $$turtle"; \ |
| 660 |
$(MAKE) $$turtle; \ |
| 661 |
else \ |
| 662 |
true; \ |
| 663 |
fi; \ |
| 664 |
}; bobo |
| 665 |
endef |
| 666 |
|
| 667 |
# args: <localfile> <remote-dir> <remote-file-basename> |
| 668 |
# |
| 669 |
# example: |
| 670 |
# X.clq $(MACRODIR) X.cls |
| 671 |
# means "if the remote-file $(MACRODIR)/X.cls is NOT a quickmacro, then |
| 672 |
# install X.clq as the remote-file." |
| 673 |
# |
| 674 |
# example: |
| 675 |
# X.sty $(MACRODIR) X.sty |
| 676 |
# means "if the remote-file IS a quickmacro, then install X.sty as the |
| 677 |
# remote-file." |
| 678 |
# |
| 679 |
# If arguments $1 and $3 are different, we are installing a quickmacro, |
| 680 |
# otherwise we are installing a regular macro. To get the name of the |
| 681 |
# quickmacro version when we are installing a regular version, we change the |
| 682 |
# last letter of the 3-letter extension to q. |
| 683 |
# |
| 684 |
# The file is ALWAYS installed if the remote-file is older than the local |
| 685 |
# file. |
| 686 |
# |
| 687 |
define maybe-install-macro |
| 688 |
function pliers () { \ |
| 689 |
installp=true; \ |
| 690 |
if [ "$$1" = "$$3" ]; then \ |
| 691 |
quickp=; \ |
| 692 |
else \ |
| 693 |
quickp=true; \ |
| 694 |
fi; \ |
| 695 |
if [ -e $$2/$$3 ]; then \ |
| 696 |
if [ $$1 -nt $$2/$$3 ]; then \ |
| 697 |
echo "File $$1 is newer than $$2/$$3; installing $$1.";\ |
| 698 |
elif [ $$quickp ]; then \ |
| 699 |
if ! $(HEAD) -2 $$2/$$3 \ |
| 700 |
| $(GREP) -q '^%% This is file '\`$$1\'',$$'; then \ |
| 701 |
echo "File $$2/$$3 is not a quickmacro; installing $$1."; \ |
| 702 |
else \ |
| 703 |
echo "Quickfile $$2/$$3 is up to date; not installing $$1.";\ |
| 704 |
installp=; \ |
| 705 |
fi; \ |
| 706 |
else \ |
| 707 |
if $(HEAD) -2 $$2/$$3 | $(GREP) -q \ |
| 708 |
'^%% This is file '\`"$$($(EXPR) $$1 : '\(.\+\.[A-z][A-z]\)[A-z]')q"\'',$$'; then\ |
| 709 |
echo "File $$2/$$3 is a quickmacro; installing $$1."; \ |
| 710 |
else \ |
| 711 |
echo "File $$2/$$3 is up to date; not installing $$1.";\ |
| 712 |
installp=; \ |
| 713 |
fi; \ |
| 714 |
fi; \ |
| 715 |
else \ |
| 716 |
echo "File $$2/$$3 does not exist; installing $$1."; \ |
| 717 |
fi; \ |
| 718 |
if [ $$installp ]; then \ |
| 719 |
test -d $$2 || $(MKDIRP) $$2; \ |
| 720 |
$(install-lsr) $$1 $$2/$$3; \ |
| 721 |
fi; \ |
| 722 |
}; pliers |
| 723 |
endef |
| 724 |
|
| 725 |
# |
| 726 |
## help target (the default) |
| 727 |
# |
| 728 |
|
| 729 |
.PHONY: default help |
| 730 |
default help: |
| 731 |
@echo ;\ |
| 732 |
echo -----------------------;\ |
| 733 |
echo The $(bundle-title) bundle;\ |
| 734 |
echo -----------------------;\ |
| 735 |
echo ;\ |
| 736 |
echo A \"fileset\" is a LaTeX package, LaTeX class, or BibTeX;\ |
| 737 |
echo bibliography style together with its supporting files.;\ |
| 738 |
echo ;\ |
| 739 |
echo The $(bundle-title) bundle contains the following stable, supported filesets:;\ |
| 740 |
echo ;\ |
| 741 |
echo " $(sort $(stable-filesets))";\ |
| 742 |
echo |
| 743 |
ifneq ($(beta-filesets),) |
| 744 |
@echo and the following beta, unsupported filesets:;\ |
| 745 |
echo ;\ |
| 746 |
echo " $(sort $(beta-filesets))";\ |
| 747 |
echo ;\ |
| 748 |
echo The unsupported filesets are in the \"unsupported\" subdirectory.;\ |
| 749 |
echo You must copy them to the main directory and set a variable in; \ |
| 750 |
echo $(calling-makefile) before make can operate properly on them.; \ |
| 751 |
echo |
| 752 |
endif |
| 753 |
@echo Destinations for installed files may be set in the file \"$(calling-makefile)\".;\ |
| 754 |
echo They are currently:;\ |
| 755 |
echo ;\ |
| 756 |
echo " LaTeX macros go into $(MACRODIR)";\ |
| 757 |
echo " LaTeX config files go into $(CONFIGDIR)";\ |
| 758 |
echo " BibTeX macros go into $(BIBDIR)";\ |
| 759 |
echo " LaTeX DVI dox go into $(MDVIDIR)";\ |
| 760 |
echo " BibTeX DVI dox go into $(BDVIDIR)";\ |
| 761 |
echo " Sources go into $(SRCDIR)";\ |
| 762 |
echo |
| 763 |
ifdef HAVE_WEB2C |
| 764 |
@echo I think your TeX installation is based on web2c.;\ |
| 765 |
echo If this is wrong, change the setting in the file \"$(calling-makefile)\". |
| 766 |
else |
| 767 |
@echo I think your TeX installation is NOT based on web2c.;\ |
| 768 |
echo If this is wrong, change the setting in the file \"$(calling-makefile)\".;\ |
| 769 |
echo Installation will be easier if you make this change. |
| 770 |
endif |
| 771 |
@echo ;\ |
| 772 |
echo ------------------------;\ |
| 773 |
echo Targets for the end user;\ |
| 774 |
echo ------------------------;\ |
| 775 |
echo ;\ |
| 776 |
echo For each fileset X, there are the following targets:;\ |
| 777 |
echo ;\ |
| 778 |
echo " X means make X's documentation and macros";\ |
| 779 |
echo " X.q means make X's documentation and quick macros";\ |
| 780 |
echo " X.install means install X's documentation, sources, and macros";\ |
| 781 |
echo " X.install.q means install X's documentation and sources and create";\ |
| 782 |
echo " and install X's quick macros.";\ |
| 783 |
echo " X.clean means delete X's non-distributed files";\ |
| 784 |
echo ;\ |
| 785 |
echo There are also the following general targets:;\ |
| 786 |
echo ;\ |
| 787 |
echo " all means do X for all X's.";\ |
| 788 |
echo " all.q means do X.q for all X's.";\ |
| 789 |
echo " install means do X.install for all X's.";\ |
| 790 |
echo " install.q means do X.install.q for all X's.";\ |
| 791 |
echo " clean means do X.clean for all X's";\ |
| 792 |
echo ;\ |
| 793 |
echo " help means display this help.";\ |
| 794 |
echo ;\ |
| 795 |
echo All individual files \(e.g., X.dvi, X.ins, X.clq\) are also valid targets.;\ |
| 796 |
echo ;\ |
| 797 |
echo To avoid installing certain components, set the following variables;\ |
| 798 |
echo in the environment or on the Make command line to something nonempty:;\ |
| 799 |
echo ;\ |
| 800 |
echo " \$$NOMAC nonempty means do not install macro files";\ |
| 801 |
echo " \$$NOSRC nonempty means do not install source files";\ |
| 802 |
echo " \$$NODOC nonempty means do not build or install documentation files";\ |
| 803 |
echo " \$$NODEP nonempty means do not consider fileset-fileset-dependencies";\ |
| 804 |
echo ;\ |
| 805 |
echo \$$NODEP is automatically set for the general targets.;\ |
| 806 |
echo ;\ |
| 807 |
echo Quick \(\"q\"\) macros are functionally identical to normal macros;\ |
| 808 |
echo but are stripped of comments and are therefore processed faster.;\ |
| 809 |
echo ;\ |
| 810 |
echo Invoking Make with the \"-s\" option will give you briefer output.;\ |
| 811 |
echo ;\ |
| 812 |
echo Example: % make -s NODOC=t install.q;\ |
| 813 |
echo |
| 814 |
ifeq ($(USER),$(DEVELOPER)) |
| 815 |
@echo ------------------------------------------; \ |
| 816 |
echo Targets for the you, the developer \($(DEVELOPER)\); \ |
| 817 |
echo ------------------------------------------; \ |
| 818 |
echo |
| 819 |
ifneq ($(alpha-filesets),) |
| 820 |
@echo Collective targets build both undistributed and distributed filesets.;\ |
| 821 |
echo Undistributed filesets are:;\ |
| 822 |
echo ;\ |
| 823 |
echo " $(sort $(alpha-filesets))";\ |
| 824 |
echo |
| 825 |
endif |
| 826 |
@echo Developer targets include the end user targets above plus, for each fileset X:;\ |
| 827 |
echo ;\ |
| 828 |
echo " X.dev.clean means delete X"\'"s non-regeneratable files";\ |
| 829 |
echo ;\ |
| 830 |
echo There are also the following general targets:;\ |
| 831 |
echo ;\ |
| 832 |
echo " dev.clean means do X.dev.clean for all X's";\ |
| 833 |
echo ;\ |
| 834 |
echo " distrib" ;\ |
| 835 |
echo " ctan means make an archive of the distribution files";\ |
| 836 |
echo " ctan.clean means delete the archive and its auxiliary tree";\ |
| 837 |
echo " install.clean means delete all files that could have been installed.";\ |
| 838 |
echo ;\ |
| 839 |
echo " all.clean means do dev.clean ctan.clean install.clean";\ |
| 840 |
echo " fresh means do dev.clean all.q ctan";\ |
| 841 |
echo |
| 842 |
endif |
| 843 |
|
| 844 |
# |
| 845 |
## select from multiple bundle licenses |
| 846 |
# |
| 847 |
|
| 848 |
# $(bundle-license) is e.g. GPL or LPPL |
| 849 |
|
| 850 |
# Use the convention that if foo.ext is license-dependent, assemble it by |
| 851 |
# inserting file foo-$(bundle-license).txt into foo.txt where the directive |
| 852 |
# __INCLUDE_LICENSE__ appears. Other licenses and files may require a |
| 853 |
# different scheme. |
| 854 |
|
| 855 |
license-dependent-files = $(part-1) $(extractor) $(driver) |
| 856 |
|
| 857 |
# NOTE: these files are assumed to be generated and will be deleted by dev.clean |
| 858 |
.PHONY: license-dependent-files.clean |
| 859 |
license-dependent-files.clean: |
| 860 |
$(RM) $(license-dependent-files) |
| 861 |
|
| 862 |
# The following rule should work, but does not because $(basename ...) is not |
| 863 |
# doing anything to its argument. But in make 3.79 reported to Debian 01-08-30. |
| 864 |
# |
| 865 |
# NOTE: this should work with the files having an initial directory part since |
| 866 |
# m4 should work from the pwd but this aspect might need tweaking. |
| 867 |
#$(license-dependent-files): %: $(basename %).txt $(basename %)-$(bundle-license).txt |
| 868 |
# $(M4) --define=__INCLUDE_LICENSE__="include($(word 2, $^))m4exit(0)" $< > $@ |
| 869 |
|
| 870 |
# Workaround: be explicit: |
| 871 |
|
| 872 |
$(license-dependent-files): $(makefiles) |
| 873 |
|
| 874 |
# Things in the source file (especially $(part-1)) are going to look like quotes |
| 875 |
# to m4 and confuse it, so we disable the quoting mechanism and rely on the |
| 876 |
# uniqueness of our string. |
| 877 |
# Make sure you put "-" for stdin as the first input file. |
| 878 |
M4-nq = echo 'changequote(,)dnl' | $(M4) |
| 879 |
$(make-dir)/part-1.dtx: $(make-dir)/part-1.txt $(make-dir)/part-1-$(bundle-license).txt |
| 880 |
$(M4-nq) --define=__INCLUDE_LICENSE__="include($(make-dir)/part-1-$(bundle-license).txt)dnl" - $< > $@ |
| 881 |
|
| 882 |
$(make-dir)/extractor.ins: $(make-dir)/extractor.txt $(make-dir)/extractor-$(bundle-license).txt |
| 883 |
$(M4-nq) --define=__INCLUDE_LICENSE__="include($(make-dir)/extractor-$(bundle-license).txt)dnl" - $< > $@ |
| 884 |
|
| 885 |
$(make-dir)/driver.tex: $(make-dir)/driver.txt $(make-dir)/driver-$(bundle-license).txt |
| 886 |
$(M4-nq) --define=__INCLUDE_LICENSE__="include($(make-dir)/driver-$(bundle-license).txt)dnl" - $< > $@ |
| 887 |
|
| 888 |
# |
| 889 |
## user/developer file targets |
| 890 |
# |
| 891 |
|
| 892 |
$(packages.stq): %.stq: %.ins %.sty |
| 893 |
@echo "Building $@." |
| 894 |
$(TEX) $< |
| 895 |
|
| 896 |
# FIX: sqo not implemented yet; same as sto for now. |
| 897 |
$(stos.sqo): %.sqo: %.sto |
| 898 |
@echo "Building $@." |
| 899 |
$(TOUCH) $@ |
| 900 |
|
| 901 |
$(classes.clq): %.clq: %.ins %.cls |
| 902 |
@echo "Building $@." |
| 903 |
$(TEX) $< |
| 904 |
|
| 905 |
# FIX: cqo not implemented yet; same as clo for now. |
| 906 |
$(clos.cqo): %.cqo: %.clo |
| 907 |
@echo "Building $@." |
| 908 |
$(TOUCH) $@ |
| 909 |
|
| 910 |
# FIX: cfq not implemented yet; same as cfg for now. |
| 911 |
$(configs.cfq): %.cfq: %.cfg |
| 912 |
@echo "Building $@." |
| 913 |
$(TOUCH) $@ |
| 914 |
# $(configs.cfq): %.cfq: %.ins %.cfg |
| 915 |
# $(TEX) $< |
| 916 |
|
| 917 |
$(bibstyles.bsq): %.bsq: %-bst.ins %.bst |
| 918 |
@echo "Building $@." |
| 919 |
$(TEX) $< |
| 920 |
|
| 921 |
# dependencies common to all filesets.dvi |
| 922 |
$(filesets.dvi): $(dox-requirements) $(bundle-bib.bib) |
| 923 |
|
| 924 |
# NOTE: The targets listed here are X.dvi for each X which has an X.cfg. The |
| 925 |
# DVI dox need to be remade when X.cfg changes, so we add a extra-dependency |
| 926 |
# rule here for that. |
| 927 |
$(addsuffix .dvi, $(configs)): %.dvi: %.cfg |
| 928 |
|
| 929 |
$(packages.dvi): %.dvi: %.tex %.sty |
| 930 |
@echo "Building $@." |
| 931 |
@$(latex-libll) $* |
| 932 |
|
| 933 |
$(classes.dvi): %.dvi: %.tex %.cls |
| 934 |
@echo "Building $@." |
| 935 |
@$(latex-libll) $* |
| 936 |
|
| 937 |
$(bibstyles.dvi): %-bst.dvi: %-bst.tex %.bst %-bst.ver |
| 938 |
@echo "Building $@." |
| 939 |
@$(latex-libll) $*-bst |
| 940 |
|
| 941 |
# |
| 942 |
## user/developer phony declarations, target-specific vars, etc. |
| 943 |
# |
| 944 |
|
| 945 |
.PHONY: install install.q \ |
| 946 |
all all.q \ |
| 947 |
clean dev.clean install.clean fresh \ |
| 948 |
$(filesets) $(filesets.q) \ |
| 949 |
$(filesets.macros) $(filesets.macros.q) \ |
| 950 |
$(filesets.dep) $(filesets.dep.q) \ |
| 951 |
$(filesets.dep.macros) $(filesets.dep.macros.q) \ |
| 952 |
$(filesets.doc) \ |
| 953 |
$(filesets.clean) $(filesets.dev.clean) |
| 954 |
|
| 955 |
|
| 956 |
# We get to exercise a lot of the features of Make in this file! Below are |
| 957 |
# some target-specific variable values. When we're building these targets, |
| 958 |
# there is no need to consider fileset-fileset-dependencies, since all filesets |
| 959 |
# are being built. By not considering them, we make things much more |
| 960 |
# efficient. |
| 961 |
# |
| 962 |
# NOTE: target-specific variables are locally set for the COMMANDS of the |
| 963 |
# target and the COMMANDS of all its dependencies, and NOT in the dependency |
| 964 |
# lists of any of those targets. |
| 965 |
all all.q install install.q: NODEP = true |
| 966 |
|
| 967 |
# Targets declared intermediate will not be remade simply because they do not |
| 968 |
# exist and are an intermediate stage on the way to the requested file. If |
| 969 |
# intermediate targets existed before the make, they will be kept around, and |
| 970 |
# will be removed if not. This way we can have a "clean:" development |
| 971 |
# directory without making Make any less efficient. Secondary files are like |
| 972 |
# intermediate files, but are not deleted even when they didn't exist before |
| 973 |
# the make. We want the intermediate files that are going to go into the |
| 974 |
# distribution to be declared secondary so they remain around even when they |
| 975 |
# aren't needed by the target called at the time. |
| 976 |
.INTERMEDIATE: $(filesets.t1) $(filesets.t2) $(filesets.t3) \ |
| 977 |
$(filter-out $(dist-filesets-cits.aux), $(filesets.aux)) |
| 978 |
.SECONDARY: $(filesets.tex) $(filesets.ins) \ |
| 979 |
$(packages.sty) $(classes.cls) \ |
| 980 |
$(bibstyles.bst) $(bibstyles.ver) \ |
| 981 |
$(dist-filesets-cits.aux) |
| 982 |
|
| 983 |
# If Make encounters an error while building a file, the file is probably |
| 984 |
# corrupt, but in many cases it is up to date, so we must delete it to ensure |
| 985 |
# that Make doesn't think it is OK. |
| 986 |
.DELETE_ON_ERROR: |
| 987 |
|
| 988 |
# |
| 989 |
## user/developer phony targets |
| 990 |
# |
| 991 |
|
| 992 |
# don't assume that building dox automatically builds macros |
| 993 |
|
| 994 |
$(filesets): %: %.macros $(perc.doc) $(perc.dep) |
| 995 |
$(filesets.q): %.q: %.macros.q $(perc.doc) $(perc.dep.q) |
| 996 |
|
| 997 |
# These are extra dependencies. |
| 998 |
$(filesets.macros): %.macros: $(perc.dep.macros) |
| 999 |
$(filesets.macros.q): %.macros.q: $(perc.dep.macros.q) |
| 1000 |
|
| 1001 |
$(packages.macros): %.macros: %.sty $(perc.dep.macros) |
| 1002 |
$(packages.macros.q): %.macros.q: %.stq $(perc.dep.macros.q) |
| 1003 |
@$(make-this-if-nonempty) $(addsuffix .sqo, $($*-stos)) |
| 1004 |
|
| 1005 |
$(classes.macros): %.macros: %.cls $(perc.dep.macros) |
| 1006 |
$(classes.macros.q): %.macros.q: %.clq $(perc.dep.macros.q) |
| 1007 |
@$(make-this-if-nonempty) $(addsuffix .cqo, $($*-clos)) |
| 1008 |
|
| 1009 |
$(bibstyles.macros): %-bst.macros: %.bst $(perc.dep.macros) |
| 1010 |
$(bibstyles.macros.q): %-bst.macros.q: %.bsq $(perc.dep.macros.q) |
| 1011 |
|
| 1012 |
$(filesets.dep): %.dep: |
| 1013 |
@[ $(NODEP) ] || \ |
| 1014 |
{ $(make-this-if-nonempty) $($*-deps); } |
| 1015 |
$(filesets.dep.q): %.dep.q: |
| 1016 |
@[ $(NODEP) ] || \ |
| 1017 |
{ $(make-this-if-nonempty) $(addsuffix .q, $($*-deps)); } |
| 1018 |
$(filesets.dep.macros): %.dep.macros: |
| 1019 |
@[ $(NODEP) ] || \ |
| 1020 |
{ $(make-this-if-nonempty) $(addsuffix .macros, $($*-deps)); } |
| 1021 |
$(filesets.dep.macros.q): %.dep.macros.q: |
| 1022 |
@[ $(NODEP) ] || \ |
| 1023 |
{ $(make-this-if-nonempty) $(addsuffix .macros.q, $($*-deps)); } |
| 1024 |
|
| 1025 |
# This would be changed if there were additional forms of documentation. |
| 1026 |
# filesets are only called by user with .install or .install.q. |
| 1027 |
# For developer, only filesets.macros and filesets.macros.q call %.doc. |
| 1028 |
# So until there are other forms of dox, we just need to build %.dvi. |
| 1029 |
$(filesets.doc): %.doc: %.dvi |
| 1030 |
|
| 1031 |
# $(findstring) isn't good enough here, it doesn't look for word boundaries, so |
| 1032 |
# you have a problem when any fileset name is a subset of another one. |
| 1033 |
|
| 1034 |
# GNU expr 1.16 seems broken in that it can't deal with [ $] or [ ^] I can't |
| 1035 |
# figure what's up. So we insert an extra space at beginning and end in case |
| 1036 |
# our string is at the beginning or end of nondc-filesets. |
| 1037 |
$(packages.clean): %.clean: |
| 1038 |
$(RM) $*.{log,ilg,idx,ind,toc,vrb,stq,cfq,bbl,blg,t1,t2,t3} \ |
| 1039 |
$(addsuffix .sqo, $($*-stos)) |
| 1040 |
@auxp=`$(EXPR) " $(nondc-filesets) " : '.* \($*\) '`; \ |
| 1041 |
if [ $$auxp ]; then \ |
| 1042 |
echo rm -f $$auxp.aux; \ |
| 1043 |
$(RM) $$auxp.aux; \ |
| 1044 |
fi |
| 1045 |
$(classes.clean): %.clean: |
| 1046 |
$(RM) $*.{log,ilg,idx,ind,toc,vrb,cfq,,clq,bbl,blg,t1,t2,t3} \ |
| 1047 |
$(addsuffix .cqo, $($*-clos)) |
| 1048 |
@auxp=`$(EXPR) " $(nondc-filesets) " : '.* \($*\) '`; \ |
| 1049 |
if [ $$auxp ]; then \ |
| 1050 |
echo rm -f $$auxp.aux; \ |
| 1051 |
$(RM) $$auxp.aux; \ |
| 1052 |
fi |
| 1053 |
$(bibstyles.clean): %-bst.clean: |
| 1054 |
$(RM) $*-bst.{log,ilg,idx,ind,toc,vrb,bbl,blg,t1,t2,t3} $*.bsq |
| 1055 |
@auxp=`$(EXPR) " $(nondc-filesets) " : '.* \($*-bst\) '`; \ |
| 1056 |
if [ $$auxp ]; then \ |
| 1057 |
echo rm -f $$auxp.aux; \ |
| 1058 |
$(RM) $$auxp.aux; \ |
| 1059 |
fi |
| 1060 |
|
| 1061 |
# |
| 1062 |
## user/developer *.install* targets (both phony and file) |
| 1063 |
# |
| 1064 |
### phony declarations and install targets |
| 1065 |
|
| 1066 |
.PHONY: $(filesets.install) \ |
| 1067 |
$(filesets.install.q) \ |
| 1068 |
$(filesets.dep.install) \ |
| 1069 |
$(filesets.dep.install.q) \ |
| 1070 |
$(filesets.cfg.install) \ |
| 1071 |
$(filesets.cfq.install) \ |
| 1072 |
$(filesets.doc.install) \ |
| 1073 |
$(filesets.src.install) \ |
| 1074 |
$(packages.sty.install) \ |
| 1075 |
$(packages.stq.install) \ |
| 1076 |
$(packages.sto.install) \ |
| 1077 |
$(packages.sqo.install) \ |
| 1078 |
$(classes.cls.install) \ |
| 1079 |
$(classes.clq.install) \ |
| 1080 |
$(classes.clo.install) \ |
| 1081 |
$(classes.cqo.install) \ |
| 1082 |
$(bibstyles.bst.install) \ |
| 1083 |
$(bibstyles.bsq.install) |
| 1084 |
|
| 1085 |
# setting NOMAC will prevent macros from being installed |
| 1086 |
# setting NOSRC will prevent sources from being installed |
| 1087 |
# setting NODOC will prevent documentation from being built and installed |
| 1088 |
# setting NODEP will inhibit consideration of fileset-fileset-dependencies |
| 1089 |
### X.install |
| 1090 |
|
| 1091 |
$(packages.install): %.install: %.sty.install %.sto.install %.cfg.install \ |
| 1092 |
%.src.install $(perc.doc.install) \ |
| 1093 |
$(perc.dep.install) |
| 1094 |
|
| 1095 |
$(classes.install): %.install: %.cls.install %.clo.install %.cfg.install \ |
| 1096 |
%.src.install $(perc.doc.install) \ |
| 1097 |
$(perc.dep.install) |
| 1098 |
$(bibstyles.install): %.install: %.bst.install %.src.install \ |
| 1099 |
$(perc.doc.install) $(perc.dep.install) |
| 1100 |
### X.install.q |
| 1101 |
|
| 1102 |
$(packages.install.q): %.install.q: %.stq.install %.sqo.install \ |
| 1103 |
%.cfq.install %.src.install \ |
| 1104 |
$(perc.doc.install) $(perc.dep.install.q) |
| 1105 |
|
| 1106 |
$(classes.install.q): %.install.q: %.clq.install %.cqo.install \ |
| 1107 |
%.cfq.install %.src.install \ |
| 1108 |
$(perc.doc.install) $(perc.dep.install.q) |
| 1109 |
$(bibstyles.install.q): %.install.q: %.bsq.install %.src.install \ |
| 1110 |
$(perc.doc.install) $(perc.dep.install.q) |
| 1111 |
### macros |
| 1112 |
|
| 1113 |
$(packages.sty.install) \ |
| 1114 |
$(classes.cls.install): %.install: % |
| 1115 |
ifeq ($(NOMAC),) |
| 1116 |
@$(maybe-install-macro) $< $(MACRODIR) $< |
| 1117 |
endif |
| 1118 |
$(bibstyles.bst.install): %-bst.bst.install: %.bst |
| 1119 |
ifeq ($(NOMAC),) |
| 1120 |
@$(maybe-install-macro) $< $(BIBDIR) $< |
| 1121 |
endif |
| 1122 |
### quickmacros |
| 1123 |
|
| 1124 |
$(packages.stq.install): %.stq.install: %.stq |
| 1125 |
ifeq ($(NOMAC),) |
| 1126 |
@$(maybe-install-macro) $< $(MACRODIR) $*.sty |
| 1127 |
endif |
| 1128 |
$(classes.clq.install): %.clq.install: %.clq |
| 1129 |
ifeq ($(NOMAC),) |
| 1130 |
@$(maybe-install-macro) $< $(MACRODIR) $*.cls |
| 1131 |
endif |
| 1132 |
$(bibstyles.bsq.install): %-bst.bsq.install: %.bsq |
| 1133 |
ifeq ($(NOMAC),) |
| 1134 |
@$(maybe-install-macro) $< $(BIBDIR) $*.bst |
| 1135 |
endif |
| 1136 |
### deps |
| 1137 |
|
| 1138 |
$(filesets.dep.install): %.dep.install: |
| 1139 |
@[ $(NODEP) ] || \ |
| 1140 |
{ $(make-this-if-nonempty) $(addsuffix .install, $($*-deps)); } |
| 1141 |
$(filesets.dep.install.q): %.dep.install.q: |
| 1142 |
@[ $(NODEP) ] || \ |
| 1143 |
{ $(make-this-if-nonempty) $(addsuffix .install.q, $($*-deps)); } |
| 1144 |
### option files |
| 1145 |
|
| 1146 |
# Should technically depend on $(%-stos) but that is not a legal idea. |
| 1147 |
$(packages.sto.install): %.sto.install: |
| 1148 |
ifeq ($(NOMAC),) |
| 1149 |
@$(foreach x, $($*-stos), \ |
| 1150 |
$(maybe-install-macro) $(x).sto $(MACRODIR) $(x).sto;) |
| 1151 |
endif |
| 1152 |
|
| 1153 |
# FIX: sqo not implemented yet, same as sto |
| 1154 |
$(packages.sqo.install): %.sqo.install: %.sto.install |
| 1155 |
|
| 1156 |
# Should technically depend on $(%-clos) but that is not a legal idea. |
| 1157 |
$(classes.clo.install): %.clo.install: |
| 1158 |
ifeq ($(NOMAC),) |
| 1159 |
@$(foreach x, $($*-clos), \ |
| 1160 |
$(maybe-install-macro) $(x).clo $(MACRODIR) $(x).clo;) |
| 1161 |
endif |
| 1162 |
# FIX: cqo not implemented yet, same as clo |
| 1163 |
$(classes.cqo.install): %.cqo.install: %.clo.install |
| 1164 |
### dox |
| 1165 |
|
| 1166 |
# NOTE: If there were ever additional (i.e. non-DVI) formats, this would be a |
| 1167 |
# rule that depended on %.doc.dvi.install $.doc.foo.install, etc. |
| 1168 |
$(packages.doc.install) \ |
| 1169 |
$(classes.doc.install): %.doc.install: $(MDVIDIR)/%.dvi |
| 1170 |
$(addprefix $(MDVIDIR)/, $(packages.dvi) $(classes.dvi)): $(MDVIDIR)/%: % |
| 1171 |
ifeq ($(NODOC),) |
| 1172 |
test -d $(MDVIDIR) || $(MKDIRP) $(MDVIDIR) |
| 1173 |
@$(install-lsr) $< $(MDVIDIR) |
| 1174 |
endif |
| 1175 |
|
| 1176 |
$(bibstyles.doc.install): %.doc.install: $(BDVIDIR)/%.dvi |
| 1177 |
$(addprefix $(BDVIDIR)/, $(bibstyles.dvi)): $(BDVIDIR)/%: % |
| 1178 |
ifeq ($(NODOC),) |
| 1179 |
test -d $(BDVIDIR) || $(MKDIRP) $(BDVIDIR) |
| 1180 |
@$(install-lsr) $< $(BDVIDIR) |
| 1181 |
endif |
| 1182 |
### sources |
| 1183 |
|
| 1184 |
$(addprefix $(SRCDIR)/, $(filesets.ins) $(filesets.tex) \ |
| 1185 |
$(bibstyles.ver) $(dist-extra-files)): $(SRCDIR)/%: % |
| 1186 |
ifeq ($(NOSRC),) |
| 1187 |
test -d $(SRCDIR) || $(MKDIRP) $(SRCDIR) |
| 1188 |
@$(install-lsr) $< $(SRCDIR) |
| 1189 |
endif |
| 1190 |
|
| 1191 |
$(packages.src.install) \ |
| 1192 |
$(classes.src.install): %.src.install: \ |
| 1193 |
$(addprefix $(SRCDIR)/, %.ins %.tex $(dist-extra-files)) |
| 1194 |
|
| 1195 |
$(bibstyles.src.install): %.src.install: \ |
| 1196 |
$(addprefix $(SRCDIR)/, %.ins %.tex %.ver $(dist-extra-files)) |
| 1197 |
### configs |
| 1198 |
|
| 1199 |
$(configs.cfg.install): %.install: $(CONFIGDIR)/% |
| 1200 |
|
| 1201 |
$(addprefix $(CONFIGDIR)/, $(configs.cfg)): $(CONFIGDIR)/%: % |
| 1202 |
ifeq ($(NOMAC),) |
| 1203 |
test -d $(CONFIGDIR) || $(MKDIRP) $(CONFIGDIR) |
| 1204 |
@$(install-lsr) $< $(CONFIGDIR) |
| 1205 |
endif |
| 1206 |
|
| 1207 |
# NOTE: X.cfg.install and X.cfq.install when there is no X.cfg is an empty |
| 1208 |
# rule. We do this so we can simply list those things as dependencies without |
| 1209 |
# having to know whether an X.cfg exists for that X. |
| 1210 |
$(filter-out $(configs.cfg.install), $(filesets.cfg.install)) \ |
| 1211 |
$(filter-out $(configs.cfq.install), $(filesets.cfq.install)): |
| 1212 |
|
| 1213 |
# FIX: cfq not implemented, is same as cfg |
| 1214 |
$(configs.cfq.install): %.cfq.install: %.cfg.install |
| 1215 |
|
| 1216 |
# |
| 1217 |
## user phony declarations and targets |
| 1218 |
# |
| 1219 |
|
| 1220 |
ifneq ($(USER),$(DEVELOPER)) |
| 1221 |
|
| 1222 |
# For the end user, 'install' and 'install.q' targets are limited to |
| 1223 |
# distributed filesets. |
| 1224 |
all: $(dist-filesets) |
| 1225 |
all.q: $(dist-filesets.q) |
| 1226 |
install: $(dist-filesets.install) |
| 1227 |
install.q: $(dist-filesets.install.q) |
| 1228 |
|
| 1229 |
# *.clean leaves only what is distributed |
| 1230 |
clean: $(dist-filesets.clean) |
| 1231 |
|
| 1232 |
# |
| 1233 |
## developer phony declarations and targets |
| 1234 |
# |
| 1235 |
else |
| 1236 |
|
| 1237 |
all: $(filesets) |
| 1238 |
all.q: $(filesets.q) |
| 1239 |
install: $(filesets.install) |
| 1240 |
install.q: $(filesets.install.q) |
| 1241 |
|
| 1242 |
# *.clean leaves only what is distributed |
| 1243 |
clean: $(filesets.clean) |
| 1244 |
|
| 1245 |
# *.dev.clean leaves only what cannot be regenerated |
| 1246 |
dev.clean: $(filesets.dev.clean) license-dependent-files.clean bundle-bib.clean |
| 1247 |
|
| 1248 |
# Not all .aux files are removed by X.clean. |
| 1249 |
$(packages.dev.clean) \ |
| 1250 |
$(classes.dev.clean): %.dev.clean: %.clean |
| 1251 |
$(RM) $*.{dvi,tex,ins,sty,cls,aux} |
| 1252 |
$(bibstyles.dev.clean): %-bst.dev.clean: %-bst.clean |
| 1253 |
$(RM) $*-bst.{ver,dvi,tex,ins,aux} $*.bst |
| 1254 |
|
| 1255 |
# NOTE Hmm, doesn't work as intended, because once dev.clean is made, it |
| 1256 |
# assumes it doesn't have to remake clean (if you put clean before/after |
| 1257 |
# ctan).... I don't think this should be true for PHONY targets. Anyway, may |
| 1258 |
# want to do "make clean" after "make fresh". |
| 1259 |
|
| 1260 |
# hmm, all.q is not made by all? ctan is not made by either? |
| 1261 |
|
| 1262 |
fresh: dev.clean all.q ctan |
| 1263 |
|
| 1264 |
# FIX: also should remove the directories and their parents too, but only if |
| 1265 |
# they're empty. |
| 1266 |
install.clean: |
| 1267 |
$(RM) -r $(addprefix $(BIBDIR)/, $(bibstyles.bst)) \ |
| 1268 |
$(addprefix $(MACRODIR)/, \ |
| 1269 |
$(packages.sty) $(classes.cls) \ |
| 1270 |
$(configs.cfg) \ |
| 1271 |
$(stos.sto) $(clos.clo)) \ |
| 1272 |
$(addprefix $(SRCDIR)/, \ |
| 1273 |
$(dist-extra-files) \ |
| 1274 |
$(filesets.tex) $(filesets.ins) \ |
| 1275 |
$(bibstyles.ver)) \ |
| 1276 |
$(addprefix $(MDVIDIR)/, $(filesets.dvi)) \ |
| 1277 |
$(addprefix $(BDVIDIR)/, $(bibstyles.dvi)) |
| 1278 |
|
| 1279 |
# |
| 1280 |
## developer file targets |
| 1281 |
# |
| 1282 |
|
| 1283 |
# this handles adding this dependency for all the rules in this section: |
| 1284 |
$(parts) $(driver) $(extractor) \ |
| 1285 |
$(filesets.t1) $(filesets.t2) $(filesets.t3): $(makefiles) |
| 1286 |
|
| 1287 |
$(packages.sty): %.sty: %.t1 %.t2 %.t3 $(parts) |
| 1288 |
@echo "Building $@." |
| 1289 |
$(CAT) $(part-1) $*.t1 $(part-2) $*.t2 $(part-3) $*.t3 \ |
| 1290 |
| $(transform-sty) > $@ |
| 1291 |
|
| 1292 |
$(classes.cls): %.cls: %.t1 %.t2 %.t3 $(parts) |
| 1293 |
@echo "Building $@." |
| 1294 |
$(CAT) $(part-1) $*.t1 $(part-2) $*.t2 $(part-3) $*.t3 \ |
| 1295 |
| $(transform-cls) > $@ |
| 1296 |
|
| 1297 |
# We want to get version control information and a command into the -bst.ver |
| 1298 |
# file. We read the .ver file specially when we build the -bst.dvi file. |
| 1299 |
# |
| 1300 |
# We quote curly braces in the awk regexps in case we are using gawk and |
| 1301 |
# $POSIXLY_CORRECT is set in the environment so that we can't really do |
| 1302 |
# anything about it. It is this way when running subshells from Emacs |
| 1303 |
# sometimes, in my experience. |
| 1304 |
# |
| 1305 |
# FIX: not sure we need transform-bst here. |
| 1306 |
$(bibstyles.ver): %-bst.ver: %.bst %-bst.t1 %-bst.t2 %-bst.t3 $(parts) |
| 1307 |
@echo "Building $@." |
| 1308 |
$(CAT) $(part-1) $*-bst.t1 $(part-2) $*-bst.t2 $(part-3) $*-bst.t3 \ |
| 1309 |
| $(transform-bst) \ |
| 1310 |
| $(AWK) '/^ %% \\def\\fileinfo/,/^ %% \\def\\docdate/ \ |
| 1311 |
{ $$1 = ""; print } \ |
| 1312 |
{ next }' \ |
| 1313 |
> $@ |
| 1314 |
$(CAT) $(part-3) \ |
| 1315 |
| $(AWK) '/^\\makeatletter% A special comment to help create bst files/, \ |
| 1316 |
/^\}% A special comment to help create bst files/ \ |
| 1317 |
{ print } \ |
| 1318 |
{ next }' \ |
| 1319 |
>> $@ |
| 1320 |
|
| 1321 |
$(bibstyles.bst): %.bst: %-bst.t1 %-bst.t2 %-bst.t3 $(parts) |
| 1322 |
@echo "Building $@." |
| 1323 |
$(CAT) $(part-1) $*-bst.t1 $(part-2) $*-bst.t2 $(part-3) $*-bst.t3 \ |
| 1324 |
| $(transform-bst) \ |
| 1325 |
| $(AWK) '/^% \\begin\{macro\}\{\\fileinfo\}/, \ |
| 1326 |
/^% \\end\{macrocode\}\^\^A special comment to help create bst files/ \ |
| 1327 |
{ next } \ |
| 1328 |
{ print }' \ |
| 1329 |
> $@ |
| 1330 |
|
| 1331 |
# bundle-bib may be undefined. If bundle-bib is defined, master-bib.bib must |
| 1332 |
# be defined and the file it names must exist. |
| 1333 |
ifneq ($(bundle-bib),) |
| 1334 |
$(bundle-bib.bib): $(master-bib.bib) $(makefiles) |
| 1335 |
$(SYMLINK) $(master-bib.bib) $@ |
| 1336 |
endif |
| 1337 |
|
| 1338 |
# t is for temporary |
| 1339 |
|
| 1340 |
# We quote curly braces in the awk regexps in case we are using gawk and |
| 1341 |
# $POSIXLY_CORRECT is set in the environment so that we can't really do |
| 1342 |
# anything about it. It is this way when running subshells from Emacs |
| 1343 |
# sometimes, in my experience. |
| 1344 |
$(filesets.t1): %.t1: %.dtx |
| 1345 |
@echo "Building $@." |
| 1346 |
$(AWK) '/^% \\CheckSum\{[0-9]+\}/,/^% \\part\{Implementation\}/' $*.dtx > $@ |
| 1347 |
|
| 1348 |
$(filesets.t2): %.t2: %.dtx |
| 1349 |
@echo "Building $@." |
| 1350 |
$(SED) -n '/^\\def\\fileinfo{.*}/,/^\\def\\docdate{.*}/p' $*.dtx > $@ |
| 1351 |
|
| 1352 |
$(filesets.t3): %.t3: %.dtx |
| 1353 |
@echo "Building $@." |
| 1354 |
$(AWK) '/^% \\part\{Implementation\}/,/^% \\Finale/ \ |
| 1355 |
{if ($$0 !~ /^% \\part\{Implementation\}/) print}' $*.dtx \ |
| 1356 |
| $(SED) '/^\\def\\fileinfo{.*}/,/^\\def\\docdate{.*}/d' > $@ |
| 1357 |
|
| 1358 |
# transform-* defs require $* to be the root name |
| 1359 |
$(packages.tex): %.tex: $(driver) |
| 1360 |
@echo "Building $@." |
| 1361 |
$(transform-sty) $(driver) > $@ |
| 1362 |
|
| 1363 |
$(classes.tex): %.tex: $(driver) |
| 1364 |
@echo "Building $@." |
| 1365 |
$(transform-cls) $(driver) > $@ |
| 1366 |
|
| 1367 |
$(bibstyles.tex): %-bst.tex: $(driver) |
| 1368 |
@echo "Building $@." |
| 1369 |
$(transform-bst) $(driver) > $@ |
| 1370 |
|
| 1371 |
$(packages.ins): %.ins: $(extractor) |
| 1372 |
@echo "Building $@." |
| 1373 |
$(transform-sty) $(extractor) > $@ |
| 1374 |
|
| 1375 |
$(classes.ins): %.ins: $(extractor) |
| 1376 |
@echo "Building $@." |
| 1377 |
$(transform-cls) $(extractor) > $@ |
| 1378 |
|
| 1379 |
$(bibstyles.ins): %-bst.ins: $(extractor) |
| 1380 |
@echo "Building $@." |
| 1381 |
$(transform-bst) $(extractor) > $@ |
| 1382 |
|
| 1383 |
Frankenfile: $(make-dir)/Frankenfile |
| 1384 |
$(SYMLINK) $< $@ |
| 1385 |
|
| 1386 |
# |
| 1387 |
## distribution archive: variables, definitions, phony and file targets |
| 1388 |
# |
| 1389 |
|
| 1390 |
# NOTE this is all still within the developer-only conditional. |
| 1391 |
|
| 1392 |
stable-files = $(stable-filesets.dvi) \ |
| 1393 |
$(stable-filesets.ins) \ |
| 1394 |
$(stable-filesets.tex) \ |
| 1395 |
$(stable-packages.sty) \ |
| 1396 |
$(stable-stos.sto) \ |
| 1397 |
$(stable-classes.cls) \ |
| 1398 |
$(stable-clos.clo) \ |
| 1399 |
$(stable-bibstyles.bst) \ |
| 1400 |
$(stable-bibstyles.ver) \ |
| 1401 |
$(stable-configs.cfg) \ |
| 1402 |
$(stable-extra-files) |
| 1403 |
beta-files = $(beta-filesets.dvi) \ |
| 1404 |
$(beta-filesets.ins) \ |
| 1405 |
$(beta-filesets.tex) \ |
| 1406 |
$(beta-packages.sty) \ |
| 1407 |
$(beta-stos.sto) \ |
| 1408 |
$(beta-classes.cls) \ |
| 1409 |
$(beta-clos.clo) \ |
| 1410 |
$(beta-bibstyles.bst) \ |
| 1411 |
$(beta-bibstyles.ver) \ |
| 1412 |
$(beta-configs.cfg) \ |
| 1413 |
$(beta-extra-files) |
| 1414 |
|
| 1415 |
# where we copy distributed files in order to archive them |
| 1416 |
stable-archive-dir = $(distribution-dir)/$(stable-dir) |
| 1417 |
beta-archive-dir = $(distribution-dir)/$(beta-dir) |
| 1418 |
|
| 1419 |
stable-archive-files = $(addprefix $(stable-archive-dir)/, $(stable-files)) |
| 1420 |
beta-archive-files = $(addprefix $(beta-archive-dir)/, $(beta-files)) |
| 1421 |
dist-archive-files = $(stable-archive-files) $(beta-archive-files) |
| 1422 |
|
| 1423 |
.PHONY: ctan ctan.clean \ |
| 1424 |
distrib distrib.clean \ |
| 1425 |
all.clean |
| 1426 |
|
| 1427 |
ctan.clean distrib.clean: |
| 1428 |
$(RM) -r $(distribution-dir) |
| 1429 |
|
| 1430 |
all.clean: dev.clean distrib.clean install.clean |
| 1431 |
|
| 1432 |
# clean before building |
| 1433 |
ctan distrib: distrib.clean $(stable-archive-dir) \ |
| 1434 |
$(beta-archive-dir) $(dist-archive-files) |
| 1435 |
$(TAR) -C $(distribution-dir) -c -z \ |
| 1436 |
-f $(distribution-dir)/$(bundle-filename).tgz \ |
| 1437 |
$(filter-out $(bundle-filename).tgz, \ |
| 1438 |
$(shell $(LS) $(distribution-dir))) |
| 1439 |
|
| 1440 |
$(stable-archive-dir) $(beta-archive-dir): $(makefiles) |
| 1441 |
$(MKDIRP) $@ |
| 1442 |
|
| 1443 |
# target is all stable-archive-files except for the bundle-bib.bib if it exists |
| 1444 |
$(filter-out $(stable-archive-dir)/$(bundle-bib.bib), \ |
| 1445 |
$(stable-archive-files)): $(stable-archive-dir)/%: \ |
| 1446 |
% $(stable-archive-dir) |
| 1447 |
@$(install-plain) $< $(stable-archive-dir) |
| 1448 |
|
| 1449 |
# rule for the bundle-bib.bib if it exists. |
| 1450 |
ifneq ($(bundle-bib),) |
| 1451 |
$(dist-filesets.aux): %.aux: %.dvi |
| 1452 |
|
| 1453 |
# bibtool -v verbose; -q suppress warnings (huge number of them); |
| 1454 |
# -d don't include double entries |
| 1455 |
# -s sort (needed to identify double entries) |
| 1456 |
# |
| 1457 |
# We want to keep the modification time the same as the master-bib so that the |
| 1458 |
# end user's Make process won't think it needs to remake all the dvi files. |
| 1459 |
# |
| 1460 |
# FIX: bibtool is having a problem getting the right crossreffed entries in |
| 1461 |
# when dealing with the master-bib. It did OK on a very short test bib I made. |
| 1462 |
# |
| 1463 |
# So we do a very patchy workaround: |
| 1464 |
# - first make the target normally; it will lack crossreffed entries. |
| 1465 |
# - combine the relevant .aux files into frankentemp.aux and change the |
| 1466 |
# \bibdata command to use the bundle-bib.dist database. |
| 1467 |
# - frankentemp.aux is nonempty or we wouldn't be doing this rule. |
| 1468 |
# - we process frankentemp.aux with bibtex and look at the output. |
| 1469 |
# - extract lines that say we've got a missing crossref. |
| 1470 |
# - remove the difficult apostrophe's from those lines, and save in |
| 1471 |
# frankentemp.1. |
| 1472 |
# - frankentemp.1 will be empty if we have no missing crossrefs. if it's |
| 1473 |
# empty, we're OK, so stop. |
| 1474 |
# - take the error lines about missing crossrefs and extract just the key. |
| 1475 |
# - frob each key K into the string "-X \'^K$\'" (without the enclosing |
| 1476 |
# double quotes). |
| 1477 |
# - combine all lines into one line. now we have a series of one or more |
| 1478 |
# strings just described all concatenated on one line. save this into |
| 1479 |
# frankentemp.2. While combining them, the backslashes before the single |
| 1480 |
# quotes got used up. |
| 1481 |
# - feed this fabricated string to bibtool. bibtool will extract each key's |
| 1482 |
# entry from bundle-bib.bib along with relevant string definitions, and put |
| 1483 |
# it on stdout. |
| 1484 |
# - append the output to bundle-bib.dist, making it complete. |
| 1485 |
# - clean up temp files. |
| 1486 |
|
| 1487 |
# FIX: we've got potential problems if any keys have regexp chars in them. |
| 1488 |
|
| 1489 |
.PHONY: bundle-bib.clean |
| 1490 |
bundle-bib.clean: |
| 1491 |
$(RM) $(bundle-bib.bib) $(bundle-bib.bib).dist |
| 1492 |
|
| 1493 |
$(bundle-bib.bib).dist: $(bundle-bib.bib) $(dist-filesets-cits.aux) |
| 1494 |
$(BIBTOOL) -q -d -s $(addprefix -x , $(dist-filesets-cits.aux)) -o $@ |
| 1495 |
$(CAT) $(dist-filesets-cits.aux) \ |
| 1496 |
| $(SED) 's/^\\bibdata{$(bundle-bib)}/\\bibdata{$(bundle-bib)\.bib\.dist}/' \ |
| 1497 |
> $(TMPDIR)/frankentemp.aux |
| 1498 |
$(BIBTEX) $(TMPDIR)/frankentemp \ |
| 1499 |
| $(GREP) '^refers to entry ".*", which doesn'\''t exist$$' \ |
| 1500 |
| $(SED) -e s/\'//g \ |
| 1501 |
> $(TMPDIR)/frankentemp.1; \ |
| 1502 |
if [ -s $(TMPDIR)/frankentemp.1 ]; then \ |
| 1503 |
$(CAT) $(TMPDIR)/frankentemp.1 \ |
| 1504 |
| $(XARGS) -i $(EXPR) {} : 'refers to entry \(.*\), which doesn' \ |
| 1505 |
| $(XARGS) -i echo -X \\\'^'{}'\$$\\\' \ |
| 1506 |
| $(XARGS) \ |
| 1507 |
> $(TMPDIR)/frankentemp.2; \ |
| 1508 |
eval $$(echo $(BIBTOOL) -q $$($(CAT) $(TMPDIR)/frankentemp.2) \ |
| 1509 |
$<) \ |
| 1510 |
>> $@; \ |
| 1511 |
fi; \ |
| 1512 |
$(RM) $(TMPDIR)/frankentemp.{aux,1,2,bbl,blg} |
| 1513 |
$(TOUCH) -r $(master-bib.bib) $@ |
| 1514 |
|
| 1515 |
$(stable-archive-dir)/$(bundle-bib.bib): $(bundle-bib.bib).dist \ |
| 1516 |
$(stable-archive-dir) |
| 1517 |
@$(install-plain) $< $(stable-archive-dir)/$(bundle-bib.bib) |
| 1518 |
endif |
| 1519 |
|
| 1520 |
$(beta-archive-files): $(beta-archive-dir)/%: % $(beta-archive-dir) |
| 1521 |
@$(install-plain) $< $(beta-archive-dir) |
| 1522 |
|
| 1523 |
endif # developer-only |
| 1524 |
|
| 1525 |
# |
| 1526 |
## Emacs file variables |
| 1527 |
# |
| 1528 |
# Local Variables: |
| 1529 |
# mode: makefile |
| 1530 |
# eval: (outline-minor-mode 1) |
| 1531 |
# outline-regexp: "##+" |
| 1532 |
# End: |