(diff-default-read-only): Change default.
[emacs.git] / lisp / makefile.w32-in
blobb050d78f76c6030aedf52330d86f624bdb666ff7
1 #  Makefile for GNU Emacs on the Microsoft W32 API.
2 #  Copyright (c) 2000-2001 Free Software Foundation, Inc.
4 #  This file is part of GNU Emacs.
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.
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.
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.
22 ALL =
24 all: $(ALL)
26 SQUOTE='
27 # '
29 lisp = $(CURDIR)
30 srcdir = $(CURDIR)/..
32 # You can specify a different executable on the make command line,
33 # e.g. "make EMACS=../src/emacs ...".
35 EMACS = "$(THISDIR)/../bin/emacs.exe"
37 # Command line flags for Emacs.  This must include --multibyte,
38 # otherwise some files will not compile.
40 EMACSOPT = -batch --no-init-file --no-site-file --multibyte
42 # Set EMACSLOADPATH correctly (already defined in environment).
43 EMACSLOADPATH=$(lisp)
45 lisptagsfiles1 = $(lisp)/*.el
46 lisptagsfiles2 = $(lisp)/*/*.el
47 ETAGS = "../lib-src/$(BLD)/etags"
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.
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.
56 DONTCOMPILE = \
57         $(lisp)/cus-load.el \
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 \
73         $(lisp)/language/czech.el \
74         $(lisp)/language/devanagari.el \
75         $(lisp)/language/kannada.el \
76         $(lisp)/language/malayalam.el \
77         $(lisp)/language/tamil.el \
78         $(lisp)/language/english.el \
79         $(lisp)/language/greek.el \
80         $(lisp)/language/hebrew.el \
81         $(lisp)/language/japanese.el \
82         $(lisp)/language/korean.el \
83         $(lisp)/language/lao.el \
84         $(lisp)/language/misc-lang.el \
85         $(lisp)/language/romanian.el \
86         $(lisp)/language/slovak.el \
87         $(lisp)/language/thai.el \
88         $(lisp)/language/utf-8-lang.el \
89         $(lisp)/language/georgian.el \
90         $(lisp)/loaddefs.el \
91         $(lisp)/ldefs-boot.el \
92         $(lisp)/loadup.el \
93         $(lisp)/mail/blessmail.el \
94         $(lisp)/patcomp.el \
95         $(lisp)/paths.el \
96         $(lisp)/play/bruce.el \
97         $(lisp)/subdirs.el \
98         $(lisp)/term/internal.el \
99         $(lisp)/term/AT386.el  \
100         $(lisp)/term/apollo.el \
101         $(lisp)/term/bobcat.el \
102         $(lisp)/term/iris-ansi.el \
103         $(lisp)/term/keyswap.el \
104         $(lisp)/term/linux.el \
105         $(lisp)/term/lk201.el \
106         $(lisp)/term/news.el \
107         $(lisp)/term/vt102.el \
108         $(lisp)/term/vt125.el \
109         $(lisp)/term/vt200.el \
110         $(lisp)/term/vt201.el \
111         $(lisp)/term/vt220.el \
112         $(lisp)/term/vt240.el \
113         $(lisp)/term/vt300.el \
114         $(lisp)/term/vt320.el \
115         $(lisp)/term/vt400.el \
116         $(lisp)/term/vt420.el \
117         $(lisp)/term/wyse50.el \
118         $(lisp)/version.el
120 # Files to compile before others during a bootstrap.  This is done to
121 # speed up the bootstrap process.  The CC files are compiled first
122 # because CC mode tweaks the compilation process, and requiring
123 # cc-mode when it is not compiled doesn't work during the
124 # bootstrapping.
126 COMPILE_FIRST = \
127         $(lisp)/emacs-lisp/byte-opt.el \
128         $(lisp)/emacs-lisp/bytecomp.el \
129         $(lisp)/subr.el \
130         $(lisp)/progmodes/cc-mode.el \
131         $(lisp)/progmodes/cc-vars.el
133 # The actual Emacs command run in the targets below.
135 emacs = $(EMACS) $(EMACSOPT)
137 # Common command to find subdirectories
139 setwins=subdirs=`find $$wd -type d -print`; \
140         for file in $$subdirs; do \
141            case $$file in */Old | */RCS | */CVS | */CVS/* | */=* ) ;; \
142                 *) wins="$$wins $$file" ;; \
143            esac; \
144         done
146 # Have to define the list of subdirs manually when not using sh.
147 WINS=\
148         calc \
149         calendar \
150         emacs-lisp \
151         emulation \
152         eshell \
153         gnus \
154         international \
155         language \
156         mail \
157         mh-e \
158         net \
159         obsolete \
160         play \
161         progmodes \
162         term \
163         textmodes \
164         toolbar
166 doit:
168 cus-load.el:
169         touch $@
170 custom-deps: cus-load.el doit
171         @echo Directories: $(WINS)
172         -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hooks nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS)
174 finder-data: doit
175         @echo Directories: $(WINS)
176         $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS)
178 loaddefs.el:
179         $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
180         cp loaddefs.el-$(SHELLTYPE) $@
181         rm loaddefs.el-$(SHELLTYPE)
183 loaddefs.el-SH:
184         echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
185         echo ";;" >> $@; echo ";;; Code:" >> $@
186         echo "(autoload 'define-minor-mode \"easy-mmode\")" >>$@
187         echo "(autoload 'define-ccl-program \"ccl\")" >>$@
188         echo "(autoload 'regexp-opt \"regexp-opt\")" >>$@
189         echo "(autoload 'string-to-list \"mule-util\")" >>$@
190         echo "(autoload 'define-derived-mode \"derived\")" >>$@
191         echo "(autoload 'encoded-kbd-mode \"encoded-kb\")" >>$@
192         echo "(defvar cvs-global-menu nil)" >>$@
193         echo "\f" >> $@
194         echo ";;; Local Variables:" >> $@
195         echo ";;; version-control: never" >> $@
196         echo ";;; no-byte-compile: t" >> $@
197         echo ";;; no-update-autoloads: t" >> $@
198         echo ";;; End:" >> $@
199         echo ";;; loaddefs.el ends here" >> $@
201 loaddefs.el-CMD:
202         echo ;;; loaddefs.el --- automatically extracted autoloads> $@
203         echo ;;; Code:>> $@
204         echo (autoload 'define-minor-mode "easy-mmode")>> $@
205         echo (autoload 'define-ccl-program "ccl")>> $@
206         echo (autoload 'regexp-opt "regexp-opt")>> $@
207         echo (autoload 'string-to-list "mule-util")>> $@
208         echo (autoload 'define-derived-mode "derived")>> $@
209         echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@
210         echo (defvar cvs-global-menu nil)>> $@
211         echo.\f>> $@
212         echo ;;; Local Variables:>> $@
213         echo ;;; version-control: never>> $@
214         echo ;;; no-byte-compile: t>> $@
215         echo ;;; no-update-autoloads: t>> $@
216         echo ;;; End:>> $@
217         echo ;;; loaddefs.el ends here>> $@
219 autoloads: loaddefs.el doit
220         @echo Directories: $(WINS)
221         $(emacs) -l autoload \
222                 --eval $(ARGQUOTE)(setq find-file-hooks nil \
223                         find-file-suppress-same-file-warnings t \
224                         generated-autoload-file \
225                           $(DQUOTE)$(lisp)/loaddefs.el$(DQUOTE))$(ARGQUOTE) \
226                 -f batch-update-autoloads $(lisp) $(WINS)
228 subdirs.el:
229         $(MAKE) $(MFLAGS) update-subdirs
231 # Need separate version for sh and native cmd.exe
232 update-subdirs: update-subdirs-$(SHELLTYPE)
234 update-subdirs-CMD: doit
235         echo ;; -*- no-byte-compile: t -*->subdirs.el
236         echo ;; In load-path, after this directory should come>> subdirs.el
237         echo ;; certain of its subdirectories.  Here we specify them.>> subdirs.el
238         echo (normal-top-level-add-to-load-path $(SQUOTE)(>> subdirs.el
239         @for %d in ($(WINS)) do if not (%d)==(term) echo "%d">> subdirs.el
240         echo ))>> subdirs.el
242 update-subdirs-SH: doit
243         $(srcdir)/update-subdirs $(lisp); \
244         for file in $(WINS); do \
245            $(srcdir)/update-subdirs $$file; \
246         done;
248 updates: update-subdirs autoloads finder-data custom-deps
250 # Update the AUTHORS file.
252 update-authors:
253         $(emacs) -f batch-update-authors $(srcdir)/AUTHORS $(srcdir)
255 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
256         $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
258 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
259         $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
261 .SUFFIXES: .elc .el
263 .el.elc:
264         -$(emacs) -f batch-byte-compile $<
266 $(DONTCOMPILE:.el=.elc):
267         -$(DEL) $@
269 # Compile all Lisp files, except those from DONTCOMPILE,
270 # but don't recompile those that are up to date.
272 # All .elc files are made writable
273 # before compilation in case we checked out read-only (CVS option -r).
274 # Files MUST be compiled one by one.  If we compile several files in a
275 # row we can't make sure that the compilation environment is clean.
276 # We also set the load-path of the Emacs used for compilation to the
277 # current directory and its subdirectories, to make sure require's and
278 # load's in the files being compiled find the right files.
280 # Need separate version for sh and native cmd.exe
281 compile: subdirs.el compile-$(SHELLTYPE) doit
283 compile-CMD:
284 #       -for %f in ($(lisp) $(WINS)) do for %g in (%f\*.elc) do @attrib -r %g
285         for %f in ($(COMPILE_FIRST)) do \
286           $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %f
287         for %f in (. $(WINS)) do for %g in (%f/*.el) do \
288           $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %f/%g
290 compile-SH:
291 #       for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
292         for el in $(COMPILE_FIRST); do \
293           echo Compiling $$el; \
294           $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
295         done
296         for dir in $(lisp) $(WINS); do \
297           for el in $$dir/*.el; do \
298             if test -f $$el; \
299             then \
300               echo Compiling $$el; \
301               $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
302             fi \
303           done; \
304         done
306 # Compile all Lisp files, except those from DONTCOMPILE.  This
307 # is like `compile' but compiles files unconditionally.
308 compile-always: subdirs.el compile-always-$(SHELLTYPE) doit
310 compile-always-CMD:
311 #       -for %f in ($(lisp) $(WINS)) do for %g in (%f\*.elc) do @attrib -r %g
312         for %f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %f
313         for %f in (. $(WINS)) do for %g in (%f/*.el) do $(emacs) -f batch-byte-compile %f/%g
315 compile-always-SH:
316 #       for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
317         for el in $(COMPILE_FIRST); do \
318           echo Compiling $$el; \
319           $(emacs) -f batch-byte-compile $$el || exit 1; \
320         done
321         for dir in $(lisp) $(WINS); do \
322           for el in $$dir/*.el; do \
323             echo Compiling $$el; \
324             $(emacs) -f batch-byte-compile $$el || exit 1; \
325           done; \
326         done
328 compile-calc: compile-calc-$(SHELLTYPE)
330 compile-calc-CMD:
331         for %f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %f
333 compile-calc-SH:
334         for el in $(lisp)/calc/*.el; do \
335           echo Compiling $$el; \
336           $(emacs) -f batch-byte-compile $$el || exit 1; \
337         done
339 # Backup compiled Lisp files in elc.tar.gz.  If that file already
340 # exists, make a backup of it.
342 backup-compiled-files:
343         -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
344         -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
346 # Compile Lisp files, but save old compiled files first.
348 compile-after-backup: backup-compiled-files compile-always
350 # Recompile all Lisp files which are newer than their .elc files.
351 # Note that this doesn't create .elc files.  It only recompiles if an
352 # .elc is present.
354 recompile: doit
355         $(emacs) -f batch-byte-recompile-directory $(lisp)
357 # Prepare a bootstrap in the lisp subdirectory.
359 # Build loaddefs.el, because it's not sure it's up-to-date, and if it's not,
360 # that might lead to errors during the bootstrap because something fails to
361 # autoload as expected.  However, if there is no emacs binary, then we can't
362 # build autoloads yet, so just make sure there's some loaddefs.el file, as
363 # it's necessary for generating the binary (because loaddefs.el is an
364 # automatically generated file, we don't want to store it in the source
365 # repository).
367 # Remove compiled Lisp files so that bootstrap-emacs will be built from
368 # sources only.
370 # Need separate version for sh and native cmd.exe
371 bootstrap-clean: bootstrap-clean-$(SHELLTYPE) loaddefs.el
373 bootstrap-clean-CMD:
374 #       if exist $(EMACS) $(MAKE) $(MFLAGS) autoloads
375         if not exist $(lisp)\loaddefs.el cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
376         -for %f in (. $(WINS)) do for %g in (%f\*.elc) do @$(DEL) %g
378 bootstrap-clean-SH:
379 #       if test -f $(EMACS); then $(MAKE) $(MFLAGS) autoloads; fi
380 #       -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
381         if ! test -r $(lisp)/loaddefs.el; then \
382           cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el; \
383         fi
384         -for dir in . $(WINS); do rm -f $$dir/*.elc; done
386 # Generate/update files for the bootstrap process.
388 bootstrap: update-subdirs autoloads compile finder-data custom-deps
391 # Assuming INSTALL_DIR is defined, copy the elisp files to it
392 # Windows 95 makes this harder than it should be.
394 install:
395                 - mkdir "$(INSTALL_DIR)/lisp"
396                 - $(DEL) ../same-dir.tst
397                 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
398                 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
399 #ifdef COPY_LISP_SOURCE
400                 $(IFNOTSAMEDIR) $(CP_DIR) . "$(INSTALL_DIR)/lisp" $(ENDIF)
401 #else
402 #               $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
403 #               $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
404 #               $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
405 #               $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
406 #               $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
407 #               $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
408 #               $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
409 #               $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
410 #               $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
411 #               $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
412 #               $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
413 #endif
414                 - $(DEL) ../same-dir.tst
415                 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
418 # Maintenance
420 clean:
421                 - $(DEL) *~
423 # arch-tag: bd03b562-c58d-4403-99db-c7bccd8c49a0