Delete duplicate entry.
[emacs.git] / lisp / Makefile.in
blob081a7f13b4b65d6cb0cb4e34bf536de3257073b9
1 # Maintenance productions for the Lisp directory
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 # This file is part of GNU Emacs.
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.
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.
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.
21 SHELL = /bin/sh
23 lisp=@srcdir@
24 VPATH=@srcdir@
25 srcdir=@srcdir@/..
27 # You can specify a different executable on the make command line,
28 # e.g. "make EMACS=../src/emacs ...".
30 EMACS = ../src/emacs
32 # Command line flags for Emacs. This must include --multibyte,
33 # otherwise some files will not compile.
35 EMACSOPT = -batch --no-site-file --multibyte
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
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
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.
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
63 # The actual Emacs command run in the targets below.
65 emacs = EMACSLOADPATH=$(lisp) $(EMACS) $(EMACSOPT)
67 # Common command to find subdirectories
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
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
83 doit:
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
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
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
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;
120 updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
122 # Update the AUTHORS file.
124 update-authors:
125 $(emacs) -l authors -f batch-update-authors $(srcdir)/AUTHORS $(srcdir)
127 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
128 els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
129 ${ETAGS} $$els
131 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
132 els=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
133 ${ETAGS} -o TAGS-LISP $$els
135 .SUFFIXES: .elc .el
137 .el.elc: $(lisp)/subdirs.el
138 -$(emacs) -f batch-byte-compile $<
140 # Compile all Lisp files, but don't recompile those that are up to
141 # date. Some files don't actually get compiled because they set the
142 # local variable no-byte-compile.
144 # All .elc files are made writable before compilation in case we
145 # checked out read-only (CVS option -r). Files MUST be compiled one by
146 # one. If we compile several files in a row we can't make sure that
147 # the compilation environment is clean. We also set the load-path of
148 # the Emacs used for compilation to the current directory and its
149 # subdirectories, to make sure require's and load's in the files being
150 # compiled find the right files.
152 compile: $(lisp)/subdirs.el mh-autoloads doit
153 find $(lisp) -name "*.elc" -print | xargs chmod +w >/dev/null 2>&1; \
154 wd=$(lisp); $(setwins); \
155 els=`echo $$wins | tr ' \011' '\012\012' | \
156 sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
157 for el in $(COMPILE_FIRST) $$els; do \
158 if test -f $$el; \
159 then \
160 echo Compiling $$el; \
161 $(emacs) -f batch-byte-compile-if-not-done $$el || exit 1; \
162 fi \
163 done
165 # Compile all Lisp files. This is like `compile' but compiles files
166 # unconditionally. Some files don't actually get compiled because they
167 # set the local variable no-byte-compile.
169 compile-always: $(lisp)/subdirs.el doit
170 # `|| true' prevents old Bash versions from getting confused
171 # by an error.
172 find $(lisp) -name "*.elc" -print | xargs chmod +w >/dev/null 2>&1 || true; \
173 wd=$(lisp); $(setwins); \
174 els=`echo $$wins | tr ' \011' '\012\012' | \
175 sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
176 for el in $(COMPILE_FIRST) $$els; do \
177 if test -f $$el; \
178 then \
179 echo Compiling $$el; \
180 $(emacs) -f batch-byte-compile $$el || exit 1; \
181 fi \
182 done
184 compile-calc:
185 for el in `find $(lisp)/calc -name '*.el'`; do \
186 echo Compiling $$el; \
187 $(emacs) -f batch-byte-compile $$el || exit 1; \
188 done
190 # Backup compiled Lisp files in elc.tar.gz. If that file already
191 # exists, make a backup of it.
193 backup-compiled-files:
194 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
195 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
197 # Compile Lisp files, but save old compiled files first.
199 compile-after-backup: backup-compiled-files compile-always
201 # Recompile all Lisp files which are newer than their .elc files.
202 # Note that this doesn't create .elc files. It only recompiles if an
203 # .elc is present.
205 recompile: doit mh-autoloads $(lisp)/progmodes/cc-mode.elc
206 $(EMACS) $(EMACSOPT) --eval "(batch-byte-recompile-directory 0)" $(lisp)
208 # CC Mode uses a compile time macro system which causes a compile time
209 # dependency in cc-mode.elc on the macros in cc-langs.el and the
210 # version string in cc-defs.el.
211 $(lisp)/progmodes/cc-mode.elc: \
212 $(lisp)/progmodes/cc-mode.el \
213 $(lisp)/progmodes/cc-langs.el \
214 $(lisp)/progmodes/cc-defs.el
215 $(EMACS) $(EMACSOPT) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el
217 # Update MH-E internal autoloads. These are not to be confused with
218 # the autoloads for the MH-E entry points, which are already in
219 # loaddefs.el.
220 MH-E-SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \
221 $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-customize.el \
222 $(lisp)/mh-e/mh-e.el $(lisp)/mh-e/mh-funcs.el \
223 $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-pick.el \
224 $(lisp)/mh-e/mh-print.el $(lisp)/mh-e/mh-inc.el \
225 $(lisp)/mh-e/mh-init.el $(lisp)/mh-e/mh-index.el \
226 $(lisp)/mh-e/mh-identity.el $(lisp)/mh-e/mh-junk.el \
227 $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-speed.el \
228 $(lisp)/mh-e/mh-utils.el
230 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
231 $(lisp)/mh-e/mh-loaddefs.el: $(MH-E-SRC)
232 echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
233 echo ";;" >> $@
234 echo ";; Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc." >> $@
235 echo ";; Author: Bill Wohler <wohler@newt.com>" >> $@
236 echo ";; Keywords: mail" >> $@
237 echo ";;; Commentary:" >> $@
238 echo ";;; Code:" >> $@
239 $(EMACS) $(EMACSOPT) \
240 -l autoload \
241 --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
242 --eval "(setq generated-autoload-file \"$(lisp)/mh-e/mh-loaddefs.el\")" \
243 --eval "(setq make-backup-files nil)" \
244 -f batch-update-autoloads $(lisp)/mh-e
245 echo "\f" >> $@
246 echo "(provide 'mh-loaddefs)" >> $@
247 echo ";; Local Variables:" >> $@
248 echo ";; version-control: never" >> $@
249 echo ";; no-byte-compile: t" >> $@
250 echo ";; no-update-autoloads: t" >> $@
251 echo ";; End:" >> $@
252 echo ";;; mh-loaddefs.el ends here" >> $@
254 # Prepare a bootstrap in the lisp subdirectory.
256 # Build loaddefs.el to make sure it's up-to-date. If it's not, that
257 # might lead to errors during the bootstrap because something fails to
258 # autoload as expected. If there is no emacs binary, then we can't
259 # build autoloads yet. In that case we have to use ldefs-boot.el.
260 # Bootstrap should always work with ldefs-boot.el. Therefore,
261 # whenever a new autoload cookie gets added that is necessary during
262 # bootstrapping, ldefs-boot.el should be updated by overwriting it with
263 # an up-to-date copy of loaddefs.el that is uncorrupted by
264 # local changes. (Because loaddefs.el is an automatically generated
265 # file, we don't want to store it in the source repository).
267 bootstrap-prepare:
268 if test -x $(EMACS); then \
269 $(MAKE) $(MFLAGS) autoloads; \
270 else \
271 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el; \
274 maintainer-clean: distclean
275 cd $(lisp); rm -f *.elc */*.elc $(AUTOGENEL)
277 bootstrap-clean:
278 cd $(lisp); rm -f *.elc */*.elc
280 # Generate/update files for the bootstrap process.
282 bootstrap: update-subdirs autoloads mh-autoloads compile
284 # Generate/update files after the bootstrap process.
285 # custom-deps needs `preloaded-file-list'.
287 bootstrap-after: finder-data custom-deps
289 distclean:
290 -rm -f ./Makefile
292 # Makefile ends here.