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