(bootstrap, $(lisp)/mh-e/mh-loaddefs.el): Quote $(EMACS).
[bpt/emacs.git] / lisp / makefile.w32-in
CommitLineData
bd6766d3 1# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
92b47a4a
TTN
2# Copyright (C) 2000, 2001, 2002, 2003, 2004,
3# 2005 Free Software Foundation, Inc.
7bbaaedd
AI
4#
5# This file is part of GNU Emacs.
c45dbde8 6#
7bbaaedd
AI
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 2, or (at your option)
10# any later version.
c45dbde8 11#
7bbaaedd
AI
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.
c45dbde8 16#
7bbaaedd
AI
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
086add15
LK
19# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20# Boston, MA 02110-1301, USA.
7bbaaedd
AI
21#
22
23ALL =
24
25all: $(ALL)
26
27SQUOTE='
28# '
29
6610f4b2 30lisp = $(CURDIR)
9b006cb2 31srcdir = $(CURDIR)/..
7bbaaedd
AI
32
33# You can specify a different executable on the make command line,
34# e.g. "make EMACS=../src/emacs ...".
35
3196bfd2 36EMACS = $(THISDIR)/../bin/emacs.exe
7bbaaedd
AI
37
38# Command line flags for Emacs. This must include --multibyte,
39# otherwise some files will not compile.
40
41EMACSOPT = -batch --no-init-file --no-site-file --multibyte
42
cc7aa053
AI
43# Set EMACSLOADPATH correctly (already defined in environment).
44EMACSLOADPATH=$(lisp)
45
7bbaaedd
AI
46lisptagsfiles1 = $(lisp)/*.el
47lisptagsfiles2 = $(lisp)/*/*.el
48ETAGS = "../lib-src/$(BLD)/etags"
49
170a9e70
GM
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
54# bootstrapping.
7bbaaedd
AI
55
56COMPILE_FIRST = \
57 $(lisp)/emacs-lisp/byte-opt.el \
58 $(lisp)/emacs-lisp/bytecomp.el \
170a9e70
GM
59 $(lisp)/subr.el \
60 $(lisp)/progmodes/cc-mode.el \
61 $(lisp)/progmodes/cc-vars.el
7bbaaedd
AI
62
63# The actual Emacs command run in the targets below.
3196bfd2
EZ
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.
7bbaaedd 67
3196bfd2 68emacs = "$(EMACS)" $(EMACSOPT)
7bbaaedd
AI
69
70# Common command to find subdirectories
71
72setwins=subdirs=`find $$wd -type d -print`; \
73 for file in $$subdirs; do \
74 case $$file in */Old | */RCS | */CVS | */CVS/* | */=* ) ;; \
75 *) wins="$$wins $$file" ;; \
76 esac; \
77 done
78
79# Have to define the list of subdirs manually when not using sh.
80WINS=\
1142be39 81 calc \
7bbaaedd
AI
82 calendar \
83 emacs-lisp \
84 emulation \
3e66f07c 85 erc \
7bbaaedd
AI
86 eshell \
87 gnus \
88 international \
89 language \
90 mail \
942da20c 91 mh-e \
7bbaaedd 92 net \
1142be39 93 obsolete \
7bbaaedd
AI
94 play \
95 progmodes \
96 term \
b036f5d8 97 textmodes \
05cecc58 98 url
7bbaaedd
AI
99
100doit:
101
bad197f0 102$(lisp)/cus-load.el:
7bbaaedd 103 touch $@
c3d49b7a
EZ
104# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
105# this can break with GNU Make 3.81 and later if sh.exe is used.
bad197f0 106custom-deps: $(lisp)/cus-load.el doit
7bbaaedd 107 @echo Directories: $(WINS)
5459bcdf 108 -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS)
7bbaaedd 109
9b006cb2 110finder-data: doit
7bbaaedd
AI
111 @echo Directories: $(WINS)
112 $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS)
113
bad197f0 114$(lisp)/loaddefs.el:
e22b24eb
AI
115 $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
116 cp loaddefs.el-$(SHELLTYPE) $@
117 rm loaddefs.el-$(SHELLTYPE)
118
119loaddefs.el-SH:
120 echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
121 echo ";;" >> $@; echo ";;; Code:" >> $@
122 echo "(autoload 'define-minor-mode \"easy-mmode\")" >>$@
123 echo "(autoload 'define-ccl-program \"ccl\")" >>$@
124 echo "(autoload 'regexp-opt \"regexp-opt\")" >>$@
125 echo "(autoload 'string-to-list \"mule-util\")" >>$@
126 echo "(autoload 'define-derived-mode \"derived\")" >>$@
127 echo "(autoload 'encoded-kbd-mode \"encoded-kb\")" >>$@
128 echo "(defvar cvs-global-menu nil)" >>$@
129 echo "\f" >> $@
130 echo ";;; Local Variables:" >> $@
131 echo ";;; version-control: never" >> $@
132 echo ";;; no-byte-compile: t" >> $@
133 echo ";;; no-update-autoloads: t" >> $@
134 echo ";;; End:" >> $@
135 echo ";;; loaddefs.el ends here" >> $@
136
137loaddefs.el-CMD:
7bbaaedd
AI
138 echo ;;; loaddefs.el --- automatically extracted autoloads> $@
139 echo ;;; Code:>> $@
e22b24eb
AI
140 echo (autoload 'define-minor-mode "easy-mmode")>> $@
141 echo (autoload 'define-ccl-program "ccl")>> $@
142 echo (autoload 'regexp-opt "regexp-opt")>> $@
143 echo (autoload 'string-to-list "mule-util")>> $@
144 echo (autoload 'define-derived-mode "derived")>> $@
145 echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@
146 echo (defvar cvs-global-menu nil)>> $@
bad197f0 147 echo.\f>> $@
7bbaaedd
AI
148 echo ;;; Local Variables:>> $@
149 echo ;;; version-control: never>> $@
150 echo ;;; no-byte-compile: t>> $@
151 echo ;;; no-update-autoloads: t>> $@
152 echo ;;; End:>> $@
153 echo ;;; loaddefs.el ends here>> $@
154
81293113
EZ
155# Use . instead of $(lisp) because $(lisp) is an absolute file name,
156# including a drive letter and any leading directories, so the generated
157# loaddefs.el will mention file names that on other machine reference
158# possibly non-existent directories.
c3d49b7a
EZ
159#
160# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
161# this can break with GNU Make 3.81 and later if sh.exe is used.
bad197f0 162autoloads: $(lisp)/loaddefs.el doit
81293113 163 @echo Directories: . $(WINS)
c5bdb93d 164 $(emacs) -l autoload \
7c417300
EZ
165 --eval $(ARGQUOTE)(setq find-file-hook nil find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
166 -f w32-batch-update-autoloads "$(lisp)/loaddefs.el" . $(WINS)
7bbaaedd 167
bad197f0 168$(lisp)/subdirs.el:
7bbaaedd
AI
169 $(MAKE) $(MFLAGS) update-subdirs
170
171# Need separate version for sh and native cmd.exe
172update-subdirs: update-subdirs-$(SHELLTYPE)
173
174update-subdirs-CMD: doit
bad197f0
JR
175 echo ;; -*- no-byte-compile: t -*-> $(lisp)/subdirs.el
176 echo ;; In load-path, after this directory should come>> $(lisp)/subdirs.el
177 echo ;; certain of its subdirectories. Here we specify them.>> $(lisp)/subdirs.el
178 echo (normal-top-level-add-to-load-path $(SQUOTE)(>> $(lisp)/subdirs.el
179 @for %%d in ($(WINS)) do if not (%%d)==(term) echo "%%d">> $(lisp)/subdirs.el
180 echo ))>> $(lisp)/subdirs.el
7bbaaedd
AI
181
182update-subdirs-SH: doit
0cfc4b54 183 $(srcdir)/update-subdirs $(lisp); \
e22b24eb 184 for file in $(WINS); do \
7bbaaedd
AI
185 $(srcdir)/update-subdirs $$file; \
186 done;
187
ba2b2673 188updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
7bbaaedd 189
a9d25c79
EZ
190# This is useful after "cvs up".
191cvs-update: recompile autoloads finder-data custom-deps
192
9b006cb2
AI
193# Update the AUTHORS file.
194
195update-authors:
8f801552 196 $(emacs) -l authors -f batch-update-authors $(srcdir)/AUTHORS $(srcdir)
9b006cb2 197
7bbaaedd
AI
198TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
199 $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
200
9b006cb2
AI
201TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
202 $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
7bbaaedd 203
49060c51
AI
204.SUFFIXES: .elc .el
205
7bbaaedd 206.el.elc:
cc7aa053 207 -$(emacs) -f batch-byte-compile $<
7bbaaedd 208
8f801552
LK
209# Compile all Lisp files, but don't recompile those that are up to
210# date. Some files don't actually get compiled because they set the
211# local variable no-byte-compile.
7bbaaedd 212
8f801552
LK
213# All .elc files are made writable before compilation in case we
214# checked out read-only (CVS option -r). Files MUST be compiled one by
215# one. If we compile several files in a row we can't make sure that
216# the compilation environment is clean. We also set the load-path of
217# the Emacs used for compilation to the current directory and its
218# subdirectories, to make sure require's and load's in the files being
219# compiled find the right files.
7bbaaedd
AI
220
221# Need separate version for sh and native cmd.exe
bad197f0 222compile: $(lisp)/subdirs.el mh-autoloads compile-$(SHELLTYPE) doit
7bbaaedd 223
d198b6f5 224compile-CMD:
80bb1e21
JR
225# -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
226 for %%f in ($(COMPILE_FIRST)) do \
227 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f
228 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \
229 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f/%%g
0702b995 230
d198b6f5 231compile-SH:
9b006cb2
AI
232# for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
233 for el in $(COMPILE_FIRST); do \
234 echo Compiling $$el; \
e22b24eb 235 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
9b006cb2
AI
236 done
237 for dir in $(lisp) $(WINS); do \
238 for el in $$dir/*.el; do \
239 if test -f $$el; \
240 then \
241 echo Compiling $$el; \
e22b24eb 242 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
9b006cb2
AI
243 fi \
244 done; \
245 done
246
8f801552
LK
247# Compile all Lisp files. This is like `compile' but compiles files
248# unconditionally. Some files don't actually get compiled because they
249# set the local variable no-byte-compile.
250
bad197f0 251compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
9b006cb2
AI
252
253compile-always-CMD:
80bb1e21
JR
254# -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
255 for %%f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %%f
256 for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) -f batch-byte-compile %%f/%%g
7bbaaedd 257
9b006cb2 258compile-always-SH:
7bbaaedd
AI
259# for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
260 for el in $(COMPILE_FIRST); do \
261 echo Compiling $$el; \
9b006cb2 262 $(emacs) -f batch-byte-compile $$el || exit 1; \
7bbaaedd
AI
263 done
264 for dir in $(lisp) $(WINS); do \
265 for el in $$dir/*.el; do \
266 echo Compiling $$el; \
9b006cb2 267 $(emacs) -f batch-byte-compile $$el || exit 1; \
7bbaaedd
AI
268 done; \
269 done
270
9b006cb2
AI
271compile-calc: compile-calc-$(SHELLTYPE)
272
273compile-calc-CMD:
80bb1e21 274 for %%f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %%f
9b006cb2 275
c45dbde8 276compile-calc-SH:
9b006cb2
AI
277 for el in $(lisp)/calc/*.el; do \
278 echo Compiling $$el; \
279 $(emacs) -f batch-byte-compile $$el || exit 1; \
280 done
281
7bbaaedd
AI
282# Backup compiled Lisp files in elc.tar.gz. If that file already
283# exists, make a backup of it.
284
285backup-compiled-files:
286 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
287 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
288
289# Compile Lisp files, but save old compiled files first.
290
d198b6f5 291compile-after-backup: backup-compiled-files compile-always
7bbaaedd
AI
292
293# Recompile all Lisp files which are newer than their .elc files.
294# Note that this doesn't create .elc files. It only recompiles if an
295# .elc is present.
53fad1e4
EZ
296# WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
297# this can break with GNU Make 3.81 and later if sh.exe is used.
298recompile: mh-autoloads doit $(lisp)/progmodes/cc-mode.elc
299 $(emacs) --eval $(ARGQUOTE)(batch-byte-recompile-directory 0)$(ARGQUOTE) $(lisp)
7bbaaedd 300
ba2b2673
BW
301# Update MH-E internal autoloads. These are not to be confused with
302# the autoloads for the MH-E entry points, which are already in
303# loaddefs.el.
e9b28650 304MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \
3e66f07c
JB
305 $(lisp)/mh-e/mh-buffers.el $(lisp)/mh-e/mh-compat.el \
306 $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-e.el \
307 $(lisp)/mh-e/mh-folder.el $(lisp)/mh-e/mh-funcs.el \
308 $(lisp)/mh-e/mh-gnus.el $(lisp)/mh-e/mh-identity.el \
309 $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-junk.el \
310 $(lisp)/mh-e/mh-letter.el $(lisp)/mh-e/mh-limit.el \
311 $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-print.el \
312 $(lisp)/mh-e/mh-scan.el $(lisp)/mh-e/mh-search.el \
313 $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-show.el \
314 $(lisp)/mh-e/mh-speed.el $(lisp)/mh-e/mh-thread.el \
315 $(lisp)/mh-e/mh-tool-bar.el $(lisp)/mh-e/mh-utils.el \
316 $(lisp)/mh-e/mh-xface.el
ba2b2673
BW
317
318mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
e9b28650 319$(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC)
e3188d80
JR
320 $(MAKE) $(MFLAGS) pre-mh-loaddefs.el-$(SHELLTYPE)
321 cp pre-mh-loaddefs.el-$(SHELLTYPE) $@
bad197f0 322 rm pre-mh-loaddefs.el-$(SHELLTYPE)
3152b1eb 323 "$(EMACS)" $(EMACSOPT) \
e3188d80
JR
324 -l autoload \
325 --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
a5f271ab 326 --eval "(setq find-file-suppress-same-file-warnings t)" \
e3188d80 327 --eval "(setq make-backup-files nil)" \
7c417300
EZ
328 -f w32-batch-update-autoloads \
329 "$(lisp)/mh-e/mh-loaddefs.el" $(lisp)/mh-e
e3188d80
JR
330
331pre-mh-loaddefs.el-SH:
ba2b2673
BW
332 echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
333 echo ";;" >> $@
53fad1e4
EZ
334 echo ";; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc." >> $@
335 echo ";; Author: Bill Wohler <wohler@newt.com>" >> $@
336 echo ";; Keywords: mail" >> $@
ba2b2673
BW
337 echo ";;; Commentary:" >> $@
338 echo ";;; Change Log:" >> $@
339 echo ";;; Code:" >> $@
ba2b2673
BW
340 echo "\f" >> $@
341 echo "(provide 'mh-loaddefs)" >> $@
53fad1e4
EZ
342 echo ";; Local Variables:" >> $@
343 echo ";; version-control: never" >> $@
344 echo ";; no-byte-compile: t" >> $@
345 echo ";; no-update-autoloads: t" >> $@
346 echo ";; End:" >> $@
ba2b2673
BW
347 echo ";;; mh-loaddefs.el ends here" >> $@
348
e3188d80
JR
349pre-mh-loaddefs.el-CMD:
350 echo ;;; mh-loaddefs.el --- automatically extracted autoloads> $@
351 echo ;;>> $@
53fad1e4
EZ
352 echo ;; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.>> $@
353 echo ;; Author: Bill Wohler (wohler@newt.com)>> $@
354 echo ;; Keywords: mail>> $@
e3188d80
JR
355 echo ;;; Commentary:>> $@
356 echo ;;; Change Log:>> $@
357 echo ;;; Code:>> $@
358 echo.\f>> $@
359 echo (provide 'mh-loaddefs)>> $@
53fad1e4
EZ
360 echo ;; Local Variables:>> $@
361 echo ;; version-control: never>> $@
362 echo ;; no-byte-compile: t>> $@
363 echo ;; no-update-autoloads: t>> $@
364 echo ;; End:>> $@
e3188d80
JR
365 echo ;;; mh-loaddefs.el ends here>> $@
366
54ab09c4
MB
367# Prepare a bootstrap in the lisp subdirectory.
368#
e8dbbf6f
EZ
369# Build loaddefs.el to make sure it's up-to-date. If it's not, that
370# might lead to errors during the bootstrap because something fails to
371# autoload as expected. If there is no emacs binary, then we can't
372# build autoloads yet. In that case we have to use ldefs-boot.el;
373# bootstrap should always work with ldefs-boot.el. (Because
374# loaddefs.el is an automatically generated file, we don't want to
375# store it in the source repository).
54ab09c4
MB
376#
377# Remove compiled Lisp files so that bootstrap-emacs will be built from
378# sources only.
7bbaaedd
AI
379
380# Need separate version for sh and native cmd.exe
bad197f0 381bootstrap-clean: bootstrap-clean-$(SHELLTYPE) $(lisp)/loaddefs.el
7bbaaedd
AI
382
383bootstrap-clean-CMD:
3152b1eb 384# if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads
e8dbbf6f 385 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
80bb1e21 386 -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
7bbaaedd
AI
387
388bootstrap-clean-SH:
3152b1eb 389# if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi
a3599c30 390# -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
e8dbbf6f 391 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
a3599c30 392 -for dir in . $(WINS); do rm -f $$dir/*.elc; done
7bbaaedd
AI
393
394# Generate/update files for the bootstrap process.
014b37b6
EZ
395# When done, remove bootstrap-emacs from ../bin, so that
396# it will not be mistaken for an installed binary.
7bbaaedd 397
ba2b2673 398bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps
3152b1eb 399 - $(DEL) "$(EMACS)"
7bbaaedd
AI
400
401#
402# Assuming INSTALL_DIR is defined, copy the elisp files to it
403# Windows 95 makes this harder than it should be.
404#
405install:
406 - mkdir "$(INSTALL_DIR)/lisp"
407 - $(DEL) ../same-dir.tst
408 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
409 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
410#ifdef COPY_LISP_SOURCE
411 $(IFNOTSAMEDIR) $(CP_DIR) . "$(INSTALL_DIR)/lisp" $(ENDIF)
412#else
413# $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
414# $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
415# $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
416# $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
417# $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
418# $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
419# $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
420# $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
421# $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
422# $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
423# $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
424#endif
425 - $(DEL) ../same-dir.tst
426 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
427
428#
429# Maintenance
c45dbde8 430#
7bbaaedd
AI
431clean:
432 - $(DEL) *~