Move minibuffer changes to the section "Minibuffer changes".
[emacs.git] / lisp / Makefile.in
blob1557933432252237bd9453914501c47107450a47
1 # Maintenance productions for the Lisp directory
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
3 # 2008 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 # Automatically generated autoload files, apart from lisp/loaddefs.el.
50 LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \
51 $(lisp)/calendar/diary-loaddefs.el $(lisp)/calendar/hol-loaddefs.el
53 # Elisp files auto-generated.
54 AUTOGENEL = loaddefs.el \
55 $(LOADDEFS) \
56 cus-load.el \
57 finder-inf.el \
58 subdirs.el \
59 eshell/esh-groups.el \
60 mh-e/mh-loaddefs.el
62 # Files to compile before others during a bootstrap. This is done to
63 # speed up the bootstrap process. The CC files are compiled first
64 # because CC mode tweaks the compilation process, and requiring
65 # cc-mode when it is not compiled doesn't work during the
66 # bootstrapping.
68 COMPILE_FIRST = \
69 $(lisp)/emacs-lisp/byte-opt.el \
70 $(lisp)/emacs-lisp/bytecomp.el \
71 $(lisp)/subr.el \
72 $(lisp)/progmodes/cc-mode.el \
73 $(lisp)/progmodes/cc-vars.el
75 # The actual Emacs command run in the targets below.
77 emacs = EMACSLOADPATH=$(lisp) LC_ALL=C $(EMACS) $(EMACSOPT)
79 # Common command to find subdirectories
81 setwins=subdirs=`(cd $$wd; find . -type d -print)`; \
82 for file in $$subdirs; do \
83 case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* ) ;; \
84 *) wins="$$wins $$wd/$$file" ;; \
85 esac; \
86 done
88 # Find all subdirectories except `obsolete'.
90 setwins_almost=subdirs=`(cd $$wd; find . -type d -print)`; \
91 for file in $$subdirs; do \
92 case $$file in */Old | */RCS | */CVS | */CVS/* | */.* | */.*/* | */=* | */obsolete | */term ) ;; \
93 *) wins="$$wins $$wd/$$file" ;; \
94 esac; \
95 done
97 doit:
99 $(lisp)/cus-load.el:
100 touch $@
101 # Note that custom-deps and finder-data depend on autoloads rather
102 # than on loaddefs.el, so that autoloads does not run in parallel with
103 # them under "make -j", because that could delete loaddefs.el from
104 # under their feet.
105 custom-deps: $(lisp)/subdirs.el autoloads $(lisp)/cus-load.el doit
106 wd=$(lisp); $(setwins_almost); \
107 echo Directories: $$wins; \
108 $(emacs) -l cus-dep --eval '(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies $$wins
110 finder-data: $(lisp)/subdirs.el autoloads doit
111 wd=$(lisp); $(setwins_almost); \
112 echo Directories: $$wins; \
113 $(emacs) -l finder --eval '(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist $$wins
115 autoloads: $(lisp)/subdirs.el $(LOADDEFS) doit
116 wd=$(lisp); $(setwins_almost); \
117 echo Directories: $$wins; \
118 $(emacs) -l autoload --eval '(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads $$wins
120 $(lisp)/subdirs.el:
121 $(MAKE) $(MFLAGS) update-subdirs
122 update-subdirs: doit
123 wd=$(lisp); $(setwins); \
124 for file in $$wins; do \
125 $(srcdir)/update-subdirs $$file; \
126 done;
128 updates: update-subdirs autoloads finder-data custom-deps
130 # This is useful after "cvs up".
131 cvs-update: recompile autoloads finder-data custom-deps
133 # Update the AUTHORS file.
135 update-authors:
136 $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS $(srcdir)
138 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
139 els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
140 ${ETAGS} $$els
142 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
143 els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
144 ${ETAGS} -o TAGS-LISP $$els
146 .SUFFIXES: .elc .el
148 .el.elc: $(lisp)/subdirs.el
149 -$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
151 # Compile all Lisp files, but don't recompile those that are up to
152 # date. Some files don't actually get compiled because they set the
153 # local variable no-byte-compile.
155 # All .elc files are made writable before compilation in case we
156 # checked out read-only (CVS option -r). Files MUST be compiled one by
157 # one. If we compile several files in a row we can't make sure that
158 # the compilation environment is clean. We also set the load-path of
159 # the Emacs used for compilation to the current directory and its
160 # subdirectories, to make sure require's and load's in the files being
161 # compiled find the right files.
163 # `|| true' below prevents old Bash versions from getting confused
164 # by an error.
165 compile: $(lisp)/subdirs.el mh-autoloads doit
166 find $(lisp) -name "*.elc" -print | xargs chmod +w >/dev/null 2>&1 || true; \
167 wd=$(lisp); $(setwins); \
168 els=`echo $$wins | tr ' \011' '\012\012' | \
169 sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
170 for el in $(COMPILE_FIRST) $$els; do \
171 if test -f $$el; \
172 then \
173 echo Compiling $$el; \
174 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el || exit 1; \
175 fi \
176 done
178 # Compile all Lisp files. This is like `compile' but compiles files
179 # unconditionally. Some files don't actually get compiled because they
180 # set the local variable no-byte-compile.
182 compile-always: $(lisp)/subdirs.el mh-autoloads doit
183 # `|| true' prevents old Bash versions from getting confused
184 # by an error.
185 find $(lisp) -name "*.elc" -print | xargs chmod +w >/dev/null 2>&1 || true; \
186 wd=$(lisp); $(setwins); \
187 els=`echo $$wins | tr ' \011' '\012\012' | \
188 sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
189 for el in $(COMPILE_FIRST) $$els; do \
190 if test -f $$el; \
191 then \
192 echo Compiling $$el; \
193 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
194 fi \
195 done
197 compile-calc:
198 for el in `find $(lisp)/calc -name '*.el'`; do \
199 echo Compiling $$el; \
200 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
201 done
203 # Backup compiled Lisp files in elc.tar.gz. If that file already
204 # exists, make a backup of it.
206 backup-compiled-files:
207 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
208 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
210 # Compile Lisp files, but save old compiled files first.
212 compile-after-backup: backup-compiled-files compile-always
214 # Recompile all Lisp files which are newer than their .elc files and compile
215 # new ones.
217 recompile: doit mh-autoloads $(lisp)/progmodes/cc-mode.elc
218 $(emacs) --eval "(batch-byte-recompile-directory 0)" $(lisp)
220 # CC Mode uses a compile time macro system which causes a compile time
221 # dependency in cc-mode.elc on the macros in cc-langs.el and the
222 # version string in cc-defs.el.
223 $(lisp)/progmodes/cc-mode.elc: \
224 $(lisp)/progmodes/cc-mode.el \
225 $(lisp)/progmodes/cc-langs.el \
226 $(lisp)/progmodes/cc-defs.el
227 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el
229 # Update MH-E internal autoloads. These are not to be confused with
230 # the autoloads for the MH-E entry points, which are already in loaddefs.el.
231 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
232 $(lisp)/mh-e/mh-loaddefs.el: $(lisp)/subdirs.el
233 ## The only non-standard part of this is the provide.
234 ## All these echos can be removed if mh-e.el changes to use
235 ## (load "mh-loaddefs" nil 'quiet).
236 echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
237 echo ";;" >> $@
238 echo ";;; Code:" >> $@
239 echo "\f" >> $@
240 echo "(provide 'mh-loaddefs)" >> $@
241 echo ";; Local Variables:" >> $@
242 echo ";; version-control: never" >> $@
243 echo ";; no-byte-compile: t" >> $@
244 echo ";; no-update-autoloads: t" >> $@
245 echo ";; End:" >> $@
246 echo ";;; mh-loaddefs.el ends here" >> $@
247 $(emacs) -l autoload \
248 --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
249 --eval "(setq generated-autoload-file \"$@\")" \
250 --eval "(setq make-backup-files nil)" \
251 -f batch-update-autoloads $(lisp)/mh-e
253 $(lisp)/calendar/cal-loaddefs.el:
254 $(emacs) -l autoload \
255 --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
256 --eval "(setq generated-autoload-file \"$@\")" \
257 --eval "(setq make-backup-files nil)" \
258 -f batch-update-autoloads $(lisp)/calendar
260 $(lisp)/calendar/diary-loaddefs.el:
261 $(emacs) -l autoload \
262 --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \
263 --eval "(setq generated-autoload-file \"$@\")" \
264 --eval "(setq make-backup-files nil)" \
265 -f batch-update-autoloads $(lisp)/calendar
267 $(lisp)/calendar/hol-loaddefs.el:
268 $(emacs) -l autoload \
269 --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \
270 --eval "(setq generated-autoload-file \"$@\")" \
271 --eval "(setq make-backup-files nil)" \
272 -f batch-update-autoloads $(lisp)/calendar
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.