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