(CURDIR): Convert to native Windows format (with
[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
7bbaaedd
AI
45lisptagsfiles1 = $(lisp)/*.el
46lisptagsfiles2 = $(lisp)/*/*.el
47ETAGS = "../lib-src/$(BLD)/etags"
48
9b006cb2
AI
49# Files which should not be compiled. If you change the name `DONTCOMPILE'
50# to something different, you'll have to change make-dist as well, and
51# modify the lists in $lisp and $shortlisp on src/Makefile.in.
52#
7bbaaedd
AI
53# - emacs-lisp/cl-specs.el: only contains `def-edebug-spec's so there's
54# no point compiling it, although it doesn't hurt.
55
56DONTCOMPILE = \
7bbaaedd 57 $(lisp)/cus-load.el \
7bbaaedd
AI
58 $(lisp)/emacs-lisp/cl-specs.el \
59 $(lisp)/eshell/esh-maint.el \
60 $(lisp)/eshell/esh-groups.el \
61 $(lisp)/finder-inf.el \
62 $(lisp)/forms-d2.el \
63 $(lisp)/forms-pass.el \
64 $(lisp)/generic-x.el \
65 $(lisp)/international/latin-1.el \
66 $(lisp)/international/latin-2.el \
67 $(lisp)/international/latin-3.el \
68 $(lisp)/international/latin-4.el \
69 $(lisp)/international/latin-5.el \
70 $(lisp)/international/latin-8.el \
71 $(lisp)/international/latin-9.el \
72 $(lisp)/international/mule-conf.el \
9b006cb2
AI
73 $(lisp)/language/czech.el \
74 $(lisp)/language/devanagari.el \
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 \
7bbaaedd
AI
87 $(lisp)/loaddefs.el \
88 $(lisp)/loadup.el \
89 $(lisp)/mail/blessmail.el \
7bbaaedd
AI
90 $(lisp)/patcomp.el \
91 $(lisp)/paths.el \
92 $(lisp)/play/bruce.el \
93 $(lisp)/subdirs.el \
94 $(lisp)/term/internal.el \
6c317bd2
GM
95 $(lisp)/term/AT386.el \
96 $(lisp)/term/apollo.el \
97 $(lisp)/term/bobcat.el \
98 $(lisp)/term/iris-ansi.el \
99 $(lisp)/term/keyswap.el \
100 $(lisp)/term/linux.el \
101 $(lisp)/term/lk201.el \
102 $(lisp)/term/news.el \
103 $(lisp)/term/vt102.el \
104 $(lisp)/term/vt125.el \
105 $(lisp)/term/vt200.el \
106 $(lisp)/term/vt201.el \
107 $(lisp)/term/vt220.el \
108 $(lisp)/term/vt240.el \
109 $(lisp)/term/vt300.el \
110 $(lisp)/term/vt320.el \
111 $(lisp)/term/vt400.el \
112 $(lisp)/term/vt420.el \
113 $(lisp)/term/wyse50.el \
7bbaaedd
AI
114 $(lisp)/version.el
115
170a9e70
GM
116# Files to compile before others during a bootstrap. This is done to
117# speed up the bootstrap process. The CC files are compiled first
118# because CC mode tweaks the compilation process, and requiring
119# cc-mode when it is not compiled doesn't work during the
120# bootstrapping.
7bbaaedd
AI
121
122COMPILE_FIRST = \
123 $(lisp)/emacs-lisp/byte-opt.el \
124 $(lisp)/emacs-lisp/bytecomp.el \
170a9e70
GM
125 $(lisp)/subr.el \
126 $(lisp)/progmodes/cc-mode.el \
127 $(lisp)/progmodes/cc-vars.el
7bbaaedd
AI
128
129# The actual Emacs command run in the targets below.
130
131emacs = $(EMACS) $(EMACSOPT)
132
133# Common command to find subdirectories
134
135setwins=subdirs=`find $$wd -type d -print`; \
136 for file in $$subdirs; do \
137 case $$file in */Old | */RCS | */CVS | */CVS/* | */=* ) ;; \
138 *) wins="$$wins $$file" ;; \
139 esac; \
140 done
141
142# Have to define the list of subdirs manually when not using sh.
143WINS=\
1142be39 144 calc \
7bbaaedd
AI
145 calendar \
146 emacs-lisp \
147 emulation \
148 eshell \
149 gnus \
150 international \
151 language \
152 mail \
153 net \
1142be39 154 obsolete \
7bbaaedd
AI
155 play \
156 progmodes \
157 term \
b036f5d8 158 textmodes \
5e73ebb4 159 toolbar
7bbaaedd
AI
160
161doit:
162
163cus-load.el:
164 touch $@
165custom-deps: cus-load.el doit
166 @echo Directories: $(WINS)
cc7aa053 167 -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hooks nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS)
7bbaaedd 168
9b006cb2 169finder-data: doit
7bbaaedd
AI
170 @echo Directories: $(WINS)
171 $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS)
172
173loaddefs.el:
174 echo ;;; loaddefs.el --- automatically extracted autoloads> $@
175 echo ;;; Code:>> $@
176 echo \f>> $@
177 echo ;;; Local Variables:>> $@
178 echo ;;; version-control: never>> $@
179 echo ;;; no-byte-compile: t>> $@
180 echo ;;; no-update-autoloads: t>> $@
181 echo ;;; End:>> $@
182 echo ;;; loaddefs.el ends here>> $@
183
184autoloads: loaddefs.el doit
185 @echo Directories: $(WINS)
c5bdb93d
AI
186 $(emacs) -l autoload \
187 --eval $(ARGQUOTE)(setq find-file-hooks nil \
188 find-file-suppress-same-file-warnings t \
189 generated-autoload-file \
190 $(DQUOTE)$(lisp)/loaddefs.el$(DQUOTE))$(ARGQUOTE) \
191 -f batch-update-autoloads $(lisp) $(WINS)
7bbaaedd
AI
192
193subdirs.el:
194 $(MAKE) $(MFLAGS) update-subdirs
195
196# Need separate version for sh and native cmd.exe
197update-subdirs: update-subdirs-$(SHELLTYPE)
198
199update-subdirs-CMD: doit
c45dbde8
JB
200 echo ;; -*- no-byte-compile: t -*->subdirs.el
201 echo ;; In load-path, after this directory should come>> subdirs.el
7bbaaedd 202 echo ;; certain of its subdirectories. Here we specify them.>> subdirs.el
d053bf7e
JB
203 echo (normal-top-level-add-to-load-path $(SQUOTE)(>> subdirs.el
204 @for %d in ($(WINS)) do if not (%d)==(term) echo "%d">> subdirs.el
205 echo ))>> subdirs.el
7bbaaedd
AI
206
207update-subdirs-SH: doit
208 wd=$(lisp); $(setwins); \
209 for file in $$wins; do \
210 $(srcdir)/update-subdirs $$file; \
211 done;
212
213updates: update-subdirs autoloads finder-data custom-deps
214
9b006cb2
AI
215# Update the AUTHORS file.
216
217update-authors:
218 $(emacs) -f batch-update-authors $(srcdir)/AUTHORS $(srcdir)
219
7bbaaedd
AI
220TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
221 $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
222
9b006cb2
AI
223TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
224 $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
7bbaaedd 225
49060c51
AI
226.SUFFIXES: .elc .el
227
7bbaaedd 228.el.elc:
cc7aa053 229 -$(emacs) -f batch-byte-compile $<
7bbaaedd
AI
230
231$(DONTCOMPILE:.el=.elc):
232 -$(DEL) $@
233
9b006cb2
AI
234# Compile all Lisp files, except those from DONTCOMPILE,
235# but don't recompile those that are up to date.
236
237# All .elc files are made writable
7bbaaedd
AI
238# before compilation in case we checked out read-only (CVS option -r).
239# Files MUST be compiled one by one. If we compile several files in a
240# row we can't make sure that the compilation environment is clean.
241# We also set the load-path of the Emacs used for compilation to the
242# current directory and its subdirectories, to make sure require's and
243# load's in the files being compiled find the right files.
244
245# Need separate version for sh and native cmd.exe
d198b6f5 246compile: subdirs.el compile-$(SHELLTYPE) doit
7bbaaedd 247
d198b6f5 248compile-CMD:
9b006cb2 249# -for %f in ($(lisp) $(WINS)) do for %g in (%f\*.elc) do @attrib -r %g
0702b995
JB
250 for %f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %f
251 for %f in (. $(WINS)) do for %g in (%f/*.el) do $(emacs) -f batch-byte-compile %f/%g
252
d198b6f5 253compile-SH:
9b006cb2
AI
254# for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
255 for el in $(COMPILE_FIRST); do \
256 echo Compiling $$el; \
257 $(emacs) -f batch-byte-compile $$el; \
258 done
259 for dir in $(lisp) $(WINS); do \
260 for el in $$dir/*.el; do \
261 if test -f $$el; \
262 then \
263 echo Compiling $$el; \
264 $(emacs) -f batch-byte-compile-if-not-done $$el; \
265 fi \
266 done; \
267 done
268
269# Compile all Lisp files, except those from DONTCOMPILE. This
270# is like `compile' but compiles files unconditionally.
271compile-always: subdirs.el compile-always-$(SHELLTYPE) doit
272
273compile-always-CMD:
202c7edc 274# -for %f in ($(lisp) $(WINS)) do for %g in (%f\*.elc) do @attrib -r %g
7bbaaedd 275 for %f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %f
c5bdb93d 276 for %f in (. $(WINS)) do for %g in (%f/*.el) do $(emacs) -f batch-byte-compile %f/%g
7bbaaedd 277
9b006cb2 278compile-always-SH:
7bbaaedd
AI
279# for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
280 for el in $(COMPILE_FIRST); do \
281 echo Compiling $$el; \
9b006cb2 282 $(emacs) -f batch-byte-compile $$el || exit 1; \
7bbaaedd
AI
283 done
284 for dir in $(lisp) $(WINS); do \
285 for el in $$dir/*.el; do \
286 echo Compiling $$el; \
9b006cb2 287 $(emacs) -f batch-byte-compile $$el || exit 1; \
7bbaaedd
AI
288 done; \
289 done
290
9b006cb2
AI
291compile-calc: compile-calc-$(SHELLTYPE)
292
293compile-calc-CMD:
294 for %f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %f
295
c45dbde8 296compile-calc-SH:
9b006cb2
AI
297 for el in $(lisp)/calc/*.el; do \
298 echo Compiling $$el; \
299 $(emacs) -f batch-byte-compile $$el || exit 1; \
300 done
301
7bbaaedd
AI
302# Backup compiled Lisp files in elc.tar.gz. If that file already
303# exists, make a backup of it.
304
305backup-compiled-files:
306 -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
307 -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
308
309# Compile Lisp files, but save old compiled files first.
310
d198b6f5 311compile-after-backup: backup-compiled-files compile-always
7bbaaedd
AI
312
313# Recompile all Lisp files which are newer than their .elc files.
314# Note that this doesn't create .elc files. It only recompiles if an
315# .elc is present.
316
317recompile: doit
9b006cb2 318 $(emacs) -f batch-byte-recompile-directory $(lisp)
7bbaaedd
AI
319
320# Prepare a bootstrap in the lisp subdirectory. Build loaddefs.el,
321# because it's not sure it's up-to-date, and if it's not, that might
322# lead to errors during the bootstrap because something fails to
323# autoload as expected. Remove compiled Lisp files so that
324# bootstrap-emacs will be built from sources only.
325
326# Need separate version for sh and native cmd.exe
327bootstrap-clean: bootstrap-clean-$(SHELLTYPE)
328
329bootstrap-clean-CMD:
5de7f0f7 330# if exist $(EMACS) $(MAKE) $(MFLAGS) autoloads
c5bdb93d 331 -for %f in (. $(WINS)) do for %g in (%f\*.elc) do @$(DEL) %g
7bbaaedd
AI
332
333bootstrap-clean-SH:
5de7f0f7 334# if test -f $(EMACS); then $(MAKE) $(MFLAGS) autoloads; fi
a3599c30
AI
335# -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
336 -for dir in . $(WINS); do rm -f $$dir/*.elc; done
7bbaaedd
AI
337
338# Generate/update files for the bootstrap process.
339
d198b6f5 340bootstrap: update-subdirs autoloads compile finder-data custom-deps
7bbaaedd
AI
341
342#
343# Assuming INSTALL_DIR is defined, copy the elisp files to it
344# Windows 95 makes this harder than it should be.
345#
346install:
347 - mkdir "$(INSTALL_DIR)/lisp"
348 - $(DEL) ../same-dir.tst
349 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
350 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
351#ifdef COPY_LISP_SOURCE
352 $(IFNOTSAMEDIR) $(CP_DIR) . "$(INSTALL_DIR)/lisp" $(ENDIF)
353#else
354# $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
355# $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
356# $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
357# $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
358# $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
359# $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
360# $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
361# $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
362# $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
363# $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
364# $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
365#endif
366 - $(DEL) ../same-dir.tst
367 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
368
369#
370# Maintenance
c45dbde8 371#
7bbaaedd
AI
372clean:
373 - $(DEL) *~