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 of the License, or
10 # (at your option) any later version.
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. If not, see <http://www.gnu.org/licenses/>.
30 # You can specify a different executable on the make command line,
31 # e.g. "make EMACS=../src/emacs ...".
33 EMACS = $(THISDIR)/../bin/emacs.exe
35 # Command line flags for Emacs. This must include --multibyte,
36 # otherwise some files will not compile.
38 EMACSOPT = -batch --no-init-file --no-site-file --multibyte
40 # Extra flags to pass to the byte compiler
41 BYTE_COMPILE_EXTRA_FLAGS =
42 # For example to not display the undefined function warnings you can use this:
43 # BYTE_COMPILE_EXTRA_FLAGS = --eval '(setq byte-compile-warnings (quote (not unresolved)))'
44 # The example above is just for developers, it should not be used by default.
46 # Set EMACSLOADPATH correctly (already defined in environment).
52 lisptagsfiles1 = $(lisp)/*.el
53 lisptagsfiles2 = $(lisp)/*/*.el
54 ETAGS = "../lib-src/$(BLD)/etags"
56 # Automatically generated autoload files, apart from lisp/loaddefs.el.
57 LOADDEFS = $(lisp)/calendar/cal-loaddefs.el \
58 $(lisp)/calendar/diary-loaddefs.el $(lisp)/calendar/hol-loaddefs.el \
59 $(lisp)/mh-e/mh-loaddefs.el
61 AUTOGENEL = $(lisp)/loaddefs.el $(LOADDEFS) $(lisp)/cus-load.el \
62 $(lisp)/finder-inf.el $(lisp)/subdirs.el $(lisp)/eshell/esh-groups.el \
63 $(lisp)/calc/calc-loaddefs.el
65 # Files to compile before others during a bootstrap. This is done to
66 # speed up the bootstrap process. The CC files are compiled first
67 # because CC mode tweaks the compilation process, and requiring
68 # cc-mode when it is not compiled doesn't work during the
72 $(lisp)/emacs-lisp/byte-opt.el \
73 $(lisp)/emacs-lisp/bytecomp.el \
75 $(lisp)/progmodes/cc-mode.el \
76 $(lisp)/progmodes/cc-vars.el
78 # The actual Emacs command run in the targets below.
79 # The quotes around $(EMACS) are here because the user could type
80 # it with forward slashes and without quotes, which will fail if
81 # the shell is cmd.exe.
83 emacs = "$(EMACS)" $(EMACSOPT)
85 # Have to define the list of subdirs manually when not using sh.
106 WINS= $(WINS_ALMOST) \
114 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
115 # this can break with GNU Make 3.81 and later if sh.exe is used.
116 custom-deps: $(lisp)/cus-load.el $(lisp)/loaddefs.el doit
117 @echo Directories: $(WINS_ALMOST)
118 -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS_ALMOST)
120 finder-data: $(lisp)/loaddefs.el doit
121 @echo Directories: $(WINS_ALMOST)
122 $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS_ALMOST)
125 $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
126 cp loaddefs.el-$(SHELLTYPE) $@
127 rm loaddefs.el-$(SHELLTYPE)
130 echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
131 echo ";;" >> $@; echo ";;; Code:" >> $@
132 echo "(autoload 'define-minor-mode \"easy-mmode\")" >>$@
133 echo "(autoload 'define-ccl-program \"ccl\")" >>$@
134 echo "(autoload 'regexp-opt \"regexp-opt\")" >>$@
135 echo "(autoload 'string-to-list \"mule-util\")" >>$@
136 echo "(autoload 'define-derived-mode \"derived\")" >>$@
137 echo "(autoload 'encoded-kbd-mode \"encoded-kb\")" >>$@
138 echo "(defvar cvs-global-menu nil)" >>$@
140 echo ";;; Local Variables:" >> $@
141 echo ";;; version-control: never" >> $@
142 echo ";;; no-byte-compile: t" >> $@
143 echo ";;; no-update-autoloads: t" >> $@
144 echo ";;; End:" >> $@
145 echo ";;; loaddefs.el ends here" >> $@
148 echo ;;; loaddefs.el --- automatically extracted autoloads> $@
150 echo (autoload 'define-minor-mode "easy-mmode")>> $@
151 echo (autoload 'define-ccl-program "ccl")>> $@
152 echo (autoload 'regexp-opt "regexp-opt")>> $@
153 echo (autoload 'string-to-list "mule-util")>> $@
154 echo (autoload 'define-derived-mode "derived")>> $@
155 echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@
156 echo (defvar cvs-global-menu nil)>> $@
158 echo ;;; Local Variables:>> $@
159 echo ;;; version-control: never>> $@
160 echo ;;; no-byte-compile: t>> $@
161 echo ;;; no-update-autoloads: t>> $@
163 echo ;;; loaddefs.el ends here>> $@
165 # Use . instead of $(lisp) because $(lisp) is an absolute file name,
166 # including a drive letter and any leading directories, so the generated
167 # loaddefs.el will mention file names that on other machine reference
168 # possibly non-existent directories.
170 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
171 # this can break with GNU Make 3.81 and later if sh.exe is used.
172 autoloads: $(lisp)/loaddefs.el $(LOADDEFS) doit
173 @echo Directories: . $(WINS_ALMOST)
174 $(emacs) -l autoload \
175 --eval $(ARGQUOTE)(setq find-file-hook nil find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
176 -f w32-batch-update-autoloads "$(lisp)/loaddefs.el" . $(WINS_ALMOST)
179 $(MAKE) $(MFLAGS) update-subdirs
181 # Need separate version for sh and native cmd.exe
182 update-subdirs: update-subdirs-$(SHELLTYPE)
184 update-subdirs-CMD: doit
185 echo ;; -*- no-byte-compile: t -*-> $(lisp)/subdirs.el
186 echo ;; In load-path, after this directory should come>> $(lisp)/subdirs.el
187 echo ;; certain of its subdirectories. Here we specify them.>> $(lisp)/subdirs.el
188 echo (normal-top-level-add-to-load-path $(SQUOTE)(>> $(lisp)/subdirs.el
189 @for %%d in ($(WINS)) do if not (%%d)==(term) echo "%%d">> $(lisp)/subdirs.el
190 echo ))>> $(lisp)/subdirs.el
192 update-subdirs-SH: doit
193 $(srcdir)/update-subdirs $(lisp); \
194 for file in $(WINS); do \
195 $(srcdir)/update-subdirs $$file; \
198 updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
200 # This is useful after "cvs up".
201 cvs-update: recompile autoloads finder-data custom-deps
203 # Update the AUTHORS file.
206 $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS $(srcdir)
208 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
209 $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
211 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
212 $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
217 -$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
219 # Compile all Lisp files, but don't recompile those that are up to
220 # date. Some files don't actually get compiled because they set the
221 # local variable no-byte-compile.
223 # All .elc files are made writable before compilation in case we
224 # checked out read-only (CVS option -r). Files MUST be compiled one by
225 # one. If we compile several files in a row we can't make sure that
226 # the compilation environment is clean. We also set the load-path of
227 # the Emacs used for compilation to the current directory and its
228 # subdirectories, to make sure require's and load's in the files being
229 # compiled find the right files.
231 # Need separate version for sh and native cmd.exe
232 compile: $(lisp)/subdirs.el mh-autoloads compile-$(SHELLTYPE) doit
235 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
236 for %%f in ($(COMPILE_FIRST)) do \
237 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done %%f
238 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \
239 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done %%f/%%g
242 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
243 for el in $(COMPILE_FIRST); do \
244 echo Compiling $$el; \
245 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el; \
247 for dir in $(lisp) $(WINS); do \
248 for el in $$dir/*.el; do \
251 echo Compiling $$el; \
252 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el; \
257 # Compile all Lisp files. This is like `compile' but compiles files
258 # unconditionally. Some files don't actually get compiled because they
259 # set the local variable no-byte-compile.
261 compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
264 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
265 for %%f in ($(COMPILE_FIRST)) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f
266 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f/%%g
269 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
270 for el in $(COMPILE_FIRST); do \
271 echo Compiling $$el; \
272 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
274 for dir in $(lisp) $(WINS); do \
275 for el in $$dir/*.el; do \
276 echo Compiling $$el; \
277 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
281 compile-calc: compile-calc-$(SHELLTYPE)
284 for %%f in ($(lisp)/calc/*.el) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f
287 for el in $(lisp)/calc/*.el; do \
288 echo Compiling $$el; \
289 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
292 # Backup compiled Lisp files in elc.tar.gz. If that file already
293 # exists, make a backup of it.
295 backup-compiled-files:
296 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
297 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
299 # Compile Lisp files, but save old compiled files first.
301 compile-after-backup: backup-compiled-files compile-always
303 # Recompile all Lisp files which are newer than their .elc files.
304 # Note that this doesn't create .elc files. It only recompiles if an
306 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
307 # this can break with GNU Make 3.81 and later if sh.exe is used.
308 recompile: mh-autoloads doit $(lisp)/progmodes/cc-mode.elc
309 $(emacs) --eval $(ARGQUOTE)(batch-byte-recompile-directory 0)$(ARGQUOTE) $(lisp)
311 # CC Mode uses a compile time macro system which causes a compile time
312 # dependency in cc-mode.elc on the macros in cc-langs.el and the
313 # version string in cc-defs.el.
314 $(lisp)/progmodes/cc-mode.elc: \
315 $(lisp)/progmodes/cc-mode.el \
316 $(lisp)/progmodes/cc-langs.el \
317 $(lisp)/progmodes/cc-defs.el
318 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el
320 $(lisp)/calendar/cal-loaddefs.el:
321 "$(EMACS)" $(EMACSOPT) -l autoload \
322 --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
323 --eval "(setq find-file-suppress-same-file-warnings t)" \
324 --eval "(setq make-backup-files nil)" \
325 -f w32-batch-update-autoloads "$(lisp)/calendar/cal-loaddefs.el" \
328 $(lisp)/calendar/diary-loaddefs.el:
329 "$(EMACS)" $(EMACSOPT) -l autoload \
330 --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \
331 --eval "(setq find-file-suppress-same-file-warnings t)" \
332 --eval "(setq make-backup-files nil)" \
333 -f w32-batch-update-autoloads $(lisp)/calendar/diary-loaddefs.el \
336 $(lisp)/calendar/hol-loaddefs.el:
337 "$(EMACS)" $(EMACSOPT) -l autoload \
338 --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \
339 --eval "(setq find-file-suppress-same-file-warnings t)" \
340 --eval "(setq make-backup-files nil)" \
341 -f w32-batch-update-autoloads $(lisp)/calendar/hol-loaddefs.el \
344 # Update MH-E internal autoloads. These are not to be confused with
345 # the autoloads for the MH-E entry points, which are already in
347 MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \
348 $(lisp)/mh-e/mh-buffers.el $(lisp)/mh-e/mh-compat.el \
349 $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-e.el \
350 $(lisp)/mh-e/mh-folder.el $(lisp)/mh-e/mh-funcs.el \
351 $(lisp)/mh-e/mh-gnus.el $(lisp)/mh-e/mh-identity.el \
352 $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-junk.el \
353 $(lisp)/mh-e/mh-letter.el $(lisp)/mh-e/mh-limit.el \
354 $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-print.el \
355 $(lisp)/mh-e/mh-scan.el $(lisp)/mh-e/mh-search.el \
356 $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-show.el \
357 $(lisp)/mh-e/mh-speed.el $(lisp)/mh-e/mh-thread.el \
358 $(lisp)/mh-e/mh-tool-bar.el $(lisp)/mh-e/mh-utils.el \
359 $(lisp)/mh-e/mh-xface.el
361 # See the commentary for autoloads above for why we use ./mh-e below
362 # instead of $(lisp)/mh-e.
363 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
364 $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC)
365 "$(EMACS)" $(EMACSOPT) \
367 --eval $(ARGQUOTE)(setq generate-autoload-cookie $(DQUOTE);;;###mh-autoload$(DQUOTE))$(ARGQUOTE) \
368 --eval $(ARGQUOTE)(setq find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
369 --eval $(ARGQUOTE)(setq make-backup-files nil)$(ARGQUOTE) \
370 -f w32-batch-update-autoloads \
371 $(ARGQUOTE)$(lisp)/mh-e/mh-loaddefs.el$(ARGQUOTE) ./mh-e
373 # Prepare a bootstrap in the lisp subdirectory.
375 # Build loaddefs.el to make sure it's up-to-date. If it's not, that
376 # might lead to errors during the bootstrap because something fails to
377 # autoload as expected. If there is no emacs binary, then we can't
378 # build autoloads yet. In that case we have to use ldefs-boot.el;
379 # bootstrap should always work with ldefs-boot.el. (Because
380 # loaddefs.el is an automatically generated file, we don't want to
381 # store it in the source repository).
383 # Remove compiled Lisp files so that bootstrap-emacs will be built from
386 # Need separate version for sh and native cmd.exe
387 # Note that bootstrap-clean-$(SHELLTYPE) copies ldefs-boot.el to loaddefs.el,
388 # and thus the almost-empty loaddefs.el crafted by the $(lisp)/loaddefs.el
389 # target can NOT be built _after_ bootstrap-clean-$(SHELLTYPE) does its
390 # thing, or else an empty loaddefs.el will overwrite the full one.
391 bootstrap-clean: $(lisp)/loaddefs.el
392 $(MAKE) $(MFLAGS) bootstrap-clean-$(SHELLTYPE)
395 # if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads
396 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
397 -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
400 # if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi
401 # -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
402 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
403 -for dir in . $(WINS); do rm -f $$dir/*.elc; done
405 # Generate/update files for the bootstrap process.
406 # When done, remove bootstrap-emacs from ../bin, so that
407 # it will not be mistaken for an installed binary.
409 bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps
413 # Assuming INSTALL_DIR is defined, copy the elisp files to it
414 # Windows 95 makes this harder than it should be.
417 - mkdir "$(INSTALL_DIR)/lisp"
418 - $(DEL) ../same-dir.tst
419 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
420 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
421 #ifdef COPY_LISP_SOURCE
422 $(IFNOTSAMEDIR) $(MAKE) $(MFLAGS) install-lisp-$(SHELLTYPE) $(ENDIF)
424 # $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
425 # $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
426 # $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
427 # $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
428 # $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
429 # $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
430 # $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
431 # $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
432 # $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
433 # $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
434 # $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
436 - $(DEL) ../same-dir.tst
437 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
439 # Need to copy *.el files first, to avoid "source file is newer" annoyance
440 # since cp does not preserve time stamps
442 cp -f *.el "$(INSTALL_DIR)/lisp"
443 for dir in $(WINS); do [ -d "$(INSTALL_DIR)/lisp/$$dir" ] || mkdir "$(INSTALL_DIR)/lisp/$$dir"; done
444 for dir in $(WINS); do cp -f $$dir/*.el "$(INSTALL_DIR)/lisp/$$dir"; done
445 for dir in . $(WINS); do cp $$dir/*.elc "$(INSTALL_DIR)/lisp/$$dir"; done
448 cp -f *.el "$(INSTALL_DIR)/lisp"
449 for %%f in ($(WINS)) do if not exist "$(INSTALL_DIR)/lisp/%%f" mkdir "$(INSTALL_DIR)/lisp/%%f"
450 for %%f in ($(WINS)) do cp -f %%f/*.el "$(INSTALL_DIR)/lisp/%%f"
451 for %%f in (. $(WINS)) do cp -f %%f/*.elc "$(INSTALL_DIR)/lisp/%%f"
453 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
454 # this can break with GNU Make 3.81 and later if sh.exe is used.
456 $(emacs) -l $(lisp)/emacs-lisp/check-declare --eval $(ARGQUOTE)(check-declare-directory $(DQUOTE)$(lisp)$(DQUOTE))$(ARGQUOTE)
461 # We used to delete *~ here, but that might inadvertently remove
462 # precious files if it happens to match their short 8+3 aliases.
467 - $(DEL) $(lisp)/Makefile
469 maintainer-clean: bootstrap-clean distclean
470 - $(DEL) $(AUTOGENEL)