| 1 | # Copyright (C) 2007-2014 Free Software Foundation, Inc. |
| 2 | # See end for copying conditions. |
| 3 | |
| 4 | # although it would be nice to use tex rather than pdftex to avoid |
| 5 | # colors, spurious warnings about names being referenced but not |
| 6 | # existing, etc., dvips | ps2pdf doesn't preserve the page size. |
| 7 | # Instead of creating a special dvips config file, put up with the warnings. |
| 8 | # (Note added 2012/05: for me, using texlive-2007-57, pdftex |
| 9 | # doesn't work for reason, but tex does.) |
| 10 | texinfodir=../misc |
| 11 | emacsdir=../emacs |
| 12 | |
| 13 | tex = TEXINPUTS=".:$(texinfodir):${emacsdir}:${TEXINPUTS}" pdftex -interaction=nonstopmode |
| 14 | |
| 15 | all: vol1.pdf vol2.pdf |
| 16 | |
| 17 | # There's probably a better way to do this, without using a temp file. |
| 18 | # Something like: |
| 19 | # tex -jobname=vol1 '\def\SETVOL1 \input{elisp.texi}' |
| 20 | # but I don't know what to use for "\def\SETVOL1". |
| 21 | tex1 = sed '/^@setfilename/a\ |
| 22 | @set VOL1' elisp.texi > elisp1tmp.tex && $(tex) -jobname=vol1 elisp1tmp.tex |
| 23 | |
| 24 | tex2 = sed '/^@setfilename/a\ |
| 25 | @set VOL2' elisp.texi > elisp2tmp.tex && $(tex) -jobname=vol2 elisp2tmp.tex |
| 26 | |
| 27 | # elisp.texi specially defines \tocreadfilename when VOL1 or VOL2 is |
| 28 | # set, so we can use our premade .toc's. |
| 29 | # |
| 30 | vol1.pdf: elisp1med-fns-ready elisp1med-aux-ready elisp1med-toc-ready |
| 31 | @echo -e "\f Final TeX run for volume 1..." |
| 32 | cp elisp1med-toc-ready elisp1-toc-ready.toc |
| 33 | cp elisp1med-fns-ready vol1.fns |
| 34 | cp elisp1med-aux-ready vol1.aux |
| 35 | $(tex1) |
| 36 | # |
| 37 | vol2.pdf: elisp2med-fns-ready elisp2med-aux-ready elisp2med-toc-ready |
| 38 | @echo "Final TeX run for volume 2..." |
| 39 | cp elisp2med-toc-ready elisp2-toc-ready.toc |
| 40 | cp elisp2med-fns-ready vol2.fns |
| 41 | cp elisp2med-aux-ready vol2.aux |
| 42 | $(tex2) |
| 43 | |
| 44 | # \f intermediate toc files. |
| 45 | # |
| 46 | # vol1 toc: volume 1, page break, volume 2 (with II: prepended). |
| 47 | elisp1med-toc-ready: elisp1med-init elisp2med-init |
| 48 | echo '@unnchapentry{@b{Volume 1}}{10001}{vol1}{}' >$@ |
| 49 | cat elisp1med-toc >>$@ |
| 50 | echo '@page' >>$@ |
| 51 | echo '@unnchapentry{@b{Volume 2}}{10001}{vol2}{}' >>$@ |
| 52 | sed 's/{\([^}]*\)}$$/{II:\1}/' elisp2med-toc >>$@ |
| 53 | # |
| 54 | # vol2 toc: volume 1 (with I: prepended), page break, volume 2. |
| 55 | elisp2med-toc-ready: elisp1med-init elisp2med-init |
| 56 | echo '@unnchapentry{@b{Volume 1}}{10001}{vol1}{}' >$@ |
| 57 | sed 's/{\([^}]*\)}$$/{I:\1}/' elisp1med-toc >>$@ |
| 58 | echo '@page' >>$@ |
| 59 | echo '@unnchapentry{@b{Volume 2}}{10001}{vol2}{}' >>$@ |
| 60 | cat elisp2med-toc >>$@ |
| 61 | |
| 62 | |
| 63 | # \f intermediate aux files. |
| 64 | # |
| 65 | # append vol2's fixed aux to normal vol1. |
| 66 | elisp1med-aux-ready: elisp2med-aux-vol-added |
| 67 | cat elisp1med-aux $< >$@ |
| 68 | # |
| 69 | # prepend vol1's fixed aux to vol2. |
| 70 | elisp2med-aux-ready: elisp1med-aux-vol-added |
| 71 | cat $< elisp2med-aux >$@ |
| 72 | |
| 73 | # on -pg entries, append volume number after page number. |
| 74 | elisp1med-aux-vol-added: elisp1med-init |
| 75 | sed 's/-pg}{\(.*\)}$$/-pg}{\1, vol.@tie1}/' elisp1med-aux >$@ |
| 76 | # |
| 77 | elisp2med-aux-vol-added: elisp2med-init |
| 78 | sed 's/-pg}{\(.*\)}$$/-pg}{\1, vol.@tie2}/' elisp2med-aux >$@ |
| 79 | |
| 80 | # \f intermediate index (fns) file. |
| 81 | # |
| 82 | elisp1med-fns-ready: elisp1med-fn-vol-added elisp2med-fn-vol-added |
| 83 | cat elisp2med-fn-vol-added >>vol1.fn |
| 84 | texindex vol1.fn |
| 85 | cp vol1.fns $@ |
| 86 | # |
| 87 | elisp2med-fns-ready: elisp1med-fn-vol-added elisp2med-fn-vol-added |
| 88 | cat elisp1med-fn-vol-added >>vol2.fn |
| 89 | texindex vol2.fn |
| 90 | cp vol2.fns $@ |
| 91 | |
| 92 | # Insert volume number (I: or II:) into index file. |
| 93 | elisp1med-fn-vol-added: elisp1med-init |
| 94 | cp vol1.fn elisp1med-fn |
| 95 | sed 's/}{/}{I:/' elisp1med-fn >$@ |
| 96 | # |
| 97 | elisp2med-fn-vol-added: elisp2med-init |
| 98 | cp vol2.fn elisp2med-fn |
| 99 | sed 's/}{/}{II:/' elisp2med-fn >$@ |
| 100 | |
| 101 | # ----------------------------------------------------------------------------- |
| 102 | # everything above is essentially a duplicate of everything below. sorry. |
| 103 | # ----------------------------------------------------------------------------- |
| 104 | |
| 105 | # \f intermediate TeX runs. |
| 106 | # |
| 107 | # this generates what would be the final versions -- except the page |
| 108 | # numbers aren't right. The process of adding the I: and II: changes |
| 109 | # the page breaks, so a few index entries, at least are wrong. (In |
| 110 | # 2007, x-meta-keysym in vol.II ended up on page 374 when the index had |
| 111 | # it on page 375 from the initial run.) |
| 112 | # |
| 113 | # So, we start all over again, from these fns/aux/toc files. |
| 114 | # |
| 115 | elisp1med-init: elisp1-fns-ready elisp1-aux-ready elisp1init-toc-ready $(texinfodir)/texinfo.tex |
| 116 | @echo -e "\f Intermediate TeX run for volume 1..." |
| 117 | cp elisp1init-toc-ready elisp1-toc-ready.toc |
| 118 | cp elisp1-fns-ready vol1.fns |
| 119 | cp elisp1-aux-ready vol1.aux |
| 120 | $(tex1) |
| 121 | texindex vol1.?? |
| 122 | mv vol1.aux elisp1med-aux |
| 123 | mv vol1.toc elisp1med-toc |
| 124 | # |
| 125 | elisp2med-init: elisp2-fns-ready elisp2-aux-ready elisp2init-toc-ready $(texinfodir)/texinfo.tex |
| 126 | @echo "Final TeX run for volume 2..." |
| 127 | cp elisp2init-toc-ready elisp2-toc-ready.toc |
| 128 | cp elisp2-fns-ready vol2.fns |
| 129 | cp elisp2-aux-ready vol2.aux |
| 130 | $(tex2) |
| 131 | texindex vol2.?? |
| 132 | mv vol2.aux elisp2med-aux |
| 133 | mv vol2.toc elisp2med-toc |
| 134 | |
| 135 | |
| 136 | # \f initial toc files. |
| 137 | # |
| 138 | # vol1 toc: volume 1, page break, volume 2 (with II: prepended). |
| 139 | elisp1init-toc-ready: elisp1-init elisp2-init |
| 140 | echo '@unnchapentry{@b{Volume 1}}{10001}{vol1}{}' >$@ |
| 141 | cat elisp1-toc >>$@ |
| 142 | echo '@page' >>$@ |
| 143 | echo '@unnchapentry{@b{Volume 2}}{10001}{vol2}{}' >>$@ |
| 144 | sed 's/{\([^}]*\)}$$/{II:\1}/' elisp2-toc >>$@ |
| 145 | # |
| 146 | # vol2 toc: volume 1 (with I: prepended), page break, volume 2. |
| 147 | elisp2init-toc-ready: elisp1-init elisp2-init |
| 148 | echo '@unnchapentry{@b{Volume 1}}{10001}{vol1}{}' >$@ |
| 149 | sed 's/{\([^}]*\)}$$/{I:\1}/' elisp1-toc >>$@ |
| 150 | echo '@page' >>$@ |
| 151 | echo '@unnchapentry{@b{Volume 2}}{10001}{vol2}{}' >>$@ |
| 152 | cat elisp2-toc >>$@ |
| 153 | |
| 154 | |
| 155 | # \f initial aux files. |
| 156 | # |
| 157 | # append vol2's fixed aux to normal vol1. The initial runs saved |
| 158 | # elisp1-aux and elisp2-aux. |
| 159 | elisp1-aux-ready: elisp2-aux-vol-added |
| 160 | cat elisp1-aux $< >$@ |
| 161 | # |
| 162 | # prepend vol1's fixed aux to vol2. |
| 163 | elisp2-aux-ready: elisp1-aux-vol-added |
| 164 | cat $< elisp2-aux >$@ |
| 165 | |
| 166 | # on -pg entries, append volume number after page number. |
| 167 | elisp1-aux-vol-added: elisp1-init |
| 168 | sed 's/-pg}{\(.*\)}$$/-pg}{\1, vol.@tie1}/' elisp1-aux >$@ |
| 169 | # |
| 170 | elisp2-aux-vol-added: elisp2-init |
| 171 | sed 's/-pg}{\(.*\)}$$/-pg}{\1, vol.@tie2}/' elisp2-aux >$@ |
| 172 | |
| 173 | # \f initial index (fns) file. |
| 174 | # |
| 175 | # Append other volume's index entries to this one's. |
| 176 | # Index entries in this volume will then take precedence. |
| 177 | elisp1-fns-ready: elisp1-fn-vol-added elisp2-fn-vol-added |
| 178 | cat elisp2-fn-vol-added >>vol1.fn |
| 179 | texindex vol1.fn |
| 180 | cp vol1.fns $@ |
| 181 | # |
| 182 | elisp2-fns-ready: elisp1-fn-vol-added elisp2-fn-vol-added |
| 183 | cat elisp1-fn-vol-added >>vol2.fn |
| 184 | texindex vol2.fn |
| 185 | cp vol2.fns $@ |
| 186 | |
| 187 | # Insert volume number (I: or II:) into index file. |
| 188 | elisp1-fn-vol-added: elisp1-init |
| 189 | cp vol1.fn elisp1-fn |
| 190 | sed 's/}{/}{I:/' elisp1-fn >$@ |
| 191 | # |
| 192 | elisp2-fn-vol-added: elisp2-init |
| 193 | cp vol2.fn elisp2-fn |
| 194 | sed 's/}{/}{II:/' elisp2-fn >$@ |
| 195 | |
| 196 | |
| 197 | # \f initial TeX runs. |
| 198 | # |
| 199 | # We use the .fn, .aux, and .toc files created here in subsequent |
| 200 | # processing. The page numbers generated here will not be correct yet, |
| 201 | # but we run texindex and TeX a second time just to get them closer. |
| 202 | # Otherwise it might take even longer for them to converge. |
| 203 | # |
| 204 | elisp1-init: elisp.texi |
| 205 | @echo -e "\f Initial TeX run for volume 1..." |
| 206 | rm -f vol1.aux vol1.toc |
| 207 | $(tex1) |
| 208 | texindex vol1.?? |
| 209 | mv vol1.aux elisp1-aux |
| 210 | mv vol1.toc elisp1-toc |
| 211 | touch $@ |
| 212 | # |
| 213 | elisp2-init: elisp.texi |
| 214 | @echo "Initial TeX run for volume 2..." |
| 215 | rm -f vol2.aux vol2.toc |
| 216 | $(tex2) |
| 217 | texindex vol2.?? |
| 218 | mv vol2.aux elisp2-aux |
| 219 | mv vol2.toc elisp2-toc |
| 220 | touch $@ |
| 221 | |
| 222 | # COPYING CONDITIONS |
| 223 | # |
| 224 | # This file is free software: you can redistribute it and/or modify |
| 225 | # it under the terms of the GNU General Public License as published by |
| 226 | # the Free Software Foundation, either version 3 of the License, or |
| 227 | # (at your option) any later version. |
| 228 | # |
| 229 | # This file is distributed in the hope that it will be useful, |
| 230 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 231 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 232 | # GNU General Public License for more details. |
| 233 | # |
| 234 | # You should have received a copy of the GNU General Public License |
| 235 | # along with this file. If not, see <http://www.gnu.org/licenses/>. |
| 236 | |