Commit | Line | Data |
---|---|---|
c7685c8d | 1 | # Maintenance productions for the Lisp directory |
92b47a4a | 2 | # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
b3ae7a0a GM |
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 | |
086add15 LK |
18 | # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | # Boston, MA 02110-1301, USA. | |
7ec641b8 | 20 | |
261f3289 EZ |
21 | SHELL = /bin/sh |
22 | ||
dce6b995 GM |
23 | lisp=@srcdir@ |
24 | VPATH=@srcdir@ | |
0df68e9f | 25 | srcdir=@srcdir@/.. |
dce6b995 | 26 | |
7ec641b8 GM |
27 | # You can specify a different executable on the make command line, |
28 | # e.g. "make EMACS=../src/emacs ...". | |
29 | ||
e3384ae7 | 30 | EMACS = ../src/emacs |
7ec641b8 GM |
31 | |
32 | # Command line flags for Emacs. This must include --multibyte, | |
33 | # otherwise some files will not compile. | |
34 | ||
1499d2dd | 35 | EMACSOPT = -batch --no-site-file --multibyte |
7ec641b8 | 36 | |
c7685c8d | 37 | SOURCES = *.el COPYING Makefile |
dce6b995 GM |
38 | lisptagsfiles1 = $(lisp)/[a-zA-Z]*.el |
39 | lisptagsfiles2 = $(lisp)/[a-zA-Z]*/[a-zA-Z]*.el | |
3975988b | 40 | ETAGS = ../lib-src/etags |
c7685c8d | 41 | |
36801f7f SM |
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 | ||
170a9e70 GM |
49 | # Files to compile before others during a bootstrap. This is done to |
50 | # speed up the bootstrap process. The CC files are compiled first | |
51 | # because CC mode tweaks the compilation process, and requiring | |
52 | # cc-mode when it is not compiled doesn't work during the | |
53 | # bootstrapping. | |
d849789b | 54 | |
dce6b995 GM |
55 | COMPILE_FIRST = \ |
56 | $(lisp)/emacs-lisp/byte-opt.el \ | |
57 | $(lisp)/emacs-lisp/bytecomp.el \ | |
170a9e70 GM |
58 | $(lisp)/subr.el \ |
59 | $(lisp)/progmodes/cc-mode.el \ | |
60 | $(lisp)/progmodes/cc-vars.el | |
d849789b | 61 | |
7ec641b8 GM |
62 | # The actual Emacs command run in the targets below. |
63 | ||
7f25090d | 64 | emacs = EMACSLOADPATH=$(lisp) $(EMACS) $(EMACSOPT) |
7ec641b8 | 65 | |
80c382e5 | 66 | # Common command to find subdirectories |
7ec641b8 | 67 | |
39cc05f5 | 68 | setwins=subdirs=`(cd $$wd; find . -type d -print)`; \ |
f83a4f35 | 69 | for file in $$subdirs; do \ |
8bde1d70 | 70 | case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* ) ;; \ |
39cc05f5 | 71 | *) wins="$$wins $$wd/$$file" ;; \ |
f83a4f35 | 72 | esac; \ |
80c382e5 | 73 | done |
8464af45 | 74 | |
39cc05f5 | 75 | setwins_almost=subdirs=`(cd $$wd; find . -type d -print)`; \ |
865e97c1 | 76 | for file in $$subdirs; do \ |
8bde1d70 | 77 | case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */obsolete | */term ) ;; \ |
39cc05f5 | 78 | *) wins="$$wins $$wd/$$file" ;; \ |
865e97c1 GM |
79 | esac; \ |
80 | done | |
80c382e5 SM |
81 | |
82 | doit: | |
83 | ||
cd1b15b8 | 84 | $(lisp)/cus-load.el: |
cc953d27 | 85 | touch $@ |
cd1b15b8 | 86 | custom-deps: $(lisp)/cus-load.el doit |
30089f1d | 87 | wd=$(lisp); $(setwins_almost); \ |
4746aeeb | 88 | echo Directories: $$wins; \ |
cd1b15b8 | 89 | $(EMACS) $(EMACSOPT) -l cus-dep --eval '(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies $$wins |
009368b9 | 90 | |
29ad9e56 | 91 | finder-data: doit |
30089f1d | 92 | wd=$(lisp); $(setwins_almost); \ |
4746aeeb | 93 | echo Directories: $$wins; \ |
cd1b15b8 | 94 | $(EMACS) $(EMACSOPT) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins |
009368b9 | 95 | |
cd1b15b8 | 96 | $(lisp)/loaddefs.el: |
cc953d27 SM |
97 | echo ";;; loaddefs.el --- automatically extracted autoloads" >> $@ |
98 | echo ";;" >> $@; echo ";;; Code:" >> $@ | |
99 | echo "\f" >> $@ | |
100 | echo ";;; Local Variables:" >> $@ | |
101 | echo ";;; version-control: never" >> $@ | |
102 | echo ";;; no-byte-compile: t" >> $@ | |
103 | echo ";;; no-update-autoloads: t" >> $@ | |
104 | echo ";;; End:" >> $@ | |
105 | echo ";;; loaddefs.el ends here" >> $@ | |
cd1b15b8 | 106 | autoloads: $(lisp)/loaddefs.el doit |
dce6b995 | 107 | wd=$(lisp); $(setwins); \ |
4746aeeb | 108 | echo Directories: $$wins; \ |
49ac2ac5 | 109 | $(EMACS) $(EMACSOPT) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins |
f83a4f35 | 110 | |
cd1b15b8 | 111 | $(lisp)/subdirs.el: |
cc953d27 | 112 | $(MAKE) $(MFLAGS) update-subdirs |
98b918b6 | 113 | update-subdirs: doit |
dce6b995 | 114 | wd=$(lisp); $(setwins); \ |
98b918b6 | 115 | for file in $$wins; do \ |
dce6b995 | 116 | $(srcdir)/update-subdirs $$file; \ |
98b918b6 RS |
117 | done; |
118 | ||
cc953d27 | 119 | updates: update-subdirs autoloads finder-data custom-deps |
c48c3772 | 120 | |
fbb43902 GM |
121 | # Update the AUTHORS file. |
122 | ||
123 | update-authors: | |
938cbd34 | 124 | $(emacs) -l authors -f batch-update-authors $(srcdir)/AUTHORS $(srcdir) |
fbb43902 | 125 | |
7ab2c289 | 126 | TAGS: $(lisptagsfiles1) $(lisptagsfiles2) |
f800daf6 | 127 | els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \ |
77389930 | 128 | ${ETAGS} $$els |
7ab2c289 | 129 | |
4136efcb | 130 | TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2) |
f800daf6 | 131 | els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \ |
77389930 | 132 | ${ETAGS} -o TAGS-LISP $$els |
7ec641b8 | 133 | |
67292de0 GM |
134 | .SUFFIXES: .elc .el |
135 | ||
cd1b15b8 | 136 | .el.elc: $(lisp)/subdirs.el |
7f25090d | 137 | -$(emacs) -f batch-byte-compile $< |
cc953d27 | 138 | |
938cbd34 LK |
139 | # Compile all Lisp files, but don't recompile those that are up to |
140 | # date. Some files don't actually get compiled because they set the | |
141 | # local variable no-byte-compile. | |
61b92c33 | 142 | |
938cbd34 LK |
143 | # All .elc files are made writable before compilation in case we |
144 | # checked out read-only (CVS option -r). Files MUST be compiled one by | |
145 | # one. If we compile several files in a row we can't make sure that | |
146 | # the compilation environment is clean. We also set the load-path of | |
147 | # the Emacs used for compilation to the current directory and its | |
148 | # subdirectories, to make sure require's and load's in the files being | |
149 | # compiled find the right files. | |
29ad9e56 | 150 | |
cd1b15b8 | 151 | compile: $(lisp)/subdirs.el doit |
61b92c33 RS |
152 | find $(lisp) -name "*.elc" -print | xargs chmod +w >/dev/null 2>&1; \ |
153 | wd=$(lisp); $(setwins); \ | |
938cbd34 | 154 | els=`echo $$wins | tr ' \011' '\012\012' | \ |
61b92c33 | 155 | sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \ |
61b92c33 | 156 | for el in $(COMPILE_FIRST) $$els; do \ |
6ad1de49 EZ |
157 | if test -f $$el; \ |
158 | then \ | |
159 | echo Compiling $$el; \ | |
90b37ca3 | 160 | $(emacs) -f batch-byte-compile-if-not-done $$el || exit 1; \ |
6ad1de49 | 161 | fi \ |
61b92c33 RS |
162 | done |
163 | ||
938cbd34 LK |
164 | # Compile all Lisp files. This is like `compile' but compiles files |
165 | # unconditionally. Some files don't actually get compiled because they | |
166 | # set the local variable no-byte-compile. | |
167 | ||
cd1b15b8 | 168 | compile-always: $(lisp)/subdirs.el doit |
4244e7dc RS |
169 | # `|| true' prevents old Bash versions from getting confused |
170 | # by an error. | |
e85a77bd | 171 | find $(lisp) -name "*.elc" -print | xargs chmod +w >/dev/null 2>&1 || true; \ |
dce6b995 | 172 | wd=$(lisp); $(setwins); \ |
938cbd34 | 173 | els=`echo $$wins | tr ' \011' '\012\012' | \ |
cc953d27 | 174 | sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \ |
d849789b | 175 | for el in $(COMPILE_FIRST) $$els; do \ |
6ad1de49 EZ |
176 | if test -f $$el; \ |
177 | then \ | |
178 | echo Compiling $$el; \ | |
179 | $(emacs) -f batch-byte-compile $$el || exit 1; \ | |
180 | fi \ | |
8256e31b | 181 | done |
96ff0f09 | 182 | |
f1180544 | 183 | compile-calc: |
cd1b15b8 | 184 | for el in `find $(lisp)/calc -name '*.el'`; do \ |
dcf91c25 CW |
185 | echo Compiling $$el; \ |
186 | $(emacs) -f batch-byte-compile $$el || exit 1; \ | |
187 | done | |
188 | ||
a9b67cf4 GM |
189 | # Backup compiled Lisp files in elc.tar.gz. If that file already |
190 | # exists, make a backup of it. | |
191 | ||
192 | backup-compiled-files: | |
dce6b995 GM |
193 | -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~ |
194 | -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc | |
a9b67cf4 GM |
195 | |
196 | # Compile Lisp files, but save old compiled files first. | |
197 | ||
61b92c33 | 198 | compile-after-backup: backup-compiled-files compile-always |
a9b67cf4 | 199 | |
7ec641b8 GM |
200 | # Recompile all Lisp files which are newer than their .elc files. |
201 | # Note that this doesn't create .elc files. It only recompiles if an | |
202 | # .elc is present. | |
203 | ||
84456793 | 204 | recompile: doit $(lisp)/progmodes/cc-mode.elc |
90b37ca3 | 205 | $(EMACS) $(EMACSOPT) --eval "(batch-byte-recompile-directory 0)" $(lisp) |
7ec641b8 | 206 | |
7fefaee7 MS |
207 | # CC Mode uses a compile time macro system which causes a compile time |
208 | # dependency in cc-mode.elc on the macros in cc-langs.el and the | |
209 | # version string in cc-defs.el. | |
84456793 MS |
210 | $(lisp)/progmodes/cc-mode.elc: \ |
211 | $(lisp)/progmodes/cc-mode.el \ | |
212 | $(lisp)/progmodes/cc-langs.el \ | |
213 | $(lisp)/progmodes/cc-defs.el | |
214 | $(EMACS) $(EMACSOPT) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el | |
7fefaee7 | 215 | |
eb7b668e MB |
216 | # Prepare a bootstrap in the lisp subdirectory. |
217 | # | |
f586d18e LK |
218 | # Build loaddefs.el to make sure it's up-to-date. If it's not, that |
219 | # might lead to errors during the bootstrap because something fails to | |
220 | # autoload as expected. If there is no emacs binary, then we can't | |
71d77b40 LT |
221 | # build autoloads yet. In that case we have to use ldefs-boot.el. |
222 | # Bootstrap should always work with ldefs-boot.el. Therefore, | |
223 | # whenever a new autoload cookie gets added that is necessary during | |
224 | # bootstrapping, ldefs-boot.el should be updated by overwriting it with | |
225 | # an up-to-date copy of loaddefs.el that is uncorrupted by | |
226 | # local changes. (Because loaddefs.el is an automatically generated | |
227 | # file, we don't want to store it in the source repository). | |
a9b67cf4 | 228 | |
36801f7f | 229 | bootstrap-prepare: |
eb7b668e MB |
230 | if test -x $(EMACS); then \ |
231 | $(MAKE) $(MFLAGS) autoloads; \ | |
232 | else \ | |
f586d18e | 233 | cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el; \ |
eb7b668e | 234 | fi |
36801f7f | 235 | |
366fc3f9 | 236 | maintainer-clean: distclean |
36801f7f | 237 | cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL) |
a9b67cf4 | 238 | |
0571ccec KS |
239 | bootstrap-clean: |
240 | cd $(lisp); rm -f *.elc */*.elc | |
241 | ||
a9b67cf4 GM |
242 | # Generate/update files for the bootstrap process. |
243 | ||
21d07b1d MR |
244 | bootstrap: update-subdirs autoloads compile |
245 | ||
246 | # Generate/update files after the bootstrap process. | |
247 | # custom-deps needs `preloaded-file-list'. | |
248 | ||
249 | bootstrap-after: finder-data custom-deps | |
a9b67cf4 | 250 | |
43280888 | 251 | distclean: |
64865454 | 252 | -rm -f ./Makefile |
43280888 | 253 | |
7ec641b8 | 254 | # Makefile ends here. |