1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004,
3 # 2005, 2006, 2007, 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)
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 # Extra flags to pass to the byte compiler
44 BYTE_COMPILE_EXTRA_FLAGS =
45 # For example to not display the undefined function warnings you can use this:
46 # BYTE_COMPILE_EXTRA_FLAGS = --eval '(setq byte-compile-warnings (quote (not unresolved)))'
47 # The example above is just for developers, it should not be used by default.
49 # Set EMACSLOADPATH correctly (already defined in environment).
55 lisptagsfiles1 = $(lisp)/*.el
56 lisptagsfiles2 = $(lisp)/*/*.el
57 ETAGS = "../lib-src/$(BLD)/etags"
59 # Automatically generated autoload files, apart from lisp/loaddefs.el.
60 LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \
61 $(lisp)/calendar/diary-loaddefs.el $(lisp)/calendar/hol-loaddefs.el
63 # Files to compile before others during a bootstrap. This is done to
64 # speed up the bootstrap process. The CC files are compiled first
65 # because CC mode tweaks the compilation process, and requiring
66 # cc-mode when it is not compiled doesn't work during the
70 $(lisp)/emacs-lisp/byte-opt.el \
71 $(lisp)/emacs-lisp/bytecomp.el \
73 $(lisp)/progmodes/cc-mode.el \
74 $(lisp)/progmodes/cc-vars.el
76 # The actual Emacs command run in the targets below.
77 # The quotes around $(EMACS) are here because the user could type
78 # it with forward slashes and without quotes, which will fail if
79 # the shell is cmd.exe.
81 emacs = "$(EMACS)" $(EMACSOPT)
83 # Have to define the list of subdirs manually when not using sh.
104 WINS= $(WINS_ALMOST) \
112 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
113 # this can break with GNU Make 3.81 and later if sh.exe is used.
114 custom-deps: $(lisp)/cus-load.el $(lisp)/loaddefs.el doit
115 @echo Directories: $(WINS_ALMOST)
116 -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS_ALMOST)
118 finder-data: $(lisp)/loaddefs.el doit
119 @echo Directories: $(WINS_ALMOST)
120 $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS_ALMOST)
123 $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
124 cp loaddefs.el-$(SHELLTYPE) $@
125 rm loaddefs.el-$(SHELLTYPE)
128 echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
129 echo ";;" >> $@; echo ";;; Code:" >> $@
130 echo "(autoload 'define-minor-mode \"easy-mmode\")" >>$@
131 echo "(autoload 'define-ccl-program \"ccl\")" >>$@
132 echo "(autoload 'regexp-opt \"regexp-opt\")" >>$@
133 echo "(autoload 'string-to-list \"mule-util\")" >>$@
134 echo "(autoload 'define-derived-mode \"derived\")" >>$@
135 echo "(autoload 'encoded-kbd-mode \"encoded-kb\")" >>$@
136 echo "(defvar cvs-global-menu nil)" >>$@
138 echo ";;; Local Variables:" >> $@
139 echo ";;; version-control: never" >> $@
140 echo ";;; no-byte-compile: t" >> $@
141 echo ";;; no-update-autoloads: t" >> $@
142 echo ";;; End:" >> $@
143 echo ";;; loaddefs.el ends here" >> $@
146 echo ;;; loaddefs.el --- automatically extracted autoloads> $@
148 echo (autoload 'define-minor-mode "easy-mmode")>> $@
149 echo (autoload 'define-ccl-program "ccl")>> $@
150 echo (autoload 'regexp-opt "regexp-opt")>> $@
151 echo (autoload 'string-to-list "mule-util")>> $@
152 echo (autoload 'define-derived-mode "derived")>> $@
153 echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@
154 echo (defvar cvs-global-menu nil)>> $@
156 echo ;;; Local Variables:>> $@
157 echo ;;; version-control: never>> $@
158 echo ;;; no-byte-compile: t>> $@
159 echo ;;; no-update-autoloads: t>> $@
161 echo ;;; loaddefs.el ends here>> $@
163 # Use . instead of $(lisp) because $(lisp) is an absolute file name,
164 # including a drive letter and any leading directories, so the generated
165 # loaddefs.el will mention file names that on other machine reference
166 # possibly non-existent directories.
168 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
169 # this can break with GNU Make 3.81 and later if sh.exe is used.
170 autoloads: $(lisp)/loaddefs.el $(LOADDEFS) doit
171 @echo Directories: . $(WINS_ALMOST)
172 $(emacs) -l autoload \
173 --eval $(ARGQUOTE)(setq find-file-hook nil find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
174 -f w32-batch-update-autoloads "$(lisp)/loaddefs.el" . $(WINS_ALMOST)
177 $(MAKE) $(MFLAGS) update-subdirs
179 # Need separate version for sh and native cmd.exe
180 update-subdirs: update-subdirs-$(SHELLTYPE)
182 update-subdirs-CMD: doit
183 echo ;; -*- no-byte-compile: t -*-> $(lisp)/subdirs.el
184 echo ;; In load-path, after this directory should come>> $(lisp)/subdirs.el
185 echo ;; certain of its subdirectories. Here we specify them.>> $(lisp)/subdirs.el
186 echo (normal-top-level-add-to-load-path $(SQUOTE)(>> $(lisp)/subdirs.el
187 @for %%d in ($(WINS)) do if not (%%d)==(term) echo "%%d">> $(lisp)/subdirs.el
188 echo ))>> $(lisp)/subdirs.el
190 update-subdirs-SH: doit
191 $(srcdir)/update-subdirs $(lisp); \
192 for file in $(WINS); do \
193 $(srcdir)/update-subdirs $$file; \
196 updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
198 # This is useful after "cvs up".
199 cvs-update: recompile autoloads finder-data custom-deps
201 # Update the AUTHORS file.
204 $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS $(srcdir)
206 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
207 $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
209 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
210 $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
215 -$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
217 # Compile all Lisp files, but don't recompile those that are up to
218 # date. Some files don't actually get compiled because they set the
219 # local variable no-byte-compile.
221 # All .elc files are made writable before compilation in case we
222 # checked out read-only (CVS option -r). Files MUST be compiled one by
223 # one. If we compile several files in a row we can't make sure that
224 # the compilation environment is clean. We also set the load-path of
225 # the Emacs used for compilation to the current directory and its
226 # subdirectories, to make sure require's and load's in the files being
227 # compiled find the right files.
229 # Need separate version for sh and native cmd.exe
230 compile: $(lisp)/subdirs.el mh-autoloads compile-$(SHELLTYPE) doit
233 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
234 for %%f in ($(COMPILE_FIRST)) do \
235 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done %%f
236 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \
237 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done %%f/%%g
240 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
241 for el in $(COMPILE_FIRST); do \
242 echo Compiling $$el; \
243 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el; \
245 for dir in $(lisp) $(WINS); do \
246 for el in $$dir/*.el; do \
249 echo Compiling $$el; \
250 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el; \
255 # Compile all Lisp files. This is like `compile' but compiles files
256 # unconditionally. Some files don't actually get compiled because they
257 # set the local variable no-byte-compile.
259 compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
262 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
263 for %%f in ($(COMPILE_FIRST)) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f
264 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f/%%g
267 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
268 for el in $(COMPILE_FIRST); do \
269 echo Compiling $$el; \
270 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
272 for dir in $(lisp) $(WINS); do \
273 for el in $$dir/*.el; do \
274 echo Compiling $$el; \
275 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
279 compile-calc: compile-calc-$(SHELLTYPE)
282 for %%f in ($(lisp)/calc/*.el) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f
285 for el in $(lisp)/calc/*.el; do \
286 echo Compiling $$el; \
287 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
290 # Backup compiled Lisp files in elc.tar.gz. If that file already
291 # exists, make a backup of it.
293 backup-compiled-files:
294 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
295 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
297 # Compile Lisp files, but save old compiled files first.
299 compile-after-backup: backup-compiled-files compile-always
301 # Recompile all Lisp files which are newer than their .elc files.
302 # Note that this doesn't create .elc files. It only recompiles if an
304 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
305 # this can break with GNU Make 3.81 and later if sh.exe is used.
306 recompile: mh-autoloads doit $(lisp)/progmodes/cc-mode.elc
307 $(emacs) --eval $(ARGQUOTE)(batch-byte-recompile-directory 0)$(ARGQUOTE) $(lisp)
309 # CC Mode uses a compile time macro system which causes a compile time
310 # dependency in cc-mode.elc on the macros in cc-langs.el and the
311 # version string in cc-defs.el.
312 $(lisp)/progmodes/cc-mode.elc: \
313 $(lisp)/progmodes/cc-mode.el \
314 $(lisp)/progmodes/cc-langs.el \
315 $(lisp)/progmodes/cc-defs.el
316 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el
318 $(lisp)/calendar/cal-loaddefs.el:
319 "$(EMACS)" $(EMACSOPT) -l autoload \
320 --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
321 --eval "(setq find-file-suppress-same-file-warnings t)" \
322 --eval "(setq make-backup-files nil)" \
323 -f w32-batch-update-autoloads "$(lisp)/calendar/cal-loaddefs.el" \
326 $(lisp)/calendar/diary-loaddefs.el:
327 "$(EMACS)" $(EMACSOPT) -l autoload \
328 --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \
329 --eval "(setq find-file-suppress-same-file-warnings t)" \
330 --eval "(setq make-backup-files nil)" \
331 -f w32-batch-update-autoloads $(lisp)/calendar/diary-loaddefs.el \
334 $(lisp)/calendar/hol-loaddefs.el:
335 "$(EMACS)" $(EMACSOPT) -l autoload \
336 --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \
337 --eval "(setq find-file-suppress-same-file-warnings t)" \
338 --eval "(setq make-backup-files nil)" \
339 -f w32-batch-update-autoloads $(lisp)/calendar/hol-loaddefs.el \
342 # Update MH-E internal autoloads. These are not to be confused with
343 # the autoloads for the MH-E entry points, which are already in
345 MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \
346 $(lisp)/mh-e/mh-buffers.el $(lisp)/mh-e/mh-compat.el \
347 $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-e.el \
348 $(lisp)/mh-e/mh-folder.el $(lisp)/mh-e/mh-funcs.el \
349 $(lisp)/mh-e/mh-gnus.el $(lisp)/mh-e/mh-identity.el \
350 $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-junk.el \
351 $(lisp)/mh-e/mh-letter.el $(lisp)/mh-e/mh-limit.el \
352 $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-print.el \
353 $(lisp)/mh-e/mh-scan.el $(lisp)/mh-e/mh-search.el \
354 $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-show.el \
355 $(lisp)/mh-e/mh-speed.el $(lisp)/mh-e/mh-thread.el \
356 $(lisp)/mh-e/mh-tool-bar.el $(lisp)/mh-e/mh-utils.el \
357 $(lisp)/mh-e/mh-xface.el
359 # See the commentary for autoloads above for why we use ./mh-e below
360 # instead of $(lisp)/mh-e.
361 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
362 $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC)
363 $(MAKE) $(MFLAGS) pre-mh-loaddefs.el-$(SHELLTYPE)
364 cp pre-mh-loaddefs.el-$(SHELLTYPE) $@
365 rm pre-mh-loaddefs.el-$(SHELLTYPE)
366 "$(EMACS)" $(EMACSOPT) \
368 --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
369 --eval "(setq find-file-suppress-same-file-warnings t)" \
370 --eval "(setq make-backup-files nil)" \
371 -f w32-batch-update-autoloads \
372 "$(lisp)/mh-e/mh-loaddefs.el" ./mh-e
374 pre-mh-loaddefs.el-SH:
375 echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
377 echo ";; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc." >> $@
378 echo ";; Author: Bill Wohler <wohler@newt.com>" >> $@
379 echo ";; Keywords: mail" >> $@
380 echo ";;; Commentary:" >> $@
381 echo ";;; Change Log:" >> $@
382 echo ";;; Code:" >> $@
384 echo "(provide 'mh-loaddefs)" >> $@
385 echo ";; Local Variables:" >> $@
386 echo ";; version-control: never" >> $@
387 echo ";; no-byte-compile: t" >> $@
388 echo ";; no-update-autoloads: t" >> $@
390 echo ";;; mh-loaddefs.el ends here" >> $@
392 pre-mh-loaddefs.el-CMD:
393 echo ;;; mh-loaddefs.el --- automatically extracted autoloads> $@
395 echo ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.>> $@
396 echo ;; Author: Bill Wohler (wohler@newt.com)>> $@
397 echo ;; Keywords: mail>> $@
398 echo ;;; Commentary:>> $@
399 echo ;;; Change Log:>> $@
402 echo (provide 'mh-loaddefs)>> $@
403 echo ;; Local Variables:>> $@
404 echo ;; version-control: never>> $@
405 echo ;; no-byte-compile: t>> $@
406 echo ;; no-update-autoloads: t>> $@
408 echo ;;; mh-loaddefs.el ends here>> $@
410 # Prepare a bootstrap in the lisp subdirectory.
412 # Build loaddefs.el to make sure it's up-to-date. If it's not, that
413 # might lead to errors during the bootstrap because something fails to
414 # autoload as expected. If there is no emacs binary, then we can't
415 # build autoloads yet. In that case we have to use ldefs-boot.el;
416 # bootstrap should always work with ldefs-boot.el. (Because
417 # loaddefs.el is an automatically generated file, we don't want to
418 # store it in the source repository).
420 # Remove compiled Lisp files so that bootstrap-emacs will be built from
423 # Need separate version for sh and native cmd.exe
424 # Note that bootstrap-clean-$(SHELLTYPE) copies ldefs-boot.el to loaddefs.el,
425 # and thus the almost-empty loaddefs.el crafted by the $(lisp)/loaddefs.el
426 # target can NOT be built _after_ bootstrap-clean-$(SHELLTYPE) does its
427 # thing, or else an empty loaddefs.el will overwrite the full one.
428 bootstrap-clean: $(lisp)/loaddefs.el
429 $(MAKE) $(MFLAGS) bootstrap-clean-$(SHELLTYPE)
432 # if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads
433 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
434 -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
437 # if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi
438 # -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
439 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
440 -for dir in . $(WINS); do rm -f $$dir/*.elc; done
442 # Generate/update files for the bootstrap process.
443 # When done, remove bootstrap-emacs from ../bin, so that
444 # it will not be mistaken for an installed binary.
446 bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps
450 # Assuming INSTALL_DIR is defined, copy the elisp files to it
451 # Windows 95 makes this harder than it should be.
454 - mkdir "$(INSTALL_DIR)/lisp"
455 - $(DEL) ../same-dir.tst
456 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
457 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
458 #ifdef COPY_LISP_SOURCE
459 $(IFNOTSAMEDIR) $(MAKE) $(MFLAGS) install-lisp-$(SHELLTYPE) $(ENDIF)
461 # $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
462 # $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
463 # $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
464 # $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
465 # $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
466 # $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
467 # $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
468 # $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
469 # $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
470 # $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
471 # $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
473 - $(DEL) ../same-dir.tst
474 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
476 # Need to copy *.el files first, to avoid "source file is newer" annoyance
477 # since cp does not preserve time stamps
479 cp -f *.el "$(INSTALL_DIR)/lisp"
480 for dir in $(WINS); do [ -d "$(INSTALL_DIR)/lisp/$$dir" ] || mkdir "$(INSTALL_DIR)/lisp/$$dir"; done
481 for dir in $(WINS); do cp -f $$dir/*.el "$(INSTALL_DIR)/lisp/$$dir"; done
482 for dir in . $(WINS); do cp $$dir/*.elc "$(INSTALL_DIR)/lisp/$$dir"; done
485 cp -f *.el "$(INSTALL_DIR)/lisp"
486 for %%f in ($(WINS)) do if not exist "$(INSTALL_DIR)/lisp/%%f" mkdir "$(INSTALL_DIR)/lisp/%%f"
487 for %%f in ($(WINS)) do cp -f %%f/*.el "$(INSTALL_DIR)/lisp/%%f"
488 for %%f in (. $(WINS)) do cp -f %%f/*.elc "$(INSTALL_DIR)/lisp/%%f"
490 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
491 # this can break with GNU Make 3.81 and later if sh.exe is used.
493 $(emacs) -l $(lisp)/emacs-lisp/check-declare --eval $(ARGQUOTE)(check-declare-directory $(DQUOTE)$(lisp)$(DQUOTE))$(ARGQUOTE)
498 # We used to delete *~ here, but that might inadvertently remove
499 # precious files if it happens to match their short 8+3 aliases.