Sync to HEAD
[bpt/emacs.git] / lisp / makefile.w32-in
CommitLineData
53b67fa0
AI
1# Makefile for GNU Emacs on the Microsoft W32 API.
2# Copyright (c) 2000-2001 Free Software Foundation, Inc.
7bbaaedd
AI
3#
4# This file is part of GNU Emacs.
c45dbde8 5#
7bbaaedd
AI
6# GNU Emacs is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
c45dbde8 10#
7bbaaedd
AI
11# GNU Emacs is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
c45dbde8 15#
7bbaaedd
AI
16# You should have received a copy of the GNU General Public License
17# along with GNU Emacs; see the file COPYING. If not, write to the
18# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19# Boston, MA 02111-1307, USA.
20#
21
22ALL =
23
24all: $(ALL)
25
26SQUOTE='
27# '
28
6610f4b2 29lisp = $(CURDIR)
9b006cb2 30srcdir = $(CURDIR)/..
7bbaaedd
AI
31
32# You can specify a different executable on the make command line,
33# e.g. "make EMACS=../src/emacs ...".
34
587b5737 35EMACS = "$(THISDIR)/../bin/emacs.exe"
7bbaaedd
AI
36
37# Command line flags for Emacs. This must include --multibyte,
38# otherwise some files will not compile.
39
40EMACSOPT = -batch --no-init-file --no-site-file --multibyte
41
cc7aa053
AI
42# Set EMACSLOADPATH correctly (already defined in environment).
43EMACSLOADPATH=$(lisp)
44
54a803c5
JR
45# Use C locale
46LC_ALL = C
47
7bbaaedd
AI
48lisptagsfiles1 = $(lisp)/*.el
49lisptagsfiles2 = $(lisp)/*/*.el
50ETAGS = "../lib-src/$(BLD)/etags"
51
9b006cb2
AI
52# Files which should not be compiled. If you change the name `DONTCOMPILE'
53# to something different, you'll have to change make-dist as well, and
54# modify the lists in $lisp and $shortlisp on src/Makefile.in.
55#
7bbaaedd
AI
56# - emacs-lisp/cl-specs.el: only contains `def-edebug-spec's so there's
57# no point compiling it, although it doesn't hurt.
58
59DONTCOMPILE = \
7bbaaedd 60 $(lisp)/cus-load.el \
7bbaaedd
AI
61 $(lisp)/emacs-lisp/cl-specs.el \
62 $(lisp)/eshell/esh-maint.el \
63 $(lisp)/eshell/esh-groups.el \
64 $(lisp)/finder-inf.el \
65 $(lisp)/forms-d2.el \
66 $(lisp)/forms-pass.el \
67 $(lisp)/generic-x.el \
54a803c5 68 $(lisp)/international/latin1-disp.el \
7bbaaedd 69 $(lisp)/international/mule-conf.el \
9b006cb2
AI
70 $(lisp)/language/czech.el \
71 $(lisp)/language/devanagari.el \
6b61353c 72 $(lisp)/language/kannada.el \
ddcb4d2f
JB
73 $(lisp)/language/malayalam.el \
74 $(lisp)/language/tamil.el \
9b006cb2
AI
75 $(lisp)/language/english.el \
76 $(lisp)/language/greek.el \
77 $(lisp)/language/hebrew.el \
78 $(lisp)/language/japanese.el \
79 $(lisp)/language/korean.el \
80 $(lisp)/language/lao.el \
81 $(lisp)/language/misc-lang.el \
82 $(lisp)/language/romanian.el \
83 $(lisp)/language/slovak.el \
84 $(lisp)/language/thai.el \
85 $(lisp)/language/utf-8-lang.el \
86 $(lisp)/language/georgian.el \
54a803c5
JR
87 $(lisp)/language/vietnamese.el \
88 $(lisp)/language/cyrillic.el \
89 $(lisp)/language/chinese.el \
90 $(lisp)/language/indian.el \
7bbaaedd 91 $(lisp)/loaddefs.el \
6b61353c 92 $(lisp)/ldefs-boot.el \
7bbaaedd
AI
93 $(lisp)/loadup.el \
94 $(lisp)/mail/blessmail.el \
7bbaaedd
AI
95 $(lisp)/patcomp.el \
96 $(lisp)/paths.el \
97 $(lisp)/play/bruce.el \
98 $(lisp)/subdirs.el \
99 $(lisp)/term/internal.el \
6c317bd2
GM
100 $(lisp)/term/AT386.el \
101 $(lisp)/term/apollo.el \
102 $(lisp)/term/bobcat.el \
103 $(lisp)/term/iris-ansi.el \
104 $(lisp)/term/keyswap.el \
105 $(lisp)/term/linux.el \
106 $(lisp)/term/lk201.el \
107 $(lisp)/term/news.el \
108 $(lisp)/term/vt102.el \
109 $(lisp)/term/vt125.el \
110 $(lisp)/term/vt200.el \
111 $(lisp)/term/vt201.el \
112 $(lisp)/term/vt220.el \
113 $(lisp)/term/vt240.el \
114 $(lisp)/term/vt300.el \
115 $(lisp)/term/vt320.el \
116 $(lisp)/term/vt400.el \
117 $(lisp)/term/vt420.el \
118 $(lisp)/term/wyse50.el \
7bbaaedd
AI
119 $(lisp)/version.el
120
170a9e70
GM
121# Files to compile before others during a bootstrap. This is done to
122# speed up the bootstrap process. The CC files are compiled first
123# because CC mode tweaks the compilation process, and requiring
124# cc-mode when it is not compiled doesn't work during the
125# bootstrapping.
7bbaaedd
AI
126
127COMPILE_FIRST = \
128 $(lisp)/emacs-lisp/byte-opt.el \
129 $(lisp)/emacs-lisp/bytecomp.el \
170a9e70
GM
130 $(lisp)/subr.el \
131 $(lisp)/progmodes/cc-mode.el \
132 $(lisp)/progmodes/cc-vars.el
7bbaaedd
AI
133
134# The actual Emacs command run in the targets below.
135
136emacs = $(EMACS) $(EMACSOPT)
137
138# Common command to find subdirectories
139
140setwins=subdirs=`find $$wd -type d -print`; \
141 for file in $$subdirs; do \
142 case $$file in */Old | */RCS | */CVS | */CVS/* | */=* ) ;; \
143 *) wins="$$wins $$file" ;; \
144 esac; \
145 done
146
147# Have to define the list of subdirs manually when not using sh.
148WINS=\
1142be39 149 calc \
7bbaaedd
AI
150 calendar \
151 emacs-lisp \
152 emulation \
153 eshell \
154 gnus \
155 international \
156 language \
157 mail \
942da20c 158 mh-e \
7bbaaedd 159 net \
1142be39 160 obsolete \
7bbaaedd
AI
161 play \
162 progmodes \
163 term \
b036f5d8 164 textmodes \
5e73ebb4 165 toolbar
7bbaaedd
AI
166
167doit:
168
169cus-load.el:
170 touch $@
171custom-deps: cus-load.el doit
172 @echo Directories: $(WINS)
cc7aa053 173 -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hooks nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS)
7bbaaedd 174
9b006cb2 175finder-data: doit
7bbaaedd
AI
176 @echo Directories: $(WINS)
177 $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS)
178
179loaddefs.el:
e22b24eb
AI
180 $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
181 cp loaddefs.el-$(SHELLTYPE) $@
182 rm loaddefs.el-$(SHELLTYPE)
183
184loaddefs.el-SH:
185 echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
186 echo ";;" >> $@; echo ";;; Code:" >> $@
187 echo "(autoload 'define-minor-mode \"easy-mmode\")" >>$@
188 echo "(autoload 'define-ccl-program \"ccl\")" >>$@
189 echo "(autoload 'regexp-opt \"regexp-opt\")" >>$@
190 echo "(autoload 'string-to-list \"mule-util\")" >>$@
191 echo "(autoload 'define-derived-mode \"derived\")" >>$@
192 echo "(autoload 'encoded-kbd-mode \"encoded-kb\")" >>$@
193 echo "(defvar cvs-global-menu nil)" >>$@
194 echo "\f" >> $@
195 echo ";;; Local Variables:" >> $@
196 echo ";;; version-control: never" >> $@
197 echo ";;; no-byte-compile: t" >> $@
198 echo ";;; no-update-autoloads: t" >> $@
199 echo ";;; End:" >> $@
200 echo ";;; loaddefs.el ends here" >> $@
201
202loaddefs.el-CMD:
7bbaaedd
AI
203 echo ;;; loaddefs.el --- automatically extracted autoloads> $@
204 echo ;;; Code:>> $@
e22b24eb
AI
205 echo (autoload 'define-minor-mode "easy-mmode")>> $@
206 echo (autoload 'define-ccl-program "ccl")>> $@
207 echo (autoload 'regexp-opt "regexp-opt")>> $@
208 echo (autoload 'string-to-list "mule-util")>> $@
209 echo (autoload 'define-derived-mode "derived")>> $@
210 echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@
211 echo (defvar cvs-global-menu nil)>> $@
212 echo.\f>> $@
7bbaaedd
AI
213 echo ;;; Local Variables:>> $@
214 echo ;;; version-control: never>> $@
215 echo ;;; no-byte-compile: t>> $@
216 echo ;;; no-update-autoloads: t>> $@
217 echo ;;; End:>> $@
218 echo ;;; loaddefs.el ends here>> $@
219
220autoloads: loaddefs.el doit
221 @echo Directories: $(WINS)
c5bdb93d
AI
222 $(emacs) -l autoload \
223 --eval $(ARGQUOTE)(setq find-file-hooks nil \
224 find-file-suppress-same-file-warnings t \
225 generated-autoload-file \
226 $(DQUOTE)$(lisp)/loaddefs.el$(DQUOTE))$(ARGQUOTE) \
227 -f batch-update-autoloads $(lisp) $(WINS)
7bbaaedd
AI
228
229subdirs.el:
230 $(MAKE) $(MFLAGS) update-subdirs
231
232# Need separate version for sh and native cmd.exe
233update-subdirs: update-subdirs-$(SHELLTYPE)
234
235update-subdirs-CMD: doit
c45dbde8
JB
236 echo ;; -*- no-byte-compile: t -*->subdirs.el
237 echo ;; In load-path, after this directory should come>> subdirs.el
7bbaaedd 238 echo ;; certain of its subdirectories. Here we specify them.>> subdirs.el
d053bf7e
JB
239 echo (normal-top-level-add-to-load-path $(SQUOTE)(>> subdirs.el
240 @for %d in ($(WINS)) do if not (%d)==(term) echo "%d">> subdirs.el
241 echo ))>> subdirs.el
7bbaaedd
AI
242
243update-subdirs-SH: doit
0cfc4b54 244 $(srcdir)/update-subdirs $(lisp); \
e22b24eb 245 for file in $(WINS); do \
7bbaaedd
AI
246 $(srcdir)/update-subdirs $$file; \
247 done;
248
249updates: update-subdirs autoloads finder-data custom-deps
250
9b006cb2
AI
251# Update the AUTHORS file.
252
253update-authors:
254 $(emacs) -f batch-update-authors $(srcdir)/AUTHORS $(srcdir)
255
7bbaaedd
AI
256TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
257 $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
258
9b006cb2
AI
259TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
260 $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
7bbaaedd 261
49060c51
AI
262.SUFFIXES: .elc .el
263
7bbaaedd 264.el.elc:
cc7aa053 265 -$(emacs) -f batch-byte-compile $<
7bbaaedd
AI
266
267$(DONTCOMPILE:.el=.elc):
268 -$(DEL) $@
269
9b006cb2
AI
270# Compile all Lisp files, except those from DONTCOMPILE,
271# but don't recompile those that are up to date.
272
273# All .elc files are made writable
7bbaaedd
AI
274# before compilation in case we checked out read-only (CVS option -r).
275# Files MUST be compiled one by one. If we compile several files in a
276# row we can't make sure that the compilation environment is clean.
277# We also set the load-path of the Emacs used for compilation to the
278# current directory and its subdirectories, to make sure require's and
279# load's in the files being compiled find the right files.
280
281# Need separate version for sh and native cmd.exe
d198b6f5 282compile: subdirs.el compile-$(SHELLTYPE) doit
7bbaaedd 283
d198b6f5 284compile-CMD:
9b006cb2 285# -for %f in ($(lisp) $(WINS)) do for %g in (%f\*.elc) do @attrib -r %g
e22b24eb
AI
286 for %f in ($(COMPILE_FIRST)) do \
287 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %f
288 for %f in (. $(WINS)) do for %g in (%f/*.el) do \
289 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %f/%g
0702b995 290
d198b6f5 291compile-SH:
9b006cb2
AI
292# for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
293 for el in $(COMPILE_FIRST); do \
294 echo Compiling $$el; \
e22b24eb 295 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
9b006cb2
AI
296 done
297 for dir in $(lisp) $(WINS); do \
298 for el in $$dir/*.el; do \
299 if test -f $$el; \
300 then \
301 echo Compiling $$el; \
e22b24eb 302 $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
9b006cb2
AI
303 fi \
304 done; \
305 done
306
307# Compile all Lisp files, except those from DONTCOMPILE. This
308# is like `compile' but compiles files unconditionally.
309compile-always: subdirs.el compile-always-$(SHELLTYPE) doit
310
311compile-always-CMD:
202c7edc 312# -for %f in ($(lisp) $(WINS)) do for %g in (%f\*.elc) do @attrib -r %g
7bbaaedd 313 for %f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %f
c5bdb93d 314 for %f in (. $(WINS)) do for %g in (%f/*.el) do $(emacs) -f batch-byte-compile %f/%g
7bbaaedd 315
9b006cb2 316compile-always-SH:
7bbaaedd
AI
317# for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
318 for el in $(COMPILE_FIRST); do \
319 echo Compiling $$el; \
9b006cb2 320 $(emacs) -f batch-byte-compile $$el || exit 1; \
7bbaaedd
AI
321 done
322 for dir in $(lisp) $(WINS); do \
323 for el in $$dir/*.el; do \
324 echo Compiling $$el; \
9b006cb2 325 $(emacs) -f batch-byte-compile $$el || exit 1; \
7bbaaedd
AI
326 done; \
327 done
328
9b006cb2
AI
329compile-calc: compile-calc-$(SHELLTYPE)
330
331compile-calc-CMD:
332 for %f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %f
333
c45dbde8 334compile-calc-SH:
9b006cb2
AI
335 for el in $(lisp)/calc/*.el; do \
336 echo Compiling $$el; \
337 $(emacs) -f batch-byte-compile $$el || exit 1; \
338 done
339
7bbaaedd
AI
340# Backup compiled Lisp files in elc.tar.gz. If that file already
341# exists, make a backup of it.
342
343backup-compiled-files:
344 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
345 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
346
347# Compile Lisp files, but save old compiled files first.
348
d198b6f5 349compile-after-backup: backup-compiled-files compile-always
7bbaaedd
AI
350
351# Recompile all Lisp files which are newer than their .elc files.
352# Note that this doesn't create .elc files. It only recompiles if an
353# .elc is present.
354
355recompile: doit
9b006cb2 356 $(emacs) -f batch-byte-recompile-directory $(lisp)
7bbaaedd 357
6b61353c
KH
358# Prepare a bootstrap in the lisp subdirectory.
359#
360# Build loaddefs.el, because it's not sure it's up-to-date, and if it's not,
361# that might lead to errors during the bootstrap because something fails to
362# autoload as expected. However, if there is no emacs binary, then we can't
363# build autoloads yet, so just make sure there's some loaddefs.el file, as
364# it's necessary for generating the binary (because loaddefs.el is an
365# automatically generated file, we don't want to store it in the source
366# repository).
367#
368# Remove compiled Lisp files so that bootstrap-emacs will be built from
369# sources only.
7bbaaedd
AI
370
371# Need separate version for sh and native cmd.exe
e22b24eb 372bootstrap-clean: bootstrap-clean-$(SHELLTYPE) loaddefs.el
7bbaaedd
AI
373
374bootstrap-clean-CMD:
5de7f0f7 375# if exist $(EMACS) $(MAKE) $(MFLAGS) autoloads
6b61353c 376 if not exist $(lisp)\loaddefs.el cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
c5bdb93d 377 -for %f in (. $(WINS)) do for %g in (%f\*.elc) do @$(DEL) %g
7bbaaedd
AI
378
379bootstrap-clean-SH:
5de7f0f7 380# if test -f $(EMACS); then $(MAKE) $(MFLAGS) autoloads; fi
a3599c30 381# -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
6b61353c
KH
382 if ! test -r $(lisp)/loaddefs.el; then \
383 cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el; \
384 fi
a3599c30 385 -for dir in . $(WINS); do rm -f $$dir/*.elc; done
7bbaaedd
AI
386
387# Generate/update files for the bootstrap process.
388
d198b6f5 389bootstrap: update-subdirs autoloads compile finder-data custom-deps
7bbaaedd
AI
390
391#
392# Assuming INSTALL_DIR is defined, copy the elisp files to it
393# Windows 95 makes this harder than it should be.
394#
395install:
396 - mkdir "$(INSTALL_DIR)/lisp"
397 - $(DEL) ../same-dir.tst
398 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
399 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
400#ifdef COPY_LISP_SOURCE
401 $(IFNOTSAMEDIR) $(CP_DIR) . "$(INSTALL_DIR)/lisp" $(ENDIF)
402#else
403# $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
404# $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
405# $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
406# $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
407# $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
408# $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
409# $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
410# $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
411# $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
412# $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
413# $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
414#endif
415 - $(DEL) ../same-dir.tst
416 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
417
418#
419# Maintenance
c45dbde8 420#
7bbaaedd
AI
421clean:
422 - $(DEL) *~
6b61353c
KH
423
424# arch-tag: bd03b562-c58d-4403-99db-c7bccd8c49a0