(bootstrap, $(lisp)/mh-e/mh-loaddefs.el): Quote $(EMACS).
[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 # 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.
67
68 emacs = "$(EMACS)" $(EMACSOPT)
69
70 # Common command to find subdirectories
71
72 setwins=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.
80 WINS=\
81 calc \
82 calendar \
83 emacs-lisp \
84 emulation \
85 erc \
86 eshell \
87 gnus \
88 international \
89 language \
90 mail \
91 mh-e \
92 net \
93 obsolete \
94 play \
95 progmodes \
96 term \
97 textmodes \
98 url
99
100 doit:
101
102 $(lisp)/cus-load.el:
103 touch $@
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.
106 custom-deps: $(lisp)/cus-load.el doit
107 @echo Directories: $(WINS)
108 -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS)
109
110 finder-data: doit
111 @echo Directories: $(WINS)
112 $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS)
113
114 $(lisp)/loaddefs.el:
115 $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
116 cp loaddefs.el-$(SHELLTYPE) $@
117 rm loaddefs.el-$(SHELLTYPE)
118
119 loaddefs.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
137 loaddefs.el-CMD:
138 echo ;;; loaddefs.el --- automatically extracted autoloads> $@
139 echo ;;; Code:>> $@
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)>> $@
147 echo.\f>> $@
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
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.
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.
162 autoloads: $(lisp)/loaddefs.el doit
163 @echo Directories: . $(WINS)
164 $(emacs) -l autoload \
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)
167
168 $(lisp)/subdirs.el:
169 $(MAKE) $(MFLAGS) update-subdirs
170
171 # Need separate version for sh and native cmd.exe
172 update-subdirs: update-subdirs-$(SHELLTYPE)
173
174 update-subdirs-CMD: doit
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
181
182 update-subdirs-SH: doit
183 $(srcdir)/update-subdirs $(lisp); \
184 for file in $(WINS); do \
185 $(srcdir)/update-subdirs $$file; \
186 done;
187
188 updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
189
190 # This is useful after "cvs up".
191 cvs-update: recompile autoloads finder-data custom-deps
192
193 # Update the AUTHORS file.
194
195 update-authors:
196 $(emacs) -l authors -f batch-update-authors $(srcdir)/AUTHORS $(srcdir)
197
198 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
199 $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
200
201 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
202 $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
203
204 .SUFFIXES: .elc .el
205
206 .el.elc:
207 -$(emacs) -f batch-byte-compile $<
208
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.
212
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.
220
221 # Need separate version for sh and native cmd.exe
222 compile: $(lisp)/subdirs.el mh-autoloads compile-$(SHELLTYPE) doit
223
224 compile-CMD:
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
230
231 compile-SH:
232 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
233 for el in $(COMPILE_FIRST); do \
234 echo Compiling $$el; \
235 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
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; \
242 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
243 fi \
244 done; \
245 done
246
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
251 compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
252
253 compile-always-CMD:
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
257
258 compile-always-SH:
259 # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
260 for el in $(COMPILE_FIRST); do \
261 echo Compiling $$el; \
262 $(emacs) -f batch-byte-compile $$el || exit 1; \
263 done
264 for dir in $(lisp) $(WINS); do \
265 for el in $$dir/*.el; do \
266 echo Compiling $$el; \
267 $(emacs) -f batch-byte-compile $$el || exit 1; \
268 done; \
269 done
270
271 compile-calc: compile-calc-$(SHELLTYPE)
272
273 compile-calc-CMD:
274 for %%f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %%f
275
276 compile-calc-SH:
277 for el in $(lisp)/calc/*.el; do \
278 echo Compiling $$el; \
279 $(emacs) -f batch-byte-compile $$el || exit 1; \
280 done
281
282 # Backup compiled Lisp files in elc.tar.gz. If that file already
283 # exists, make a backup of it.
284
285 backup-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
291 compile-after-backup: backup-compiled-files compile-always
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.
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.
298 recompile: mh-autoloads doit $(lisp)/progmodes/cc-mode.elc
299 $(emacs) --eval $(ARGQUOTE)(batch-byte-recompile-directory 0)$(ARGQUOTE) $(lisp)
300
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.
304 MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el \
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
317
318 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
319 $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC)
320 $(MAKE) $(MFLAGS) pre-mh-loaddefs.el-$(SHELLTYPE)
321 cp pre-mh-loaddefs.el-$(SHELLTYPE) $@
322 rm pre-mh-loaddefs.el-$(SHELLTYPE)
323 "$(EMACS)" $(EMACSOPT) \
324 -l autoload \
325 --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
326 --eval "(setq find-file-suppress-same-file-warnings t)" \
327 --eval "(setq make-backup-files nil)" \
328 -f w32-batch-update-autoloads \
329 "$(lisp)/mh-e/mh-loaddefs.el" $(lisp)/mh-e
330
331 pre-mh-loaddefs.el-SH:
332 echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
333 echo ";;" >> $@
334 echo ";; Copyright (C) 2003, 2004, 2005, 2006 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
349 pre-mh-loaddefs.el-CMD:
350 echo ;;; mh-loaddefs.el --- automatically extracted autoloads> $@
351 echo ;;>> $@
352 echo ;; Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.>> $@
353 echo ;; Author: Bill Wohler (wohler@newt.com)>> $@
354 echo ;; Keywords: mail>> $@
355 echo ;;; Commentary:>> $@
356 echo ;;; Change Log:>> $@
357 echo ;;; Code:>> $@
358 echo.\f>> $@
359 echo (provide 'mh-loaddefs)>> $@
360 echo ;; Local Variables:>> $@
361 echo ;; version-control: never>> $@
362 echo ;; no-byte-compile: t>> $@
363 echo ;; no-update-autoloads: t>> $@
364 echo ;; End:>> $@
365 echo ;;; mh-loaddefs.el ends here>> $@
366
367 # Prepare a bootstrap in the lisp subdirectory.
368 #
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).
376 #
377 # Remove compiled Lisp files so that bootstrap-emacs will be built from
378 # sources only.
379
380 # Need separate version for sh and native cmd.exe
381 bootstrap-clean: bootstrap-clean-$(SHELLTYPE) $(lisp)/loaddefs.el
382
383 bootstrap-clean-CMD:
384 # if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads
385 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
386 -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
387
388 bootstrap-clean-SH:
389 # if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi
390 # -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
391 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
392 -for dir in . $(WINS); do rm -f $$dir/*.elc; done
393
394 # Generate/update files for the bootstrap process.
395 # When done, remove bootstrap-emacs from ../bin, so that
396 # it will not be mistaken for an installed binary.
397
398 bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps
399 - $(DEL) "$(EMACS)"
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 #
405 install:
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
430 #
431 clean:
432 - $(DEL) *~