1 # Maintenance productions for the Lisp directory
2 # Copyright (C) 2000, 2001, 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)
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., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA.
27 # You can specify a different executable on the make command line,
28 # e.g. "make 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 \
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
56 $(lisp
)/emacs-lisp
/byte-opt.el \
57 $(lisp
)/emacs-lisp
/bytecomp.el \
59 $(lisp
)/progmodes
/cc-mode.el \
60 $(lisp
)/progmodes
/cc-vars.el
62 # The actual Emacs command run in the targets below.
64 emacs
= EMACSLOADPATH
=$(lisp
) $(EMACS
) $(EMACSOPT
)
66 # Common command to find subdirectories
68 setwins
=subdirs
=`(cd $$wd; find . -type d -print)`; \
69 for file in
$$subdirs; do \
70 case
$$file in
*/Old |
*/RCS |
*/CVS |
*/CVS
/* |
*/.
* |
*/.
*/* |
*/=* ) ;; \
71 *) wins
="$$wins $$wd/$$file" ;; \
75 setwins_almost
=subdirs
=`(cd $$wd; find . -type d -print)`; \
76 for file in
$$subdirs; do \
77 case
$$file in
*/Old |
*/RCS |
*/CVS |
*/CVS
/* |
*/.
* |
*/.
*/* |
*/=* |
*/obsolete |
*/term
) ;; \
78 *) wins
="$$wins $$wd/$$file" ;; \
86 custom-deps
: $(lisp
)/cus-load.el doit
87 wd
=$(lisp
); $(setwins_almost
); \
88 echo Directories
: $$wins; \
89 $(EMACS
) $(EMACSOPT
) -l cus-dep
--eval
'(setq generated-custom-dependencies-file "$(lisp)/cus-load.el")' -f custom-make-dependencies
$$wins
92 wd
=$(lisp
); $(setwins_almost
); \
93 echo Directories
: $$wins; \
94 $(EMACS
) $(EMACSOPT
) -l finder
--eval
'(setq generated-finder-keywords-file "$(lisp)/finder-inf.el")' -f finder-compile-keywords-make-dist
$$wins
97 echo
";;; loaddefs.el --- automatically extracted autoloads" >> $@
98 echo
";;" >> $@
; echo
";;; Code:" >> $@
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" >> $@
106 autoloads
: $(lisp
)/loaddefs.el doit
107 wd
=$(lisp
); $(setwins
); \
108 echo Directories
: $$wins; \
109 $(EMACS
) $(EMACSOPT
) -l autoload
--eval
'(setq generated-autoload-file "$(lisp)/loaddefs.el")' -f batch-update-autoloads
$$wins
112 $(MAKE
) $(MFLAGS
) update-subdirs
114 wd
=$(lisp
); $(setwins
); \
115 for file in
$$wins; do \
116 $(srcdir)/update-subdirs
$$file; \
119 updates
: update-subdirs autoloads finder-data custom-deps
121 # Update the AUTHORS file.
124 $(emacs
) -l authors
-f batch-update-authors
$(srcdir)/AUTHORS
$(srcdir)
126 TAGS
: $(lisptagsfiles1
) $(lisptagsfiles2
)
127 els
=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
130 TAGS-LISP
: $(lisptagsfiles1
) $(lisptagsfiles2
)
131 els
=`echo $(lisptagsfiles1) $(lisptagsfiles2) | sed -e "s,$(lisp)/loaddefs[^ ]*,," -e "s,$(lisp)/ldefs-boot[^ ]*,,"`; \
132 ${ETAGS} -o TAGS-LISP
$$els
136 .el.elc
: $(lisp
)/subdirs.el
137 -$(emacs
) -f batch-byte-compile
$<
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.
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.
151 compile
: $(lisp
)/subdirs.el doit
152 find
$(lisp
) -name
"*.elc" -print | xargs chmod
+w
>/dev
/null
2>&1; \
153 wd
=$(lisp
); $(setwins
); \
154 els
=`echo $$wins | tr ' \011' '\012\012' | \
155 sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
156 for el in
$(COMPILE_FIRST
) $$els; do \
159 echo Compiling
$$el; \
160 $(emacs
) -f batch-byte-compile-if-not-done
$$el || exit
1; \
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.
168 compile-always
: $(lisp
)/subdirs.el doit
169 # `|| true' prevents old Bash versions from getting confused
171 find
$(lisp
) -name
"*.elc" -print | xargs chmod
+w
>/dev
/null
2>&1 || true
; \
172 wd
=$(lisp
); $(setwins
); \
173 els
=`echo $$wins | tr ' \011' '\012\012' | \
174 sed -e 's|\(.\)$$|\1/|' -e 's|^\./||' -e 's|$$|*.el|'`; \
175 for el in
$(COMPILE_FIRST
) $$els; do \
178 echo Compiling
$$el; \
179 $(emacs
) -f batch-byte-compile
$$el || exit
1; \
184 for el in
`find $(lisp)/calc -name '*.el'`; do \
185 echo Compiling
$$el; \
186 $(emacs
) -f batch-byte-compile
$$el || exit
1; \
189 # Backup compiled Lisp files in elc.tar.gz. If that file already
190 # exists, make a backup of it.
192 backup-compiled-files
:
193 -mv
$(lisp
)/elc.
tar.gz
$(lisp
)/elc.
tar.gz~
194 -tar czf
$(lisp
)/elc.
tar.gz
$(lisp
)/*.elc
$(lisp
)/*/*.elc
196 # Compile Lisp files, but save old compiled files first.
198 compile-after-backup
: backup-compiled-files compile-always
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
204 recompile
: doit
$(lisp
)/progmodes
/cc-mode.elc
205 $(EMACS
) $(EMACSOPT
) --eval
"(batch-byte-recompile-directory 0)" $(lisp
)
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.
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
216 # Prepare a bootstrap in the lisp subdirectory.
218 # Build loaddefs.el, because it's not sure it's up-to-date, and if it's not,
219 # that might lead to errors during the bootstrap because something fails to
220 # autoload as expected. However, if there is no emacs binary, then we can't
221 # build autoloads yet, so just make sure there's some loaddefs.el file, as
222 # it's necessary for generating the binary (because loaddefs.el is an
223 # automatically generated file, we don't want to store it in the source
227 if
test -x
$(EMACS
); then \
228 $(MAKE
) $(MFLAGS
) autoloads
; \
230 if
test ! -r
$(lisp
)/loaddefs.el
; then \
231 cp
$(lisp
)/ldefs-boot.el
$(lisp
)/loaddefs.el
; \
235 maintainer-clean
: distclean
236 cd
$(lisp
); rm -f
*.elc
*/*.elc
$(AUTOGENEL
)
239 cd
$(lisp
); rm -f
*.elc
*/*.elc
241 # Generate/update files for the bootstrap process.
243 bootstrap
: update-subdirs autoloads compile
245 # Generate/update files after the bootstrap process.
246 # custom-deps needs `preloaded-file-list'.
248 bootstrap-after
: finder-data custom-deps
253 # Makefile ends here.