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.
103 WINS= $(WINS_ALMOST) \
111 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
112 # this can break with GNU Make 3.81 and later if sh.exe is used.
113 custom-deps: $(lisp)/cus-load.el $(lisp)/loaddefs.el doit
114 @echo Directories: $(WINS_ALMOST)
115 -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS_ALMOST)
117 finder-data: $(lisp)/loaddefs.el doit
118 @echo Directories: $(WINS_ALMOST)
119 $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS_ALMOST)
122 $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
123 cp loaddefs.el-$(SHELLTYPE) $@
124 rm loaddefs.el-$(SHELLTYPE)
127 echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
128 echo ";;" >> $@; echo ";;; Code:" >> $@
129 echo "(autoload 'define-minor-mode \"easy-mmode\")" >>$@
130 echo "(autoload 'define-ccl-program \"ccl\")" >>$@
131 echo "(autoload 'regexp-opt \"regexp-opt\")" >>$@
132 echo "(autoload 'string-to-list \"mule-util\")" >>$@
133 echo "(autoload 'define-derived-mode \"derived\")" >>$@
134 echo "(autoload 'encoded-kbd-mode \"encoded-kb\")" >>$@
135 echo "(defvar cvs-global-menu nil)" >>$@
137 echo ";;; Local Variables:" >> $@
138 echo ";;; version-control: never" >> $@
139 echo ";;; no-byte-compile: t" >> $@
140 echo ";;; no-update-autoloads: t" >> $@
141 echo ";;; End:" >> $@
142 echo ";;; loaddefs.el ends here" >> $@
145 echo ;;; loaddefs.el --- automatically extracted autoloads> $@
147 echo (autoload 'define-minor-mode "easy-mmode")>> $@
148 echo (autoload 'define-ccl-program "ccl")>> $@
149 echo (autoload 'regexp-opt "regexp-opt")>> $@
150 echo (autoload 'string-to-list "mule-util")>> $@
151 echo (autoload 'define-derived-mode "derived")>> $@
152 echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@
153 echo (defvar cvs-global-menu nil)>> $@
155 echo ;;; Local Variables:>> $@
156 echo ;;; version-control: never>> $@
157 echo ;;; no-byte-compile: t>> $@
158 echo ;;; no-update-autoloads: t>> $@
160 echo ;;; loaddefs.el ends here>> $@
162 # Use . instead of $(lisp) because $(lisp) is an absolute file name,
163 # including a drive letter and any leading directories, so the generated
164 # loaddefs.el will mention file names that on other machine reference
165 # possibly non-existent directories.
167 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
168 # this can break with GNU Make 3.81 and later if sh.exe is used.
169 autoloads: $(lisp)/loaddefs.el $(LOADDEFS) doit
170 @echo Directories: . $(WINS_ALMOST)
171 $(emacs) -l autoload \
172 --eval $(ARGQUOTE)(setq find-file-hook nil find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
173 -f w32-batch-update-autoloads "$(lisp)/loaddefs.el" . $(WINS_ALMOST)
176 $(MAKE) $(MFLAGS) update-subdirs
178 # Need separate version for sh and native cmd.exe
179 update-subdirs: update-subdirs-$(SHELLTYPE)
181 update-subdirs-CMD: doit
182 echo ;; -*- no-byte-compile: t -*-> $(lisp)/subdirs.el
183 echo ;; In load-path, after this directory should come>> $(lisp)/subdirs.el
184 echo ;; certain of its subdirectories. Here we specify them.>> $(lisp)/subdirs.el
185 echo (normal-top-level-add-to-load-path $(SQUOTE)(>> $(lisp)/subdirs.el
186 @for %%d in ($(WINS)) do if not (%%d)==(term) echo "%%d">> $(lisp)/subdirs.el
187 echo ))>> $(lisp)/subdirs.el
189 update-subdirs-SH: doit
190 $(srcdir)/update-subdirs $(lisp); \
191 for file in $(WINS); do \
192 $(srcdir)/update-subdirs $$file; \
195 updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
197 # This is useful after "cvs up".
198 cvs-update: recompile autoloads finder-data custom-deps
200 # Update the AUTHORS file.
203 $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS $(srcdir)
205 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
206 $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
208 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
209 $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
214 -$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
216 # Compile all Lisp files, but don't recompile those that are up to
217 # date. Some files don't actually get compiled because they set the
218 # local variable no-byte-compile.
220 # All .elc files are made writable before compilation in case we
221 # checked out read-only (CVS option -r). Files MUST be compiled one by
222 # one. If we compile several files in a row we can't make sure that
223 # the compilation environment is clean. We also set the load-path of
224 # the Emacs used for compilation to the current directory and its
225 # subdirectories, to make sure require's and load's in the files being
226 # compiled find the right files.
228 # Need separate version for sh and native cmd.exe
229 compile: $(lisp)/subdirs.el mh-autoloads compile-$(SHELLTYPE) doit
232 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
233 for %%f in ($(COMPILE_FIRST)) do \
234 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done %%f
235 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \
236 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done %%f/%%g
239 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
240 for el in $(COMPILE_FIRST); do \
241 echo Compiling $$el; \
242 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el; \
244 for dir in $(lisp) $(WINS); do \
245 for el in $$dir/*.el; do \
248 echo Compiling $$el; \
249 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el; \
254 # Compile all Lisp files. This is like `compile' but compiles files
255 # unconditionally. Some files don't actually get compiled because they
256 # set the local variable no-byte-compile.
258 compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
261 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
262 for %%f in ($(COMPILE_FIRST)) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f
263 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f/%%g
266 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
267 for el in $(COMPILE_FIRST); do \
268 echo Compiling $$el; \
269 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
271 for dir in $(lisp) $(WINS); do \
272 for el in $$dir/*.el; do \
273 echo Compiling $$el; \
274 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
278 compile-calc: compile-calc-$(SHELLTYPE)
281 for %%f in ($(lisp)/calc/*.el) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f
284 for el in $(lisp)/calc/*.el; do \
285 echo Compiling $$el; \
286 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
289 # Backup compiled Lisp files in elc.tar.gz. If that file already
290 # exists, make a backup of it.
292 backup-compiled-files:
293 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
294 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
296 # Compile Lisp files, but save old compiled files first.
298 compile-after-backup: backup-compiled-files compile-always
300 # Recompile all Lisp files which are newer than their .elc files.
301 # Note that this doesn't create .elc files. It only recompiles if an
303 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
304 # this can break with GNU Make 3.81 and later if sh.exe is used.
305 recompile: mh-autoloads doit $(lisp)/progmodes/cc-mode.elc
306 $(emacs) --eval $(ARGQUOTE)(batch-byte-recompile-directory 0)$(ARGQUOTE) $(lisp)
308 # CC Mode uses a compile time macro system which causes a compile time
309 # dependency in cc-mode.elc on the macros in cc-langs.el and the
310 # version string in cc-defs.el.
311 $(lisp)/progmodes/cc-mode.elc: \
312 $(lisp)/progmodes/cc-mode.el \
313 $(lisp)/progmodes/cc-langs.el \
314 $(lisp)/progmodes/cc-defs.el
315 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el
317 $(lisp)/calendar/cal-loaddefs.el:
318 "$(EMACS)" $(EMACSOPT) -l autoload \
319 --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
320 --eval "(setq find-file-suppress-same-file-warnings t)" \
321 --eval "(setq make-backup-files nil)" \
322 -f w32-batch-update-autoloads "$(lisp)/calendar/cal-loaddefs.el" \
325 $(lisp)/calendar/diary-loaddefs.el:
326 "$(EMACS)" $(EMACSOPT) -l autoload \
327 --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \
328 --eval "(setq find-file-suppress-same-file-warnings t)" \
329 --eval "(setq make-backup-files nil)" \
330 -f w32-batch-update-autoloads $(lisp)/calendar/diary-loaddefs.el \
333 $(lisp)/calendar/hol-loaddefs.el:
334 "$(EMACS)" $(EMACSOPT) -l autoload \
335 --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \
336 --eval "(setq find-file-suppress-same-file-warnings t)" \
337 --eval "(setq make-backup-files nil)" \
338 -f w32-batch-update-autoloads $(lisp)/calendar/hol-loaddefs.el \
341 # Update MH-E internal autoloads. These are not to be confused with
342 # the autoloads for the MH-E entry points, which are already in
344 MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \
345 $(lisp)/mh-e/mh-buffers.el $(lisp)/mh-e/mh-compat.el \
346 $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-e.el \
347 $(lisp)/mh-e/mh-folder.el $(lisp)/mh-e/mh-funcs.el \
348 $(lisp)/mh-e/mh-gnus.el $(lisp)/mh-e/mh-identity.el \
349 $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-junk.el \
350 $(lisp)/mh-e/mh-letter.el $(lisp)/mh-e/mh-limit.el \
351 $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-print.el \
352 $(lisp)/mh-e/mh-scan.el $(lisp)/mh-e/mh-search.el \
353 $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-show.el \
354 $(lisp)/mh-e/mh-speed.el $(lisp)/mh-e/mh-thread.el \
355 $(lisp)/mh-e/mh-tool-bar.el $(lisp)/mh-e/mh-utils.el \
356 $(lisp)/mh-e/mh-xface.el
358 # See the commentary for autoloads above for why we use ./mh-e below
359 # instead of $(lisp)/mh-e.
360 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
361 $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC)
362 $(MAKE) $(MFLAGS) pre-mh-loaddefs.el-$(SHELLTYPE)
363 cp pre-mh-loaddefs.el-$(SHELLTYPE) $@
364 rm pre-mh-loaddefs.el-$(SHELLTYPE)
365 "$(EMACS)" $(EMACSOPT) \
367 --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
368 --eval "(setq find-file-suppress-same-file-warnings t)" \
369 --eval "(setq make-backup-files nil)" \
370 -f w32-batch-update-autoloads \
371 "$(lisp)/mh-e/mh-loaddefs.el" ./mh-e
373 pre-mh-loaddefs.el-SH:
374 echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
376 echo ";; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc." >> $@
377 echo ";; Author: Bill Wohler <wohler@newt.com>" >> $@
378 echo ";; Keywords: mail" >> $@
379 echo ";;; Commentary:" >> $@
380 echo ";;; Change Log:" >> $@
381 echo ";;; Code:" >> $@
383 echo "(provide 'mh-loaddefs)" >> $@
384 echo ";; Local Variables:" >> $@
385 echo ";; version-control: never" >> $@
386 echo ";; no-byte-compile: t" >> $@
387 echo ";; no-update-autoloads: t" >> $@
389 echo ";;; mh-loaddefs.el ends here" >> $@
391 pre-mh-loaddefs.el-CMD:
392 echo ;;; mh-loaddefs.el --- automatically extracted autoloads> $@
394 echo ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.>> $@
395 echo ;; Author: Bill Wohler (wohler@newt.com)>> $@
396 echo ;; Keywords: mail>> $@
397 echo ;;; Commentary:>> $@
398 echo ;;; Change Log:>> $@
401 echo (provide 'mh-loaddefs)>> $@
402 echo ;; Local Variables:>> $@
403 echo ;; version-control: never>> $@
404 echo ;; no-byte-compile: t>> $@
405 echo ;; no-update-autoloads: t>> $@
407 echo ;;; mh-loaddefs.el ends here>> $@
409 # Prepare a bootstrap in the lisp subdirectory.
411 # Build loaddefs.el to make sure it's up-to-date. If it's not, that
412 # might lead to errors during the bootstrap because something fails to
413 # autoload as expected. If there is no emacs binary, then we can't
414 # build autoloads yet. In that case we have to use ldefs-boot.el;
415 # bootstrap should always work with ldefs-boot.el. (Because
416 # loaddefs.el is an automatically generated file, we don't want to
417 # store it in the source repository).
419 # Remove compiled Lisp files so that bootstrap-emacs will be built from
422 # Need separate version for sh and native cmd.exe
423 # Note that bootstrap-clean-$(SHELLTYPE) copies ldefs-boot.el to loaddefs.el,
424 # and thus the almost-empty loaddefs.el crafted by the $(lisp)/loaddefs.el
425 # target can NOT be built _after_ bootstrap-clean-$(SHELLTYPE) does its
426 # thing, or else an empty loaddefs.el will overwrite the full one.
427 bootstrap-clean: $(lisp)/loaddefs.el
428 $(MAKE) $(MFLAGS) bootstrap-clean-$(SHELLTYPE)
431 # if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads
432 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
433 -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
436 # if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi
437 # -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
438 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
439 -for dir in . $(WINS); do rm -f $$dir/*.elc; done
441 # Generate/update files for the bootstrap process.
442 # When done, remove bootstrap-emacs from ../bin, so that
443 # it will not be mistaken for an installed binary.
445 bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps
449 # Assuming INSTALL_DIR is defined, copy the elisp files to it
450 # Windows 95 makes this harder than it should be.
453 - mkdir "$(INSTALL_DIR)/lisp"
454 - $(DEL) ../same-dir.tst
455 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
456 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
457 #ifdef COPY_LISP_SOURCE
458 $(IFNOTSAMEDIR) $(MAKE) $(MFLAGS) install-lisp-$(SHELLTYPE) $(ENDIF)
460 # $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
461 # $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
462 # $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
463 # $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
464 # $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
465 # $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
466 # $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
467 # $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
468 # $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
469 # $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
470 # $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
472 - $(DEL) ../same-dir.tst
473 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
475 # Need to copy *.el files first, to avoid "source file is newer" annoyance
476 # since cp does not preserve time stamps
478 cp -f *.el "$(INSTALL_DIR)/lisp"
479 for dir in $(WINS); do [ -d "$(INSTALL_DIR)/lisp/$$dir" ] || mkdir "$(INSTALL_DIR)/lisp/$$dir"; done
480 for dir in $(WINS); do cp -f $$dir/*.el "$(INSTALL_DIR)/lisp/$$dir"; done
481 for dir in . $(WINS); do cp $$dir/*.elc "$(INSTALL_DIR)/lisp/$$dir"; done
484 cp -f *.el "$(INSTALL_DIR)/lisp"
485 for %%f in ($(WINS)) do if not exist "$(INSTALL_DIR)/lisp/%%f" mkdir "$(INSTALL_DIR)/lisp/%%f"
486 for %%f in ($(WINS)) do cp -f %%f/*.el "$(INSTALL_DIR)/lisp/%%f"
487 for %%f in (. $(WINS)) do cp -f %%f/*.elc "$(INSTALL_DIR)/lisp/%%f"
489 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
490 # this can break with GNU Make 3.81 and later if sh.exe is used.
492 $(emacs) -l $(lisp)/emacs-lisp/check-declare --eval $(ARGQUOTE)(check-declare-directory $(DQUOTE)$(lisp)$(DQUOTE))$(ARGQUOTE)
497 # We used to delete *~ here, but that might inadvertently remove
498 # precious files if it happens to match their short 8+3 aliases.