| 1 | # Maintenance productions for the Lisp directory |
| 2 | # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. |
| 3 | |
| 4 | # This file is part of GNU Emacs. |
| 5 | |
| 6 | # GNU Emacs is free software; you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation; either version 2, or (at your option) |
| 9 | # any later version. |
| 10 | |
| 11 | # GNU Emacs is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with GNU Emacs; see the file COPYING. If not, write to |
| 18 | # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | # Boston, MA 02110-1301, USA. |
| 20 | |
| 21 | SHELL = /bin/sh |
| 22 | |
| 23 | lisp=@srcdir@ |
| 24 | VPATH=@srcdir@ |
| 25 | srcdir=@srcdir@/.. |
| 26 | |
| 27 | # You can specify a different executable on the make command line, |
| 28 | # e.g. "make EMACS=../src/emacs ...". |
| 29 | |
| 30 | EMACS = ../src/emacs |
| 31 | |
| 32 | # Command line flags for Emacs. This must include --multibyte, |
| 33 | # otherwise some files will not compile. |
| 34 | |
| 35 | EMACSOPT = -batch --no-site-file --multibyte |
| 36 | |
| 37 | SOURCES = *.el COPYING Makefile |
| 38 | lisptagsfiles1 = $(lisp)/[a-zA-Z]*.el |
| 39 | lisptagsfiles2 = $(lisp)/[a-zA-Z]*/[a-zA-Z]*.el |
| 40 | ETAGS = ../lib-src/etags |
| 41 | |
| 42 | # Elisp files auto-generated. |
| 43 | AUTOGENEL = loaddefs.el \ |
| 44 | cus-load.el \ |
| 45 | finder-inf.el \ |
| 46 | subdirs.el \ |
| 47 | eshell/esh-groups.el \ |
| 48 | mh-e/mh-loaddefs.el |
| 49 | |
| 50 | # Files to compile before others during a bootstrap. This is done to |
| 51 | # speed up the bootstrap process. The CC files are compiled first |
| 52 | # because CC mode tweaks the compilation process, and requiring |
| 53 | # cc-mode when it is not compiled doesn't work during the |
| 54 | # bootstrapping. |
| 55 | |
| 56 | COMPILE_FIRST = \ |
| 57 | $(lisp)/emacs-lisp/byte-opt.el \ |
| 58 | $(lisp)/emacs-lisp/bytecomp.el \ |
| 59 | $(lisp)/subr.el \ |
| 60 | $(lisp)/progmodes/cc-mode.el \ |
| 61 | $(lisp)/progmodes/cc-vars.el |
| 62 | |
| 63 | # The actual Emacs command run in the targets below. |
| 64 | |
| 65 | emacs = EMACSLOADPATH=$(lisp) $(EMACS) $(EMACSOPT) |
| 66 | |
| 67 | # Common command to find subdirectories |
| 68 | |
| 69 | setwins=subdirs=`(cd $$wd; find . -type d -print)`; \ |
| 70 | for file in $$subdirs; do \ |
| 71 | case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* ) ;; \ |
| 72 | *) wins="$$wins $$wd/$$file" ;; \ |
| 73 | esac; \ |
| 74 | done |
| 75 | |
| 76 | setwins_almost=subdirs=`(cd $$wd; find . -type d -print)`; \ |
| 77 | for file in $$subdirs; do \ |
| 78 | case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */obsolete | */term ) ;; \ |
| 79 | *) wins="$$wins $$wd/$$file" ;; \ |
| 80 | esac; \ |
| 81 | done |
| 82 | |
| 83 | doit: |
| 84 | |
| 85 | $(lisp)/cus-load.el: |
| 86 | touch $@ |
| 87 | custom-deps: $(lisp)/cus-load.el doit |
| 88 | wd=$(lisp); $(setwins_almost); \ |
| 89 | echo Directories: $$wins; \ |
| 90 | $(EMACS) $(EMACSOPT) -l cus-dep --eval '(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies $$wins |
| 91 | |
| 92 | finder-data: doit |
| 93 | wd=$(lisp); $(setwins_almost); \ |
| 94 | echo Directories: $$wins; \ |
| 95 | $(EMACS) $(EMACSOPT) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins |
| 96 | |
| 97 | $(lisp)/loaddefs.el: |
| 98 | echo ";;; loaddefs.el --- automatically extracted autoloads" >> $@ |
| 99 | echo ";;" >> $@; echo ";;; Code:" >> $@ |
| 100 | echo "\f" >> $@ |
| 101 | echo ";; Local Variables:" >> $@ |
| 102 | echo ";; version-control: never" >> $@ |
| 103 | echo ";; no-byte-compile: t" >> $@ |
| 104 | echo ";; no-update-autoloads: t" >> $@ |
| 105 | echo ";; End:" >> $@ |
| 106 | echo ";;; loaddefs.el ends here" >> $@ |
| 107 | autoloads: $(lisp)/loaddefs.el doit |
| 108 | wd=$(lisp); $(setwins); \ |
| 109 | echo Directories: $$wins; \ |
| 110 | $(EMACS) $(EMACSOPT) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins |
| 111 | |
| 112 | $(lisp)/subdirs.el: |
| 113 | $(MAKE) $(MFLAGS) update-subdirs |
| 114 | update-subdirs: doit |
| 115 | wd=$(lisp); $(setwins); \ |
| 116 | for file in $$wins; do \ |
| 117 | $(srcdir)/update-subdirs $$file; \ |
| 118 | done; |
| 119 | |
| 120 | updates: update-subdirs autoloads finder-data custom-deps |
| 121 | |
| 122 | # This is useful after "cvs up". |
| 123 | cvs-update: recompile autoloads finder-data custom-deps |
| 124 | |
| 125 | # Update the AUTHORS file. |
| 126 | |
| 127 | update-authors: |
| 128 | $(emacs) -l authors -f batch-update-authors $(srcdir)/AUTHORS $(srcdir) |
| 129 | |
| 130 | TAGS: $(lisptagsfiles1) $(lisptagsfiles2) |
| 131 | els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \ |
| 132 | ${ETAGS} $$els |
| 133 | |
| 134 | TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2) |
| 135 | els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \ |
| 136 | ${ETAGS} -o TAGS-LISP $$els |
| 137 | |
| 138 | .SUFFIXES: .elc .el |
| 139 | |
| 140 | .el.elc: $(lisp)/subdirs.el |
| 141 | -$(emacs) -f batch-byte-compile $< |
| 142 | |
| 143 | # Compile all Lisp files, but don't recompile those that are up to |
| 144 | # date. Some files don't actually get compiled because they set the |
| 145 | # local variable no-byte-compile. |
| 146 | |
| 147 | # All .elc files are made writable before compilation in case we |
| 148 | # checked out read-only (CVS option -r). Files MUST be compiled one by |
| 149 | # one. If we compile several files in a row we can't make sure that |
| 150 | # the compilation environment is clean. We also set the load-path of |
| 151 | # the Emacs used for compilation to the current directory and its |
| 152 | # subdirectories, to make sure require's and load's in the files being |
| 153 | # compiled find the right files. |
| 154 | |
| 155 | compile: $(lisp)/subdirs.el mh-autoloads doit |
| 156 | find $(lisp) -name "*.elc" -print | xargs chmod +w >/dev/null 2>&1; \ |
| 157 | wd=$(lisp); $(setwins); \ |
| 158 | els=`echo $$wins | tr ' \011' '\012\012' | \ |
| 159 | sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \ |
| 160 | for el in $(COMPILE_FIRST) $$els; do \ |
| 161 | if test -f $$el; \ |
| 162 | then \ |
| 163 | echo Compiling $$el; \ |
| 164 | $(emacs) -f batch-byte-compile-if-not-done $$el || exit 1; \ |
| 165 | fi \ |
| 166 | done |
| 167 | |
| 168 | # Compile all Lisp files. This is like `compile' but compiles files |
| 169 | # unconditionally. Some files don't actually get compiled because they |
| 170 | # set the local variable no-byte-compile. |
| 171 | |
| 172 | compile-always: $(lisp)/subdirs.el mh-autoloads doit |
| 173 | # `|| true' prevents old Bash versions from getting confused |
| 174 | # by an error. |
| 175 | find $(lisp) -name "*.elc" -print | xargs chmod +w >/dev/null 2>&1 || true; \ |
| 176 | wd=$(lisp); $(setwins); \ |
| 177 | els=`echo $$wins | tr ' \011' '\012\012' | \ |
| 178 | sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \ |
| 179 | for el in $(COMPILE_FIRST) $$els; do \ |
| 180 | if test -f $$el; \ |
| 181 | then \ |
| 182 | echo Compiling $$el; \ |
| 183 | $(emacs) -f batch-byte-compile $$el || exit 1; \ |
| 184 | fi \ |
| 185 | done |
| 186 | |
| 187 | compile-calc: |
| 188 | for el in `find $(lisp)/calc -name '*.el'`; do \ |
| 189 | echo Compiling $$el; \ |
| 190 | $(emacs) -f batch-byte-compile $$el || exit 1; \ |
| 191 | done |
| 192 | |
| 193 | # Backup compiled Lisp files in elc.tar.gz. If that file already |
| 194 | # exists, make a backup of it. |
| 195 | |
| 196 | backup-compiled-files: |
| 197 | -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~ |
| 198 | -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc |
| 199 | |
| 200 | # Compile Lisp files, but save old compiled files first. |
| 201 | |
| 202 | compile-after-backup: backup-compiled-files compile-always |
| 203 | |
| 204 | # Recompile all Lisp files which are newer than their .elc files. |
| 205 | # Note that this doesn't create .elc files. It only recompiles if an |
| 206 | # .elc is present. |
| 207 | |
| 208 | recompile: doit mh-autoloads $(lisp)/progmodes/cc-mode.elc |
| 209 | $(EMACS) $(EMACSOPT) --eval "(batch-byte-recompile-directory 0)" $(lisp) |
| 210 | |
| 211 | # CC Mode uses a compile time macro system which causes a compile time |
| 212 | # dependency in cc-mode.elc on the macros in cc-langs.el and the |
| 213 | # version string in cc-defs.el. |
| 214 | $(lisp)/progmodes/cc-mode.elc: \ |
| 215 | $(lisp)/progmodes/cc-mode.el \ |
| 216 | $(lisp)/progmodes/cc-langs.el \ |
| 217 | $(lisp)/progmodes/cc-defs.el |
| 218 | $(EMACS) $(EMACSOPT) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el |
| 219 | |
| 220 | # Update MH-E internal autoloads. These are not to be confused with |
| 221 | # the autoloads for the MH-E entry points, which are already in |
| 222 | # loaddefs.el. |
| 223 | MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \ |
| 224 | $(lisp)/mh-e/mh-buffers.el $(lisp)/mh-e/mh-comp.el \ |
| 225 | $(lisp)/mh-e/mh-customize.el $(lisp)/mh-e/mh-e.el \ |
| 226 | $(lisp)/mh-e/mh-funcs.el $(lisp)/mh-e/mh-identity.el \ |
| 227 | $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-init.el \ |
| 228 | $(lisp)/mh-e/mh-junk.el $(lisp)/mh-e/mh-mime.el \ |
| 229 | $(lisp)/mh-e/mh-print.el $(lisp)/mh-e/mh-search.el \ |
| 230 | $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-speed.el \ |
| 231 | $(lisp)/mh-e/mh-utils.el |
| 232 | |
| 233 | mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el |
| 234 | $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC) |
| 235 | echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@ |
| 236 | echo ";;" >> $@ |
| 237 | echo ";; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc." >> $@ |
| 238 | echo ";; Author: Bill Wohler <wohler@newt.com>" >> $@ |
| 239 | echo ";; Keywords: mail" >> $@ |
| 240 | echo ";;; Commentary:" >> $@ |
| 241 | echo ";;; Change Log:" >> $@ |
| 242 | echo ";;; Code:" >> $@ |
| 243 | $(EMACS) $(EMACSOPT) \ |
| 244 | -l autoload \ |
| 245 | --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \ |
| 246 | --eval "(setq generated-autoload-file \"$(lisp)/mh-e/mh-loaddefs.el\")" \ |
| 247 | --eval "(setq make-backup-files nil)" \ |
| 248 | -f batch-update-autoloads $(lisp)/mh-e |
| 249 | echo "\f" >> $@ |
| 250 | echo "(provide 'mh-loaddefs)" >> $@ |
| 251 | echo ";; Local Variables:" >> $@ |
| 252 | echo ";; version-control: never" >> $@ |
| 253 | echo ";; no-byte-compile: t" >> $@ |
| 254 | echo ";; no-update-autoloads: t" >> $@ |
| 255 | echo ";; End:" >> $@ |
| 256 | echo ";;; mh-loaddefs.el ends here" >> $@ |
| 257 | |
| 258 | # Prepare a bootstrap in the lisp subdirectory. |
| 259 | # |
| 260 | # Build loaddefs.el to make sure it's up-to-date. If it's not, that |
| 261 | # might lead to errors during the bootstrap because something fails to |
| 262 | # autoload as expected. If there is no emacs binary, then we can't |
| 263 | # build autoloads yet. In that case we have to use ldefs-boot.el. |
| 264 | # Bootstrap should always work with ldefs-boot.el. Therefore, |
| 265 | # whenever a new autoload cookie gets added that is necessary during |
| 266 | # bootstrapping, ldefs-boot.el should be updated by overwriting it with |
| 267 | # an up-to-date copy of loaddefs.el that is uncorrupted by |
| 268 | # local changes. (Because loaddefs.el is an automatically generated |
| 269 | # file, we don't want to store it in the source repository). |
| 270 | |
| 271 | bootstrap-prepare: |
| 272 | if test -x $(EMACS); then \ |
| 273 | $(MAKE) $(MFLAGS) autoloads; \ |
| 274 | else \ |
| 275 | cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el; \ |
| 276 | fi |
| 277 | |
| 278 | maintainer-clean: distclean |
| 279 | cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL) |
| 280 | |
| 281 | bootstrap-clean: |
| 282 | cd $(lisp); rm -f *.elc */*.elc |
| 283 | |
| 284 | # Generate/update files for the bootstrap process. |
| 285 | |
| 286 | bootstrap: update-subdirs autoloads compile |
| 287 | |
| 288 | # Generate/update files after the bootstrap process. |
| 289 | # custom-deps needs `preloaded-file-list'. |
| 290 | |
| 291 | bootstrap-after: finder-data custom-deps |
| 292 | |
| 293 | distclean: |
| 294 | -rm -f ./Makefile |
| 295 | |
| 296 | # Makefile ends here. |