1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004,
3 # 2005, 2006, 2007 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 # 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.
64 # The quotes around $(EMACS) are here because the user could type
65 # it with forward slashes and without quotes, which will fail if
66 # the shell is cmd.exe.
68 emacs = "$(EMACS)" $(EMACSOPT)
70 # Have to define the list of subdirs manually when not using sh.
91 WINS= $(WINS_ALMOST) \
98 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
99 # this can break with GNU Make 3.81 and later if sh.exe is used.
100 custom-deps: $(lisp)/cus-load.el $(lisp)/loaddefs.el doit
101 @echo Directories: $(WINS)
102 -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS)
104 finder-data: $(lisp)/loaddefs.el doit
105 @echo Directories: $(WINS)
106 $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS)
109 $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
110 cp loaddefs.el-$(SHELLTYPE) $@
111 rm loaddefs.el-$(SHELLTYPE)
114 echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
115 echo ";;" >> $@; echo ";;; Code:" >> $@
116 echo "(autoload 'define-minor-mode \"easy-mmode\")" >>$@
117 echo "(autoload 'define-ccl-program \"ccl\")" >>$@
118 echo "(autoload 'regexp-opt \"regexp-opt\")" >>$@
119 echo "(autoload 'string-to-list \"mule-util\")" >>$@
120 echo "(autoload 'define-derived-mode \"derived\")" >>$@
121 echo "(autoload 'encoded-kbd-mode \"encoded-kb\")" >>$@
122 echo "(defvar cvs-global-menu nil)" >>$@
124 echo ";;; Local Variables:" >> $@
125 echo ";;; version-control: never" >> $@
126 echo ";;; no-byte-compile: t" >> $@
127 echo ";;; no-update-autoloads: t" >> $@
128 echo ";;; End:" >> $@
129 echo ";;; loaddefs.el ends here" >> $@
132 echo ;;; loaddefs.el --- automatically extracted autoloads> $@
134 echo (autoload 'define-minor-mode "easy-mmode")>> $@
135 echo (autoload 'define-ccl-program "ccl")>> $@
136 echo (autoload 'regexp-opt "regexp-opt")>> $@
137 echo (autoload 'string-to-list "mule-util")>> $@
138 echo (autoload 'define-derived-mode "derived")>> $@
139 echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@
140 echo (defvar cvs-global-menu nil)>> $@
142 echo ;;; Local Variables:>> $@
143 echo ;;; version-control: never>> $@
144 echo ;;; no-byte-compile: t>> $@
145 echo ;;; no-update-autoloads: t>> $@
147 echo ;;; loaddefs.el ends here>> $@
149 # Use . instead of $(lisp) because $(lisp) is an absolute file name,
150 # including a drive letter and any leading directories, so the generated
151 # loaddefs.el will mention file names that on other machine reference
152 # possibly non-existent directories.
154 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
155 # this can break with GNU Make 3.81 and later if sh.exe is used.
156 autoloads: $(lisp)/loaddefs.el doit
157 @echo Directories: . $(WINS_ALMOST)
158 $(emacs) -l autoload \
159 --eval $(ARGQUOTE)(setq find-file-hook nil find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
160 -f w32-batch-update-autoloads "$(lisp)/loaddefs.el" . $(WINS_ALMOST)
163 $(MAKE) $(MFLAGS) update-subdirs
165 # Need separate version for sh and native cmd.exe
166 update-subdirs: update-subdirs-$(SHELLTYPE)
168 update-subdirs-CMD: doit
169 echo ;; -*- no-byte-compile: t -*-> $(lisp)/subdirs.el
170 echo ;; In load-path, after this directory should come>> $(lisp)/subdirs.el
171 echo ;; certain of its subdirectories. Here we specify them.>> $(lisp)/subdirs.el
172 echo (normal-top-level-add-to-load-path $(SQUOTE)(>> $(lisp)/subdirs.el
173 @for %%d in ($(WINS)) do if not (%%d)==(term) echo "%%d">> $(lisp)/subdirs.el
174 echo ))>> $(lisp)/subdirs.el
176 update-subdirs-SH: doit
177 $(srcdir)/update-subdirs $(lisp); \
178 for file in $(WINS); do \
179 $(srcdir)/update-subdirs $$file; \
182 updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
184 # This is useful after "cvs up".
185 cvs-update: recompile autoloads finder-data custom-deps
187 # Update the AUTHORS file.
190 $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS $(srcdir)
192 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
193 $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
195 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
196 $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
201 -$(emacs) -f batch-byte-compile $<
203 # Compile all Lisp files, but don't recompile those that are up to
204 # date. Some files don't actually get compiled because they set the
205 # local variable no-byte-compile.
207 # All .elc files are made writable before compilation in case we
208 # checked out read-only (CVS option -r). Files MUST be compiled one by
209 # one. If we compile several files in a row we can't make sure that
210 # the compilation environment is clean. We also set the load-path of
211 # the Emacs used for compilation to the current directory and its
212 # subdirectories, to make sure require's and load's in the files being
213 # compiled find the right files.
215 # Need separate version for sh and native cmd.exe
216 compile: $(lisp)/subdirs.el mh-autoloads compile-$(SHELLTYPE) doit
219 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
220 for %%f in ($(COMPILE_FIRST)) do \
221 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f
222 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \
223 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f/%%g
226 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
227 for el in $(COMPILE_FIRST); do \
228 echo Compiling $$el; \
229 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
231 for dir in $(lisp) $(WINS); do \
232 for el in $$dir/*.el; do \
235 echo Compiling $$el; \
236 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
241 # Compile all Lisp files. This is like `compile' but compiles files
242 # unconditionally. Some files don't actually get compiled because they
243 # set the local variable no-byte-compile.
245 compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
248 # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
249 for %%f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %%f
250 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) -f batch-byte-compile %%f/%%g
253 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
254 for el in $(COMPILE_FIRST); do \
255 echo Compiling $$el; \
256 $(emacs) -f batch-byte-compile $$el || exit 1; \
258 for dir in $(lisp) $(WINS); do \
259 for el in $$dir/*.el; do \
260 echo Compiling $$el; \
261 $(emacs) -f batch-byte-compile $$el || exit 1; \
265 compile-calc: compile-calc-$(SHELLTYPE)
268 for %%f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %%f
271 for el in $(lisp)/calc/*.el; do \
272 echo Compiling $$el; \
273 $(emacs) -f batch-byte-compile $$el || exit 1; \
276 # Backup compiled Lisp files in elc.tar.gz. If that file already
277 # exists, make a backup of it.
279 backup-compiled-files:
280 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
281 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
283 # Compile Lisp files, but save old compiled files first.
285 compile-after-backup: backup-compiled-files compile-always
287 # Recompile all Lisp files which are newer than their .elc files.
288 # Note that this doesn't create .elc files. It only recompiles if an
290 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
291 # this can break with GNU Make 3.81 and later if sh.exe is used.
292 recompile: mh-autoloads doit $(lisp)/progmodes/cc-mode.elc
293 $(emacs) --eval $(ARGQUOTE)(batch-byte-recompile-directory 0)$(ARGQUOTE) $(lisp)
295 # Update MH-E internal autoloads. These are not to be confused with
296 # the autoloads for the MH-E entry points, which are already in
298 MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \
299 $(lisp)/mh-e/mh-buffers.el $(lisp)/mh-e/mh-compat.el \
300 $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-e.el \
301 $(lisp)/mh-e/mh-folder.el $(lisp)/mh-e/mh-funcs.el \
302 $(lisp)/mh-e/mh-gnus.el $(lisp)/mh-e/mh-identity.el \
303 $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-junk.el \
304 $(lisp)/mh-e/mh-letter.el $(lisp)/mh-e/mh-limit.el \
305 $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-print.el \
306 $(lisp)/mh-e/mh-scan.el $(lisp)/mh-e/mh-search.el \
307 $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-show.el \
308 $(lisp)/mh-e/mh-speed.el $(lisp)/mh-e/mh-thread.el \
309 $(lisp)/mh-e/mh-tool-bar.el $(lisp)/mh-e/mh-utils.el \
310 $(lisp)/mh-e/mh-xface.el
312 # See the commentary for autoloads above for why we use ./mh-e below
313 # instead of $(lisp)/mh-e.
314 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
315 $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC)
316 $(MAKE) $(MFLAGS) pre-mh-loaddefs.el-$(SHELLTYPE)
317 cp pre-mh-loaddefs.el-$(SHELLTYPE) $@
318 rm pre-mh-loaddefs.el-$(SHELLTYPE)
319 "$(EMACS)" $(EMACSOPT) \
321 --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
322 --eval "(setq find-file-suppress-same-file-warnings t)" \
323 --eval "(setq make-backup-files nil)" \
324 -f w32-batch-update-autoloads \
325 "$(lisp)/mh-e/mh-loaddefs.el" ./mh-e
327 pre-mh-loaddefs.el-SH:
328 echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
330 echo ";; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc." >> $@
331 echo ";; Author: Bill Wohler <wohler@newt.com>" >> $@
332 echo ";; Keywords: mail" >> $@
333 echo ";;; Commentary:" >> $@
334 echo ";;; Change Log:" >> $@
335 echo ";;; Code:" >> $@
337 echo "(provide 'mh-loaddefs)" >> $@
338 echo ";; Local Variables:" >> $@
339 echo ";; version-control: never" >> $@
340 echo ";; no-byte-compile: t" >> $@
341 echo ";; no-update-autoloads: t" >> $@
343 echo ";;; mh-loaddefs.el ends here" >> $@
345 pre-mh-loaddefs.el-CMD:
346 echo ;;; mh-loaddefs.el --- automatically extracted autoloads> $@
348 echo ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.>> $@
349 echo ;; Author: Bill Wohler (wohler@newt.com)>> $@
350 echo ;; Keywords: mail>> $@
351 echo ;;; Commentary:>> $@
352 echo ;;; Change Log:>> $@
355 echo (provide 'mh-loaddefs)>> $@
356 echo ;; Local Variables:>> $@
357 echo ;; version-control: never>> $@
358 echo ;; no-byte-compile: t>> $@
359 echo ;; no-update-autoloads: t>> $@
361 echo ;;; mh-loaddefs.el ends here>> $@
363 # Prepare a bootstrap in the lisp subdirectory.
365 # Build loaddefs.el to make sure it's up-to-date. If it's not, that
366 # might lead to errors during the bootstrap because something fails to
367 # autoload as expected. If there is no emacs binary, then we can't
368 # build autoloads yet. In that case we have to use ldefs-boot.el;
369 # bootstrap should always work with ldefs-boot.el. (Because
370 # loaddefs.el is an automatically generated file, we don't want to
371 # store it in the source repository).
373 # Remove compiled Lisp files so that bootstrap-emacs will be built from
376 # Need separate version for sh and native cmd.exe
377 # Note that bootstrap-clean-$(SHELLTYPE) copies ldefs-boot.el to loaddefs.el,
378 # and thus the almost-empty loaddefs.el crafted by the $(lisp)/loaddefs.el
379 # target can NOT be built _after_ bootstrap-clean-$(SHELLTYPE) does its
380 # thing, or else an empty loaddefs.el will overwrite the full one.
381 bootstrap-clean: $(lisp)/loaddefs.el
382 $(MAKE) $(MFLAGS) bootstrap-clean-$(SHELLTYPE)
385 # if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads
386 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
387 -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
390 # if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi
391 # -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
392 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
393 -for dir in . $(WINS); do rm -f $$dir/*.elc; done
395 # Generate/update files for the bootstrap process.
396 # When done, remove bootstrap-emacs from ../bin, so that
397 # it will not be mistaken for an installed binary.
399 bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps
403 # Assuming INSTALL_DIR is defined, copy the elisp files to it
404 # Windows 95 makes this harder than it should be.
407 - mkdir "$(INSTALL_DIR)/lisp"
408 - $(DEL) ../same-dir.tst
409 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
410 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
411 #ifdef COPY_LISP_SOURCE
412 $(IFNOTSAMEDIR) $(MAKE) $(MFLAGS) install-lisp-$(SHELLTYPE) $(ENDIF)
414 # $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
415 # $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
416 # $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
417 # $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
418 # $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
419 # $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
420 # $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
421 # $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
422 # $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
423 # $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
424 # $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
426 - $(DEL) ../same-dir.tst
427 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
429 # Need to copy *.el files first, to avoid "source file is newer" annoyance
430 # since cp does not preserve time stamps
432 cp -f *.el "$(INSTALL_DIR)/lisp"
433 for dir in $(WINS); do [ -d "$(INSTALL_DIR)/lisp/$$dir" ] || mkdir "$(INSTALL_DIR)/lisp/$$dir"; done
434 for dir in $(WINS); do cp -f $$dir/*.el "$(INSTALL_DIR)/lisp/$$dir"; done
435 for dir in . $(WINS); do cp $$dir/*.elc "$(INSTALL_DIR)/lisp/$$dir"; done
438 cp -f *.el "$(INSTALL_DIR)/lisp"
439 for %%f in ($(WINS)) do if not exist "$(INSTALL_DIR)/lisp/%%f" mkdir "$(INSTALL_DIR)/lisp/%%f"
440 for %%f in ($(WINS)) do cp -f %%f/*.el "$(INSTALL_DIR)/lisp/%%f"
441 for %%f in (. $(WINS)) do cp -f %%f/*.elc "$(INSTALL_DIR)/lisp/%%f"
446 # We used to delete *~ here, but that might inadvertently remove
447 # precious files if it happens to match their short 8+3 aliases.