Merge from emacs--devo--0
[emacs/old-mirror.git] / lisp / makefile.w32-in
blobaeb281ae1ac461b95443cbdf1b15887a888a3383
1 #  -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 #  Copyright (C) 2000, 2001, 2002, 2003, 2004,
3 #                2005, 2006, 2007  Free Software Foundation, Inc.
5 #  This file is part of GNU Emacs.
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.
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.
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.
23 ALL =
25 all: $(ALL)
27 SQUOTE='
28 # '
30 lisp = $(CURDIR)
31 srcdir = $(CURDIR)/..
33 # You can specify a different executable on the make command line,
34 # e.g. "make EMACS=../src/emacs ...".
36 EMACS = $(THISDIR)/../bin/emacs.exe
38 # Command line flags for Emacs.  This must include --multibyte,
39 # otherwise some files will not compile.
41 EMACSOPT = -batch --no-init-file --no-site-file --multibyte
43 # Set EMACSLOADPATH correctly (already defined in environment).
44 EMACSLOADPATH=$(lisp)
46 # Use C locale
47 LC_ALL = C
49 lisptagsfiles1 = $(lisp)/*.el
50 lisptagsfiles2 = $(lisp)/*/*.el
51 ETAGS = "../lib-src/$(BLD)/etags"
53 # Files to compile before others during a bootstrap.  This is done to
54 # speed up the bootstrap process.  The CC files are compiled first
55 # because CC mode tweaks the compilation process, and requiring
56 # cc-mode when it is not compiled doesn't work during the
57 # bootstrapping.
59 COMPILE_FIRST = \
60         $(lisp)/emacs-lisp/byte-opt.el \
61         $(lisp)/emacs-lisp/bytecomp.el \
62         $(lisp)/subr.el \
63         $(lisp)/progmodes/cc-mode.el \
64         $(lisp)/progmodes/cc-vars.el
66 # The actual Emacs command run in the targets below.
67 # The quotes around $(EMACS) are here because the user could type
68 # it with forward slashes and without quotes, which will fail if
69 # the shell is cmd.exe.
71 emacs = "$(EMACS)" $(EMACSOPT)
73 # Have to define the list of subdirs manually when not using sh.
74 WINS_ALMOST=\
75         calc \
76         calendar \
77         emacs-lisp \
78         emulation \
79         erc \
80         eshell \
81         gnus \
82         international \
83         language \
84         mail \
85         mh-e \
86         net \
87         play \
88         progmodes \
89         term \
90         textmodes \
91         url
93 WINS= $(WINS_ALMOST) \
94         obsolete
96 doit:
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 $(lisp)/loaddefs.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)
106 finder-data: $(lisp)/loaddefs.el doit
107         @echo Directories: $(WINS)
108         $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS)
110 $(lisp)/loaddefs.el:
111         $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
112         cp loaddefs.el-$(SHELLTYPE) $@
113         rm loaddefs.el-$(SHELLTYPE)
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" >> $@
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>> $@
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.
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_ALMOST)
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_ALMOST)
164 $(lisp)/subdirs.el:
165         $(MAKE) $(MFLAGS) update-subdirs
167 # Need separate version for sh and native cmd.exe
168 update-subdirs: update-subdirs-$(SHELLTYPE)
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
178 update-subdirs-SH: doit
179         $(srcdir)/update-subdirs $(lisp); \
180         for file in $(WINS); do \
181            $(srcdir)/update-subdirs $$file; \
182         done;
184 updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
186 # This is useful after "cvs up".
187 cvs-update: recompile autoloads finder-data custom-deps
189 # Update the AUTHORS file.
191 update-authors:
192         $(emacs) -l authors -f batch-update-authors $(srcdir)/AUTHORS $(srcdir)
194 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
195         $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
197 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
198         $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
200 .SUFFIXES: .elc .el
202 .el.elc:
203         -$(emacs) -f batch-byte-compile $<
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.
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.
217 # Need separate version for sh and native cmd.exe
218 compile: $(lisp)/subdirs.el mh-autoloads compile-$(SHELLTYPE) doit
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
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
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.
247 compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
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
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
267 compile-calc: compile-calc-$(SHELLTYPE)
269 compile-calc-CMD:
270         for %%f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %%f
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
278 # Backup compiled Lisp files in elc.tar.gz.  If that file already
279 # exists, make a backup of it.
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
285 # Compile Lisp files, but save old compiled files first.
287 compile-after-backup: backup-compiled-files compile-always
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)
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-compat.el    \
302         $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-e.el            \
303         $(lisp)/mh-e/mh-folder.el $(lisp)/mh-e/mh-funcs.el      \
304         $(lisp)/mh-e/mh-gnus.el $(lisp)/mh-e/mh-identity.el     \
305         $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-junk.el          \
306         $(lisp)/mh-e/mh-letter.el $(lisp)/mh-e/mh-limit.el      \
307         $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-print.el        \
308         $(lisp)/mh-e/mh-scan.el $(lisp)/mh-e/mh-search.el       \
309         $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-show.el          \
310         $(lisp)/mh-e/mh-speed.el $(lisp)/mh-e/mh-thread.el      \
311         $(lisp)/mh-e/mh-tool-bar.el $(lisp)/mh-e/mh-utils.el    \
312         $(lisp)/mh-e/mh-xface.el
314 # See the commentary for autoloads above for why we use ./mh-e below
315 # instead of $(lisp)/mh-e.
316 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
317 $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC)
318         $(MAKE) $(MFLAGS) pre-mh-loaddefs.el-$(SHELLTYPE)
319         cp pre-mh-loaddefs.el-$(SHELLTYPE) $@
320         rm pre-mh-loaddefs.el-$(SHELLTYPE)
321         "$(EMACS)" $(EMACSOPT) \
322            -l autoload \
323            --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
324            --eval "(setq find-file-suppress-same-file-warnings t)" \
325            --eval "(setq make-backup-files nil)" \
326            -f w32-batch-update-autoloads \
327            "$(lisp)/mh-e/mh-loaddefs.el" ./mh-e
329 pre-mh-loaddefs.el-SH:
330         echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
331         echo ";;" >> $@
332         echo ";; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc." >> $@
333         echo ";; Author: Bill Wohler <wohler@newt.com>" >> $@
334         echo ";; Keywords: mail" >> $@
335         echo ";;; Commentary:" >> $@
336         echo ";;; Change Log:" >> $@
337         echo ";;; Code:" >> $@
338         echo "\f" >> $@
339         echo "(provide 'mh-loaddefs)" >> $@
340         echo ";; Local Variables:" >> $@
341         echo ";; version-control: never" >> $@
342         echo ";; no-byte-compile: t" >> $@
343         echo ";; no-update-autoloads: t" >> $@
344         echo ";; End:" >> $@
345         echo ";;; mh-loaddefs.el ends here" >> $@
347 pre-mh-loaddefs.el-CMD:
348         echo ;;; mh-loaddefs.el --- automatically extracted autoloads> $@
349         echo ;;>> $@
350         echo ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.>> $@
351         echo ;; Author: Bill Wohler (wohler@newt.com)>> $@
352         echo ;; Keywords: mail>> $@
353         echo ;;; Commentary:>> $@
354         echo ;;; Change Log:>> $@
355         echo ;;; Code:>> $@
356         echo.\f>> $@
357         echo (provide 'mh-loaddefs)>> $@
358         echo ;; Local Variables:>> $@
359         echo ;; version-control: never>> $@
360         echo ;; no-byte-compile: t>> $@
361         echo ;; no-update-autoloads: t>> $@
362         echo ;; End:>> $@
363         echo ;;; mh-loaddefs.el ends here>> $@
365 # Prepare a bootstrap in the lisp subdirectory.
367 # Build loaddefs.el to make sure it's up-to-date.  If it's not, that
368 # might lead to errors during the bootstrap because something fails to
369 # autoload as expected.  If there is no emacs binary, then we can't
370 # build autoloads yet.  In that case we have to use ldefs-boot.el;
371 # bootstrap should always work with ldefs-boot.el.  (Because
372 # loaddefs.el is an automatically generated file, we don't want to
373 # store it in the source repository).
375 # Remove compiled Lisp files so that bootstrap-emacs will be built from
376 # sources only.
378 # Need separate version for sh and native cmd.exe
379 # Note that bootstrap-clean-$(SHELLTYPE) copies ldefs-boot.el to loaddefs.el,
380 # and thus the almost-empty loaddefs.el crafted by the $(lisp)/loaddefs.el
381 # target can NOT be built _after_ bootstrap-clean-$(SHELLTYPE) does its
382 # thing, or else an empty loaddefs.el will overwrite the full one.
383 bootstrap-clean: $(lisp)/loaddefs.el
384         $(MAKE) $(MFLAGS) bootstrap-clean-$(SHELLTYPE)
386 bootstrap-clean-CMD:
387 #       if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads
388         cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
389         -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
391 bootstrap-clean-SH:
392 #       if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi
393 #       -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
394         cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
395         -for dir in . $(WINS); do rm -f $$dir/*.elc; done
397 # Generate/update files for the bootstrap process.
398 # When done, remove bootstrap-emacs from ../bin, so that
399 # it will not be mistaken for an installed binary.
401 bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps
402         - $(DEL) "$(EMACS)"
405 # Assuming INSTALL_DIR is defined, copy the elisp files to it
406 # Windows 95 makes this harder than it should be.
408 install:
409                 - mkdir "$(INSTALL_DIR)/lisp"
410                 - $(DEL) ../same-dir.tst
411                 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
412                 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
413 #ifdef COPY_LISP_SOURCE
414                 $(IFNOTSAMEDIR) $(MAKE) $(MFLAGS) install-lisp-$(SHELLTYPE) $(ENDIF)
415 #else
416 #               $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
417 #               $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
418 #               $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
419 #               $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
420 #               $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
421 #               $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
422 #               $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
423 #               $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
424 #               $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
425 #               $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
426 #               $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
427 #endif
428                 - $(DEL) ../same-dir.tst
429                 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
431 # Need to copy *.el files first, to avoid "source file is newer" annoyance
432 # since cp does not preserve time stamps
433 install-lisp-SH:
434         cp -f *.el "$(INSTALL_DIR)/lisp"
435         for dir in $(WINS); do [ -d "$(INSTALL_DIR)/lisp/$$dir" ] || mkdir "$(INSTALL_DIR)/lisp/$$dir"; done
436         for dir in $(WINS); do cp -f $$dir/*.el "$(INSTALL_DIR)/lisp/$$dir"; done
437         for dir in . $(WINS); do cp $$dir/*.elc "$(INSTALL_DIR)/lisp/$$dir"; done
439 install-lisp-CMD:
440         cp -f *.el "$(INSTALL_DIR)/lisp"
441         for %%f in ($(WINS)) do if not exist "$(INSTALL_DIR)/lisp/%%f" mkdir "$(INSTALL_DIR)/lisp/%%f"
442         for %%f in ($(WINS)) do cp -f %%f/*.el "$(INSTALL_DIR)/lisp/%%f"
443         for %%f in (. $(WINS)) do cp -f %%f/*.elc "$(INSTALL_DIR)/lisp/%%f"
446 # Maintenance
448 # We used to delete *~ here, but that might inadvertently remove
449 # precious files if it happens to match their short 8+3 aliases.
450 clean:
451                 - $(DEL) *.el~