1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004,
3 # 2005 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 2, or (at your option)
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 the
19 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 # Boston, MA 02110-1301, USA.
33 # You can specify a different executable on the make command line,
34 # e.g. "make EMACS=../src/emacs ...".
36 EMACS = "$(THISDIR)/../bin/emacs.exe"
38 # Command line flags for Emacs. This must include --multibyte,
39 # otherwise some files will not compile.
41 EMACSOPT = -batch --no-init-file --no-site-file --multibyte
43 # Set EMACSLOADPATH correctly (already defined in environment).
46 lisptagsfiles1 = $(lisp)/*.el
47 lisptagsfiles2 = $(lisp)/*/*.el
48 ETAGS = "../lib-src/$(BLD)/etags"
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
57 $(lisp)/emacs-lisp/byte-opt.el \
58 $(lisp)/emacs-lisp/bytecomp.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 = $(EMACS) $(EMACSOPT)
67 # Common command to find subdirectories
69 setwins=subdirs=`find $$wd -type d -print`; \
70 for file in $$subdirs; do \
71 case $$file in */Old | */RCS | */CVS | */CVS/* | */=* ) ;; \
72 *) wins="$$wins $$file" ;; \
76 # Have to define the list of subdirs manually when not using sh.
101 custom-deps: cus-load.el doit
102 @echo Directories: $(WINS)
103 -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS)
106 @echo Directories: $(WINS)
107 $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS)
110 $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
111 cp loaddefs.el-$(SHELLTYPE) $@
112 rm loaddefs.el-$(SHELLTYPE)
115 echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
116 echo ";;" >> $@; echo ";;; Code:" >> $@
117 echo "(autoload 'define-minor-mode \"easy-mmode\")" >>$@
118 echo "(autoload 'define-ccl-program \"ccl\")" >>$@
119 echo "(autoload 'regexp-opt \"regexp-opt\")" >>$@
120 echo "(autoload 'string-to-list \"mule-util\")" >>$@
121 echo "(autoload 'define-derived-mode \"derived\")" >>$@
122 echo "(autoload 'encoded-kbd-mode \"encoded-kb\")" >>$@
123 echo "(defvar cvs-global-menu nil)" >>$@
125 echo ";;; Local Variables:" >> $@
126 echo ";;; version-control: never" >> $@
127 echo ";;; no-byte-compile: t" >> $@
128 echo ";;; no-update-autoloads: t" >> $@
129 echo ";;; End:" >> $@
130 echo ";;; loaddefs.el ends here" >> $@
133 echo ;;; loaddefs.el --- automatically extracted autoloads> $@
135 echo (autoload 'define-minor-mode "easy-mmode")>> $@
136 echo (autoload 'define-ccl-program "ccl")>> $@
137 echo (autoload 'regexp-opt "regexp-opt")>> $@
138 echo (autoload 'string-to-list "mule-util")>> $@
139 echo (autoload 'define-derived-mode "derived")>> $@
140 echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@
141 echo (defvar cvs-global-menu nil)>> $@
143 echo ;;; Local Variables:>> $@
144 echo ;;; version-control: never>> $@
145 echo ;;; no-byte-compile: t>> $@
146 echo ;;; no-update-autoloads: t>> $@
148 echo ;;; loaddefs.el ends here>> $@
150 autoloads: loaddefs.el doit
151 @echo Directories: $(WINS)
152 $(emacs) -l autoload \
153 --eval $(ARGQUOTE)(setq find-file-hook nil \
154 find-file-suppress-same-file-warnings t \
155 generated-autoload-file \
156 $(DQUOTE)$(lisp)/loaddefs.el$(DQUOTE))$(ARGQUOTE) \
157 -f batch-update-autoloads $(lisp) $(WINS)
160 $(MAKE) $(MFLAGS) update-subdirs
162 # Need separate version for sh and native cmd.exe
163 update-subdirs: update-subdirs-$(SHELLTYPE)
165 update-subdirs-CMD: doit
166 echo ;; -*- no-byte-compile: t -*->subdirs.el
167 echo ;; In load-path, after this directory should come>> subdirs.el
168 echo ;; certain of its subdirectories. Here we specify them.>> subdirs.el
169 echo (normal-top-level-add-to-load-path $(SQUOTE)(>> subdirs.el
170 @for %%d in ($(WINS)) do if not (%%d)==(term) echo "%%d">> subdirs.el
173 update-subdirs-SH: doit
174 $(srcdir)/update-subdirs $(lisp); \
175 for file in $(WINS); do \
176 $(srcdir)/update-subdirs $$file; \
179 updates: update-subdirs autoloads finder-data custom-deps
181 # Update the AUTHORS file.
184 $(emacs) -l authors -f batch-update-authors $(srcdir)/AUTHORS $(srcdir)
186 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
187 $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
189 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
190 $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
195 -$(emacs) -f batch-byte-compile $<
197 # Compile all Lisp files, but don't recompile those that are up to
198 # date. Some files don't actually get compiled because they set the
199 # local variable no-byte-compile.
201 # All .elc files are made writable before compilation in case we
202 # checked out read-only (CVS option -r). Files MUST be compiled one by
203 # one. If we compile several files in a row we can't make sure that
204 # the compilation environment is clean. We also set the load-path of
205 # the Emacs used for compilation to the current directory and its
206 # subdirectories, to make sure require's and load's in the files being
207 # compiled find the right files.
209 # Need separate version for sh and native cmd.exe
210 compile: subdirs.el compile-$(SHELLTYPE) doit
213 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
214 for %%f in ($(COMPILE_FIRST)) do \
215 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f
216 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \
217 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f/%%g
220 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
221 for el in $(COMPILE_FIRST); do \
222 echo Compiling $$el; \
223 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
225 for dir in $(lisp) $(WINS); do \
226 for el in $$dir/*.el; do \
229 echo Compiling $$el; \
230 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
235 # Compile all Lisp files. This is like `compile' but compiles files
236 # unconditionally. Some files don't actually get compiled because they
237 # set the local variable no-byte-compile.
239 compile-always: subdirs.el compile-always-$(SHELLTYPE) doit
242 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
243 for %%f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %%f
244 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) -f batch-byte-compile %%f/%%g
247 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
248 for el in $(COMPILE_FIRST); do \
249 echo Compiling $$el; \
250 $(emacs) -f batch-byte-compile $$el || exit 1; \
252 for dir in $(lisp) $(WINS); do \
253 for el in $$dir/*.el; do \
254 echo Compiling $$el; \
255 $(emacs) -f batch-byte-compile $$el || exit 1; \
259 compile-calc: compile-calc-$(SHELLTYPE)
262 for %%f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %%f
265 for el in $(lisp)/calc/*.el; do \
266 echo Compiling $$el; \
267 $(emacs) -f batch-byte-compile $$el || exit 1; \
270 # Backup compiled Lisp files in elc.tar.gz. If that file already
271 # exists, make a backup of it.
273 backup-compiled-files:
274 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
275 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
277 # Compile Lisp files, but save old compiled files first.
279 compile-after-backup: backup-compiled-files compile-always
281 # Recompile all Lisp files which are newer than their .elc files.
282 # Note that this doesn't create .elc files. It only recompiles if an
286 $(emacs) -f batch-byte-recompile-directory $(lisp)
288 # Prepare a bootstrap in the lisp subdirectory.
290 # Build loaddefs.el to make sure it's up-to-date. If it's not, that
291 # might lead to errors during the bootstrap because something fails to
292 # autoload as expected. If there is no emacs binary, then we can't
293 # build autoloads yet. In that case we have to use ldefs-boot.el;
294 # bootstrap should always work with ldefs-boot.el. (Because
295 # loaddefs.el is an automatically generated file, we don't want to
296 # store it in the source repository).
298 # Remove compiled Lisp files so that bootstrap-emacs will be built from
301 # Need separate version for sh and native cmd.exe
302 bootstrap-clean: bootstrap-clean-$(SHELLTYPE) loaddefs.el
305 # if exist $(EMACS) $(MAKE) $(MFLAGS) autoloads
306 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
307 -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
310 # if test -f $(EMACS); then $(MAKE) $(MFLAGS) autoloads; fi
311 # -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
312 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
313 -for dir in . $(WINS); do rm -f $$dir/*.elc; done
315 # Generate/update files for the bootstrap process.
316 # When done, remove bootstrap-emacs from ../bin, so that
317 # it will not be mistaken for an installed binary.
319 bootstrap: update-subdirs autoloads compile finder-data custom-deps
323 # Assuming INSTALL_DIR is defined, copy the elisp files to it
324 # Windows 95 makes this harder than it should be.
327 - mkdir "$(INSTALL_DIR)/lisp"
328 - $(DEL) ../same-dir.tst
329 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
330 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
331 #ifdef COPY_LISP_SOURCE
332 $(IFNOTSAMEDIR) $(CP_DIR) . "$(INSTALL_DIR)/lisp" $(ENDIF)
334 # $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
335 # $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
336 # $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
337 # $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
338 # $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
339 # $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
340 # $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
341 # $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
342 # $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
343 # $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
344 # $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
346 - $(DEL) ../same-dir.tst
347 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"