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