Merge from emacs--devo--0
[emacs.git] / lisp / Makefile.in
bloba221ccdf4a48287b36b85eb743cbc81ce588f152
1 # Maintenance productions for the Lisp directory
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005,
3 # 2006, 2007 Free Software Foundation, Inc.
5 # This file is part of GNU Emacs.
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.
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.
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.
22 SHELL = /bin/sh
24 lisp=@srcdir@
25 VPATH=@srcdir@
26 srcdir=@srcdir@/..
28 # You can specify a different executable on the make command line,
29 # e.g. "make EMACS=../src/emacs ...".
31 EMACS = ../src/emacs
33 # Command line flags for Emacs. This must include --multibyte,
34 # otherwise some files will not compile.
36 EMACSOPT = -batch --no-site-file --multibyte
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.
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
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
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.
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
72 # The actual Emacs command run in the targets below.
74 emacs = EMACSLOADPATH=$(lisp) LC_ALL=C $(EMACS) $(EMACSOPT)
76 # Common command to find subdirectories
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
85 # Find all subdirectories except `obsolete'.
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
94 doit:
96 $(lisp)/cus-load.el:
97 touch $@
98 custom-deps: $(lisp)/subdirs.el $(lisp)/loaddefs.el $(lisp)/cus-load.el doit
99 wd=$(lisp); $(setwins_almost); \
100 echo Directories: $$wins; \
101 LC_ALL=C $(emacs) -l cus-dep --eval '(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies $$wins
103 finder-data: $(lisp)/subdirs.el $(lisp)/loaddefs.el doit
104 wd=$(lisp); $(setwins_almost); \
105 echo Directories: $$wins; \
106 LC_ALL=C $(emacs) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins
108 $(lisp)/loaddefs.el:
109 echo ";;; loaddefs.el --- automatically extracted autoloads" >> $@
110 echo ";;" >> $@; echo ";;; Code:" >> $@
111 echo "\f" >> $@
112 echo ";; Local Variables:" >> $@
113 echo ";; version-control: never" >> $@
114 echo ";; no-byte-compile: t" >> $@
115 echo ";; no-update-autoloads: t" >> $@
116 echo ";; End:" >> $@
117 echo ";;; loaddefs.el ends here" >> $@
118 autoloads: $(lisp)/subdirs.el $(lisp)/loaddefs.el doit
119 wd=$(lisp); $(setwins_almost); \
120 echo Directories: $$wins; \
121 LC_ALL=C $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
123 $(lisp)/subdirs.el:
124 $(MAKE) $(MFLAGS) update-subdirs
125 update-subdirs: doit
126 wd=$(lisp); $(setwins); \
127 for file in $$wins; do \
128 $(srcdir)/update-subdirs $$file; \
129 done;
131 updates: update-subdirs autoloads finder-data custom-deps
133 # This is useful after "cvs up".
134 cvs-update: recompile autoloads finder-data custom-deps
136 # Update the AUTHORS file.
138 update-authors:
139 $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS $(srcdir)
141 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
142 els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
143 ${ETAGS} $$els
145 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
146 els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
147 ${ETAGS} -o TAGS-LISP $$els
149 .SUFFIXES: .elc .el
151 .el.elc: $(lisp)/subdirs.el
152 -$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
154 # Compile all Lisp files, but don't recompile those that are up to
155 # date. Some files don't actually get compiled because they set the
156 # local variable no-byte-compile.
158 # All .elc files are made writable before compilation in case we
159 # checked out read-only (CVS option -r). Files MUST be compiled one by
160 # one. If we compile several files in a row we can't make sure that
161 # the compilation environment is clean. We also set the load-path of
162 # the Emacs used for compilation to the current directory and its
163 # subdirectories, to make sure require's and load's in the files being
164 # compiled find the right files.
166 # `|| true' below prevents old Bash versions from getting confused
167 # by an error.
168 compile: $(lisp)/subdirs.el mh-autoloads doit
169 find $(lisp) -name "*.elc" -print | xargs chmod +w >/dev/null 2>&1 || true; \
170 wd=$(lisp); $(setwins); \
171 els=`echo $$wins | tr ' \011' '\012\012' | \
172 sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
173 for el in $(COMPILE_FIRST) $$els; do \
174 if test -f $$el; \
175 then \
176 echo Compiling $$el; \
177 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el || exit 1; \
178 fi \
179 done
181 # Compile all Lisp files. This is like `compile' but compiles files
182 # unconditionally. Some files don't actually get compiled because they
183 # set the local variable no-byte-compile.
185 compile-always: $(lisp)/subdirs.el mh-autoloads doit
186 # `|| true' prevents old Bash versions from getting confused
187 # by an error.
188 find $(lisp) -name "*.elc" -print | xargs chmod +w >/dev/null 2>&1 || true; \
189 wd=$(lisp); $(setwins); \
190 els=`echo $$wins | tr ' \011' '\012\012' | \
191 sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
192 for el in $(COMPILE_FIRST) $$els; do \
193 if test -f $$el; \
194 then \
195 echo Compiling $$el; \
196 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
197 fi \
198 done
200 compile-calc:
201 for el in `find $(lisp)/calc -name '*.el'`; do \
202 echo Compiling $$el; \
203 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
204 done
206 # Backup compiled Lisp files in elc.tar.gz. If that file already
207 # exists, make a backup of it.
209 backup-compiled-files:
210 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
211 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
213 # Compile Lisp files, but save old compiled files first.
215 compile-after-backup: backup-compiled-files compile-always
217 # Recompile all Lisp files which are newer than their .elc files and compile
218 # new ones.
220 recompile: doit mh-autoloads $(lisp)/progmodes/cc-mode.elc
221 LC_ALL=C $(emacs) --eval "(batch-byte-recompile-directory 0)" $(lisp)
223 # CC Mode uses a compile time macro system which causes a compile time
224 # dependency in cc-mode.elc on the macros in cc-langs.el and the
225 # version string in cc-defs.el.
226 $(lisp)/progmodes/cc-mode.elc: \
227 $(lisp)/progmodes/cc-mode.el \
228 $(lisp)/progmodes/cc-langs.el \
229 $(lisp)/progmodes/cc-defs.el
230 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el
232 # Update MH-E internal autoloads. These are not to be confused with
233 # the autoloads for the MH-E entry points, which are already in
234 # loaddefs.el.
235 MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \
236 $(lisp)/mh-e/mh-buffers.el $(lisp)/mh-e/mh-compat.el \
237 $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-e.el \
238 $(lisp)/mh-e/mh-folder.el $(lisp)/mh-e/mh-funcs.el \
239 $(lisp)/mh-e/mh-gnus.el $(lisp)/mh-e/mh-identity.el \
240 $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-junk.el \
241 $(lisp)/mh-e/mh-letter.el $(lisp)/mh-e/mh-limit.el \
242 $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-print.el \
243 $(lisp)/mh-e/mh-scan.el $(lisp)/mh-e/mh-search.el \
244 $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-show.el \
245 $(lisp)/mh-e/mh-speed.el $(lisp)/mh-e/mh-thread.el \
246 $(lisp)/mh-e/mh-tool-bar.el $(lisp)/mh-e/mh-utils.el \
247 $(lisp)/mh-e/mh-xface.el
249 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
250 $(lisp)/mh-e/mh-loaddefs.el: $(lisp)/subdirs.el $(MH_E_SRC)
251 echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
252 echo "" >> $@
253 echo ";; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc." >> $@
254 echo ";; Author: Bill Wohler <wohler@newt.com>" >> $@
255 echo ";; Keywords: mail" >> $@
256 echo ";;; Commentary:" >> $@
257 echo ";;; Change Log:" >> $@
258 echo ";;; Code:" >> $@
259 echo "\f" >> $@
260 echo "(provide 'mh-loaddefs)" >> $@
261 echo ";; Local Variables:" >> $@
262 echo ";; version-control: never" >> $@
263 echo ";; no-byte-compile: t" >> $@
264 echo ";; no-update-autoloads: t" >> $@
265 echo ";; End:" >> $@
266 echo ";;; mh-loaddefs.el ends here" >> $@
267 $(emacs) \
268 -l autoload \
269 --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
270 --eval "(setq generated-autoload-file \"$(lisp)/mh-e/mh-loaddefs.el\")" \
271 --eval "(setq make-backup-files nil)" \
272 -f batch-update-autoloads $(lisp)/mh-e
274 # Prepare a bootstrap in the lisp subdirectory.
276 # Build loaddefs.el to make sure it's up-to-date. If it's not, that
277 # might lead to errors during the bootstrap because something fails to
278 # autoload as expected. If there is no emacs binary, then we can't
279 # build autoloads yet. In that case we have to use ldefs-boot.el.
280 # Bootstrap should always work with ldefs-boot.el. Therefore,
281 # whenever a new autoload cookie gets added that is necessary during
282 # bootstrapping, ldefs-boot.el should be updated by overwriting it with
283 # an up-to-date copy of loaddefs.el that is uncorrupted by
284 # local changes. (Because loaddefs.el is an automatically generated
285 # file, we don't want to store it in the source repository).
287 # The chmod +w is to handle env var CVSREAD=1. Files named
288 # are identified by being the value of `generated-autoload-file'.
290 bootstrap-prepare:
291 if test -x $(EMACS); then \
292 $(MAKE) $(MFLAGS) autoloads; \
293 else \
294 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el; \
296 chmod +w $(lisp)/loaddefs.el \
297 $(lisp)/ps-print.el \
298 $(lisp)/emacs-lisp/cl-loaddefs.el
300 maintainer-clean: distclean bootstrap-clean
301 cd $(lisp); rm -f $(AUTOGENEL)
303 ## NB note that this rules assume only one level of subdirs below lisp/.
304 ## If nested subdirs are added, it's probably time to switch to:
305 ## find $(lisp) -name "*.elc" -exec rm -f '{}' ';'
306 bootstrap-clean:
307 cd $(lisp); rm -f *.elc */*.elc
309 # Generate/update files for the bootstrap process.
311 bootstrap: update-subdirs autoloads compile
313 # Generate/update files after the bootstrap process.
314 # custom-deps needs `preloaded-file-list'.
316 bootstrap-after: finder-data custom-deps
318 distclean:
319 -rm -f ./Makefile
321 .PHONY: check-declare
323 check-declare:
324 $(emacs) -l $(lisp)/emacs-lisp/check-declare \
325 --eval '(check-declare-directory "$(lisp)")'
327 # Makefile ends here.