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 \
62 $(lisp)/mh-e/mh-loaddefs.el
64 AUTOGENEL = $(lisp)/loaddefs.el $(LOADDEFS) $(lisp)/cus-load.el \
65 $(lisp)/finder-inf.el $(lisp)/subdirs.el $(lisp)/eshell/esh-groups.el \
66 $(lisp)/calc/calc-loaddefs.el
68 # Files to compile before others during a bootstrap. This is done to
69 # speed up the bootstrap process. The CC files are compiled first
70 # because CC mode tweaks the compilation process, and requiring
71 # cc-mode when it is not compiled doesn't work during the
75 $(lisp)/emacs-lisp/byte-opt.el \
76 $(lisp)/emacs-lisp/bytecomp.el \
78 $(lisp)/progmodes/cc-mode.el \
79 $(lisp)/progmodes/cc-vars.el
81 # The actual Emacs command run in the targets below.
82 # The quotes around $(EMACS) are here because the user could type
83 # it with forward slashes and without quotes, which will fail if
84 # the shell is cmd.exe.
86 emacs = "$(EMACS)" $(EMACSOPT)
88 # Have to define the list of subdirs manually when not using sh.
109 WINS= $(WINS_ALMOST) \
117 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
118 # this can break with GNU Make 3.81 and later if sh.exe is used.
119 custom-deps: $(lisp)/cus-load.el $(lisp)/loaddefs.el doit
120 @echo Directories: $(WINS_ALMOST)
121 -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS_ALMOST)
123 finder-data: $(lisp)/loaddefs.el doit
124 @echo Directories: $(WINS_ALMOST)
125 $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS_ALMOST)
128 $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
129 cp loaddefs.el-$(SHELLTYPE) $@
130 rm loaddefs.el-$(SHELLTYPE)
133 echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
134 echo ";;" >> $@; echo ";;; Code:" >> $@
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" >> $@
147 echo ";;; End:" >> $@
148 echo ";;; loaddefs.el ends here" >> $@
151 echo ;;; loaddefs.el --- automatically extracted autoloads> $@
153 echo (autoload 'define-minor-mode "easy-mmode")>> $@
154 echo (autoload 'define-ccl-program "ccl")>> $@
155 echo (autoload 'regexp-opt "regexp-opt")>> $@
156 echo (autoload 'string-to-list "mule-util")>> $@
157 echo (autoload 'define-derived-mode "derived")>> $@
158 echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@
159 echo (defvar cvs-global-menu nil)>> $@
161 echo ;;; Local Variables:>> $@
162 echo ;;; version-control: never>> $@
163 echo ;;; no-byte-compile: t>> $@
164 echo ;;; no-update-autoloads: t>> $@
166 echo ;;; loaddefs.el ends here>> $@
168 # Use . instead of $(lisp) because $(lisp) is an absolute file name,
169 # including a drive letter and any leading directories, so the generated
170 # loaddefs.el will mention file names that on other machine reference
171 # possibly non-existent directories.
173 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
174 # this can break with GNU Make 3.81 and later if sh.exe is used.
175 autoloads: $(lisp)/loaddefs.el $(LOADDEFS) doit
176 @echo Directories: . $(WINS_ALMOST)
177 $(emacs) -l autoload \
178 --eval $(ARGQUOTE)(setq find-file-hook nil find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
179 -f w32-batch-update-autoloads "$(lisp)/loaddefs.el" . $(WINS_ALMOST)
182 $(MAKE) $(MFLAGS) update-subdirs
184 # Need separate version for sh and native cmd.exe
185 update-subdirs: update-subdirs-$(SHELLTYPE)
187 update-subdirs-CMD: doit
188 echo ;; -*- no-byte-compile: t -*-> $(lisp)/subdirs.el
189 echo ;; In load-path, after this directory should come>> $(lisp)/subdirs.el
190 echo ;; certain of its subdirectories. Here we specify them.>> $(lisp)/subdirs.el
191 echo (normal-top-level-add-to-load-path $(SQUOTE)(>> $(lisp)/subdirs.el
192 @for %%d in ($(WINS)) do if not (%%d)==(term) echo "%%d">> $(lisp)/subdirs.el
193 echo ))>> $(lisp)/subdirs.el
195 update-subdirs-SH: doit
196 $(srcdir)/update-subdirs $(lisp); \
197 for file in $(WINS); do \
198 $(srcdir)/update-subdirs $$file; \
201 updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
203 # This is useful after "cvs up".
204 cvs-update: recompile autoloads finder-data custom-deps
206 # Update the AUTHORS file.
209 $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS $(srcdir)
211 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
212 $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
214 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
215 $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
220 -$(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $<
222 # Compile all Lisp files, but don't recompile those that are up to
223 # date. Some files don't actually get compiled because they set the
224 # local variable no-byte-compile.
226 # All .elc files are made writable before compilation in case we
227 # checked out read-only (CVS option -r). Files MUST be compiled one by
228 # one. If we compile several files in a row we can't make sure that
229 # the compilation environment is clean. We also set the load-path of
230 # the Emacs used for compilation to the current directory and its
231 # subdirectories, to make sure require's and load's in the files being
232 # compiled find the right files.
234 # Need separate version for sh and native cmd.exe
235 compile: $(lisp)/subdirs.el mh-autoloads compile-$(SHELLTYPE) doit
238 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
239 for %%f in ($(COMPILE_FIRST)) do \
240 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done %%f
241 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \
242 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done %%f/%%g
245 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
246 for el in $(COMPILE_FIRST); do \
247 echo Compiling $$el; \
248 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el; \
250 for dir in $(lisp) $(WINS); do \
251 for el in $$dir/*.el; do \
254 echo Compiling $$el; \
255 $(emacs) -l loaddefs $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile-if-not-done $$el; \
260 # Compile all Lisp files. This is like `compile' but compiles files
261 # unconditionally. Some files don't actually get compiled because they
262 # set the local variable no-byte-compile.
264 compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
267 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
268 for %%f in ($(COMPILE_FIRST)) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f
269 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f/%%g
272 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
273 for el in $(COMPILE_FIRST); do \
274 echo Compiling $$el; \
275 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
277 for dir in $(lisp) $(WINS); do \
278 for el in $$dir/*.el; do \
279 echo Compiling $$el; \
280 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
284 compile-calc: compile-calc-$(SHELLTYPE)
287 for %%f in ($(lisp)/calc/*.el) do $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile %%f
290 for el in $(lisp)/calc/*.el; do \
291 echo Compiling $$el; \
292 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $$el || exit 1; \
295 # Backup compiled Lisp files in elc.tar.gz. If that file already
296 # exists, make a backup of it.
298 backup-compiled-files:
299 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
300 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
302 # Compile Lisp files, but save old compiled files first.
304 compile-after-backup: backup-compiled-files compile-always
306 # Recompile all Lisp files which are newer than their .elc files.
307 # Note that this doesn't create .elc files. It only recompiles if an
309 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
310 # this can break with GNU Make 3.81 and later if sh.exe is used.
311 recompile: mh-autoloads doit $(lisp)/progmodes/cc-mode.elc
312 $(emacs) --eval $(ARGQUOTE)(batch-byte-recompile-directory 0)$(ARGQUOTE) $(lisp)
314 # CC Mode uses a compile time macro system which causes a compile time
315 # dependency in cc-mode.elc on the macros in cc-langs.el and the
316 # version string in cc-defs.el.
317 $(lisp)/progmodes/cc-mode.elc: \
318 $(lisp)/progmodes/cc-mode.el \
319 $(lisp)/progmodes/cc-langs.el \
320 $(lisp)/progmodes/cc-defs.el
321 $(emacs) $(BYTE_COMPILE_EXTRA_FLAGS) -f batch-byte-compile $(lisp)/progmodes/cc-mode.el
323 $(lisp)/calendar/cal-loaddefs.el:
324 "$(EMACS)" $(EMACSOPT) -l autoload \
325 --eval "(setq generate-autoload-cookie \";;;###cal-autoload\")" \
326 --eval "(setq find-file-suppress-same-file-warnings t)" \
327 --eval "(setq make-backup-files nil)" \
328 -f w32-batch-update-autoloads "$(lisp)/calendar/cal-loaddefs.el" \
331 $(lisp)/calendar/diary-loaddefs.el:
332 "$(EMACS)" $(EMACSOPT) -l autoload \
333 --eval "(setq generate-autoload-cookie \";;;###diary-autoload\")" \
334 --eval "(setq find-file-suppress-same-file-warnings t)" \
335 --eval "(setq make-backup-files nil)" \
336 -f w32-batch-update-autoloads $(lisp)/calendar/diary-loaddefs.el \
339 $(lisp)/calendar/hol-loaddefs.el:
340 "$(EMACS)" $(EMACSOPT) -l autoload \
341 --eval "(setq generate-autoload-cookie \";;;###holiday-autoload\")" \
342 --eval "(setq find-file-suppress-same-file-warnings t)" \
343 --eval "(setq make-backup-files nil)" \
344 -f w32-batch-update-autoloads $(lisp)/calendar/hol-loaddefs.el \
347 # Update MH-E internal autoloads. These are not to be confused with
348 # the autoloads for the MH-E entry points, which are already in
350 MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \
351 $(lisp)/mh-e/mh-buffers.el $(lisp)/mh-e/mh-compat.el \
352 $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-e.el \
353 $(lisp)/mh-e/mh-folder.el $(lisp)/mh-e/mh-funcs.el \
354 $(lisp)/mh-e/mh-gnus.el $(lisp)/mh-e/mh-identity.el \
355 $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-junk.el \
356 $(lisp)/mh-e/mh-letter.el $(lisp)/mh-e/mh-limit.el \
357 $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-print.el \
358 $(lisp)/mh-e/mh-scan.el $(lisp)/mh-e/mh-search.el \
359 $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-show.el \
360 $(lisp)/mh-e/mh-speed.el $(lisp)/mh-e/mh-thread.el \
361 $(lisp)/mh-e/mh-tool-bar.el $(lisp)/mh-e/mh-utils.el \
362 $(lisp)/mh-e/mh-xface.el
364 # See the commentary for autoloads above for why we use ./mh-e below
365 # instead of $(lisp)/mh-e.
366 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
367 $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC)
368 "$(EMACS)" $(EMACSOPT) \
370 --eval $(ARGQUOTE)(setq generate-autoload-cookie $(DQUOTE);;;###mh-autoload$(DQUOTE))$(ARGQUOTE) \
371 --eval $(ARGQUOTE)(setq find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
372 --eval $(ARGQUOTE)(setq make-backup-files nil)$(ARGQUOTE) \
373 -f w32-batch-update-autoloads \
374 $(ARGQUOTE)$(lisp)/mh-e/mh-loaddefs.el$(ARGQUOTE) ./mh-e
376 # Prepare a bootstrap in the lisp subdirectory.
378 # Build loaddefs.el to make sure it's up-to-date. If it's not, that
379 # might lead to errors during the bootstrap because something fails to
380 # autoload as expected. If there is no emacs binary, then we can't
381 # build autoloads yet. In that case we have to use ldefs-boot.el;
382 # bootstrap should always work with ldefs-boot.el. (Because
383 # loaddefs.el is an automatically generated file, we don't want to
384 # store it in the source repository).
386 # Remove compiled Lisp files so that bootstrap-emacs will be built from
389 # Need separate version for sh and native cmd.exe
390 # Note that bootstrap-clean-$(SHELLTYPE) copies ldefs-boot.el to loaddefs.el,
391 # and thus the almost-empty loaddefs.el crafted by the $(lisp)/loaddefs.el
392 # target can NOT be built _after_ bootstrap-clean-$(SHELLTYPE) does its
393 # thing, or else an empty loaddefs.el will overwrite the full one.
394 bootstrap-clean: $(lisp)/loaddefs.el
395 $(MAKE) $(MFLAGS) bootstrap-clean-$(SHELLTYPE)
398 # if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads
399 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
400 -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
403 # if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi
404 # -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
405 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
406 -for dir in . $(WINS); do rm -f $$dir/*.elc; done
408 # Generate/update files for the bootstrap process.
409 # When done, remove bootstrap-emacs from ../bin, so that
410 # it will not be mistaken for an installed binary.
412 bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps
416 # Assuming INSTALL_DIR is defined, copy the elisp files to it
417 # Windows 95 makes this harder than it should be.
420 - mkdir "$(INSTALL_DIR)/lisp"
421 - $(DEL) ../same-dir.tst
422 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
423 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
424 #ifdef COPY_LISP_SOURCE
425 $(IFNOTSAMEDIR) $(MAKE) $(MFLAGS) install-lisp-$(SHELLTYPE) $(ENDIF)
427 # $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
428 # $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
429 # $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
430 # $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
431 # $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
432 # $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
433 # $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
434 # $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
435 # $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
436 # $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
437 # $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
439 - $(DEL) ../same-dir.tst
440 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
442 # Need to copy *.el files first, to avoid "source file is newer" annoyance
443 # since cp does not preserve time stamps
445 cp -f *.el "$(INSTALL_DIR)/lisp"
446 for dir in $(WINS); do [ -d "$(INSTALL_DIR)/lisp/$$dir" ] || mkdir "$(INSTALL_DIR)/lisp/$$dir"; done
447 for dir in $(WINS); do cp -f $$dir/*.el "$(INSTALL_DIR)/lisp/$$dir"; done
448 for dir in . $(WINS); do cp $$dir/*.elc "$(INSTALL_DIR)/lisp/$$dir"; done
451 cp -f *.el "$(INSTALL_DIR)/lisp"
452 for %%f in ($(WINS)) do if not exist "$(INSTALL_DIR)/lisp/%%f" mkdir "$(INSTALL_DIR)/lisp/%%f"
453 for %%f in ($(WINS)) do cp -f %%f/*.el "$(INSTALL_DIR)/lisp/%%f"
454 for %%f in (. $(WINS)) do cp -f %%f/*.elc "$(INSTALL_DIR)/lisp/%%f"
456 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
457 # this can break with GNU Make 3.81 and later if sh.exe is used.
459 $(emacs) -l $(lisp)/emacs-lisp/check-declare --eval $(ARGQUOTE)(check-declare-directory $(DQUOTE)$(lisp)$(DQUOTE))$(ARGQUOTE)
464 # We used to delete *~ here, but that might inadvertently remove
465 # precious files if it happens to match their short 8+3 aliases.
470 - $(DEL) $(lisp)/Makefile
472 maintainer-clean: bootstrap-clean distclean
473 - $(DEL) $(AUTOGENEL)