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