(Compiler Errors): Mention declaring functions, defvar with no
[emacs.git] / lisp / makefile.w32-in
blobc955671d0ed48b97efe245f09b29285edf9b02c2
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 3, 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 lisptagsfiles1 = $(lisp)/*.el
47 lisptagsfiles2 = $(lisp)/*/*.el
48 ETAGS = "../lib-src/$(BLD)/etags"
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.
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
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.
68 emacs = "$(EMACS)" $(EMACSOPT)
70 # Have to define the list of subdirs manually when not using sh.
71 WINS_ALMOST=\
72         calc \
73         calendar \
74         emacs-lisp \
75         emulation \
76         erc \
77         eshell \
78         gnus \
79         international \
80         language \
81         mail \
82         mh-e \
83         net \
84         nxml \
85         play \
86         progmodes \
87         term \
88         textmodes \
89         url
91 WINS= $(WINS_ALMOST) \
92         obsolete
94 doit:
96 $(lisp)/cus-load.el:
97         touch $@
98 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
99 #          this can break with GNU Make 3.81 and later if sh.exe is used.
100 custom-deps: $(lisp)/cus-load.el $(lisp)/loaddefs.el doit
101         @echo Directories: $(WINS)
102         -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS)
104 finder-data: $(lisp)/loaddefs.el doit
105         @echo Directories: $(WINS)
106         $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS)
108 $(lisp)/loaddefs.el:
109         $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE)
110         cp loaddefs.el-$(SHELLTYPE) $@
111         rm loaddefs.el-$(SHELLTYPE)
113 loaddefs.el-SH:
114         echo ";;; loaddefs.el --- automatically extracted autoloads" > $@
115         echo ";;" >> $@; echo ";;; Code:" >> $@
116         echo "(autoload 'define-minor-mode \"easy-mmode\")" >>$@
117         echo "(autoload 'define-ccl-program \"ccl\")" >>$@
118         echo "(autoload 'regexp-opt \"regexp-opt\")" >>$@
119         echo "(autoload 'string-to-list \"mule-util\")" >>$@
120         echo "(autoload 'define-derived-mode \"derived\")" >>$@
121         echo "(autoload 'encoded-kbd-mode \"encoded-kb\")" >>$@
122         echo "(defvar cvs-global-menu nil)" >>$@
123         echo "\f" >> $@
124         echo ";;; Local Variables:" >> $@
125         echo ";;; version-control: never" >> $@
126         echo ";;; no-byte-compile: t" >> $@
127         echo ";;; no-update-autoloads: t" >> $@
128         echo ";;; End:" >> $@
129         echo ";;; loaddefs.el ends here" >> $@
131 loaddefs.el-CMD:
132         echo ;;; loaddefs.el --- automatically extracted autoloads> $@
133         echo ;;; Code:>> $@
134         echo (autoload 'define-minor-mode "easy-mmode")>> $@
135         echo (autoload 'define-ccl-program "ccl")>> $@
136         echo (autoload 'regexp-opt "regexp-opt")>> $@
137         echo (autoload 'string-to-list "mule-util")>> $@
138         echo (autoload 'define-derived-mode "derived")>> $@
139         echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@
140         echo (defvar cvs-global-menu nil)>> $@
141         echo.\f>> $@
142         echo ;;; Local Variables:>> $@
143         echo ;;; version-control: never>> $@
144         echo ;;; no-byte-compile: t>> $@
145         echo ;;; no-update-autoloads: t>> $@
146         echo ;;; End:>> $@
147         echo ;;; loaddefs.el ends here>> $@
149 # Use . instead of $(lisp) because $(lisp) is an absolute file name,
150 # including a drive letter and any leading directories, so the generated
151 # loaddefs.el will mention file names that on other machine reference
152 # possibly non-existent directories.
154 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
155 #          this can break with GNU Make 3.81 and later if sh.exe is used.
156 autoloads: $(lisp)/loaddefs.el doit
157         @echo Directories: . $(WINS_ALMOST)
158         $(emacs) -l autoload \
159                 --eval $(ARGQUOTE)(setq find-file-hook nil find-file-suppress-same-file-warnings t)$(ARGQUOTE) \
160                 -f w32-batch-update-autoloads "$(lisp)/loaddefs.el" . $(WINS_ALMOST)
162 $(lisp)/subdirs.el:
163         $(MAKE) $(MFLAGS) update-subdirs
165 # Need separate version for sh and native cmd.exe
166 update-subdirs: update-subdirs-$(SHELLTYPE)
168 update-subdirs-CMD: doit
169         echo ;; -*- no-byte-compile: t -*-> $(lisp)/subdirs.el
170         echo ;; In load-path, after this directory should come>> $(lisp)/subdirs.el
171         echo ;; certain of its subdirectories.  Here we specify them.>> $(lisp)/subdirs.el
172         echo (normal-top-level-add-to-load-path $(SQUOTE)(>> $(lisp)/subdirs.el
173         @for %%d in ($(WINS)) do if not (%%d)==(term) echo "%%d">> $(lisp)/subdirs.el
174         echo ))>> $(lisp)/subdirs.el
176 update-subdirs-SH: doit
177         $(srcdir)/update-subdirs $(lisp); \
178         for file in $(WINS); do \
179            $(srcdir)/update-subdirs $$file; \
180         done;
182 updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
184 # This is useful after "cvs up".
185 cvs-update: recompile autoloads finder-data custom-deps
187 # Update the AUTHORS file.
189 update-authors:
190         $(emacs) -l authors -f batch-update-authors $(srcdir)/etc/AUTHORS $(srcdir)
192 TAGS: $(lisptagsfiles1) $(lisptagsfiles2)
193         $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2)
195 TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2)
196         $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2)
198 .SUFFIXES: .elc .el
200 .el.elc:
201         -$(emacs) -f batch-byte-compile $<
203 # Compile all Lisp files, but don't recompile those that are up to
204 # date.  Some files don't actually get compiled because they set the
205 # local variable no-byte-compile.
207 # All .elc files are made writable before compilation in case we
208 # checked out read-only (CVS option -r).  Files MUST be compiled one by
209 # one.  If we compile several files in a row we can't make sure that
210 # the compilation environment is clean.  We also set the load-path of
211 # the Emacs used for compilation to the current directory and its
212 # subdirectories, to make sure require's and load's in the files being
213 # compiled find the right files.
215 # Need separate version for sh and native cmd.exe
216 compile: $(lisp)/subdirs.el mh-autoloads compile-$(SHELLTYPE) doit
218 compile-CMD:
219 #       -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
220         for %%f in ($(COMPILE_FIRST)) do \
221           $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f
222         for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \
223           $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f/%%g
225 compile-SH:
226 #       for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
227         for el in $(COMPILE_FIRST); do \
228           echo Compiling $$el; \
229           $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
230         done
231         for dir in $(lisp) $(WINS); do \
232           for el in $$dir/*.el; do \
233             if test -f $$el; \
234             then \
235               echo Compiling $$el; \
236               $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \
237             fi \
238           done; \
239         done
241 # Compile all Lisp files.  This is like `compile' but compiles files
242 # unconditionally.  Some files don't actually get compiled because they
243 # set the local variable no-byte-compile.
245 compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
247 compile-always-CMD:
248 #       -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
249         for %%f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %%f
250         for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) -f batch-byte-compile %%f/%%g
252 compile-always-SH:
253 #       for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
254         for el in $(COMPILE_FIRST); do \
255           echo Compiling $$el; \
256           $(emacs) -f batch-byte-compile $$el || exit 1; \
257         done
258         for dir in $(lisp) $(WINS); do \
259           for el in $$dir/*.el; do \
260             echo Compiling $$el; \
261             $(emacs) -f batch-byte-compile $$el || exit 1; \
262           done; \
263         done
265 compile-calc: compile-calc-$(SHELLTYPE)
267 compile-calc-CMD:
268         for %%f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %%f
270 compile-calc-SH:
271         for el in $(lisp)/calc/*.el; do \
272           echo Compiling $$el; \
273           $(emacs) -f batch-byte-compile $$el || exit 1; \
274         done
276 # Backup compiled Lisp files in elc.tar.gz.  If that file already
277 # exists, make a backup of it.
279 backup-compiled-files:
280         -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~
281         -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc
283 # Compile Lisp files, but save old compiled files first.
285 compile-after-backup: backup-compiled-files compile-always
287 # Recompile all Lisp files which are newer than their .elc files.
288 # Note that this doesn't create .elc files.  It only recompiles if an
289 # .elc is present.
290 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
291 #          this can break with GNU Make 3.81 and later if sh.exe is used.
292 recompile: mh-autoloads doit $(lisp)/progmodes/cc-mode.elc
293         $(emacs) --eval $(ARGQUOTE)(batch-byte-recompile-directory 0)$(ARGQUOTE) $(lisp)
295 # Update MH-E internal autoloads. These are not to be confused with
296 # the autoloads for the MH-E entry points, which are already in
297 # loaddefs.el.
298 MH_E_SRC = $(lisp)/mh-e/mh-acros.el $(lisp)/mh-e/mh-alias.el    \
299         $(lisp)/mh-e/mh-buffers.el $(lisp)/mh-e/mh-compat.el    \
300         $(lisp)/mh-e/mh-comp.el $(lisp)/mh-e/mh-e.el            \
301         $(lisp)/mh-e/mh-folder.el $(lisp)/mh-e/mh-funcs.el      \
302         $(lisp)/mh-e/mh-gnus.el $(lisp)/mh-e/mh-identity.el     \
303         $(lisp)/mh-e/mh-inc.el $(lisp)/mh-e/mh-junk.el          \
304         $(lisp)/mh-e/mh-letter.el $(lisp)/mh-e/mh-limit.el      \
305         $(lisp)/mh-e/mh-mime.el $(lisp)/mh-e/mh-print.el        \
306         $(lisp)/mh-e/mh-scan.el $(lisp)/mh-e/mh-search.el       \
307         $(lisp)/mh-e/mh-seq.el $(lisp)/mh-e/mh-show.el          \
308         $(lisp)/mh-e/mh-speed.el $(lisp)/mh-e/mh-thread.el      \
309         $(lisp)/mh-e/mh-tool-bar.el $(lisp)/mh-e/mh-utils.el    \
310         $(lisp)/mh-e/mh-xface.el
312 # See the commentary for autoloads above for why we use ./mh-e below
313 # instead of $(lisp)/mh-e.
314 mh-autoloads: $(lisp)/mh-e/mh-loaddefs.el
315 $(lisp)/mh-e/mh-loaddefs.el: $(MH_E_SRC)
316         $(MAKE) $(MFLAGS) pre-mh-loaddefs.el-$(SHELLTYPE)
317         cp pre-mh-loaddefs.el-$(SHELLTYPE) $@
318         rm pre-mh-loaddefs.el-$(SHELLTYPE)
319         "$(EMACS)" $(EMACSOPT) \
320            -l autoload \
321            --eval "(setq generate-autoload-cookie \";;;###mh-autoload\")" \
322            --eval "(setq find-file-suppress-same-file-warnings t)" \
323            --eval "(setq make-backup-files nil)" \
324            -f w32-batch-update-autoloads \
325            "$(lisp)/mh-e/mh-loaddefs.el" ./mh-e
327 pre-mh-loaddefs.el-SH:
328         echo ";;; mh-loaddefs.el --- automatically extracted autoloads" > $@
329         echo ";;" >> $@
330         echo ";; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc." >> $@
331         echo ";; Author: Bill Wohler <wohler@newt.com>" >> $@
332         echo ";; Keywords: mail" >> $@
333         echo ";;; Commentary:" >> $@
334         echo ";;; Change Log:" >> $@
335         echo ";;; Code:" >> $@
336         echo "\f" >> $@
337         echo "(provide 'mh-loaddefs)" >> $@
338         echo ";; Local Variables:" >> $@
339         echo ";; version-control: never" >> $@
340         echo ";; no-byte-compile: t" >> $@
341         echo ";; no-update-autoloads: t" >> $@
342         echo ";; End:" >> $@
343         echo ";;; mh-loaddefs.el ends here" >> $@
345 pre-mh-loaddefs.el-CMD:
346         echo ;;; mh-loaddefs.el --- automatically extracted autoloads> $@
347         echo ;;>> $@
348         echo ;; Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.>> $@
349         echo ;; Author: Bill Wohler (wohler@newt.com)>> $@
350         echo ;; Keywords: mail>> $@
351         echo ;;; Commentary:>> $@
352         echo ;;; Change Log:>> $@
353         echo ;;; Code:>> $@
354         echo.\f>> $@
355         echo (provide 'mh-loaddefs)>> $@
356         echo ;; Local Variables:>> $@
357         echo ;; version-control: never>> $@
358         echo ;; no-byte-compile: t>> $@
359         echo ;; no-update-autoloads: t>> $@
360         echo ;; End:>> $@
361         echo ;;; mh-loaddefs.el ends here>> $@
363 # Prepare a bootstrap in the lisp subdirectory.
365 # Build loaddefs.el to make sure it's up-to-date.  If it's not, that
366 # might lead to errors during the bootstrap because something fails to
367 # autoload as expected.  If there is no emacs binary, then we can't
368 # build autoloads yet.  In that case we have to use ldefs-boot.el;
369 # bootstrap should always work with ldefs-boot.el.  (Because
370 # loaddefs.el is an automatically generated file, we don't want to
371 # store it in the source repository).
373 # Remove compiled Lisp files so that bootstrap-emacs will be built from
374 # sources only.
376 # Need separate version for sh and native cmd.exe
377 # Note that bootstrap-clean-$(SHELLTYPE) copies ldefs-boot.el to loaddefs.el,
378 # and thus the almost-empty loaddefs.el crafted by the $(lisp)/loaddefs.el
379 # target can NOT be built _after_ bootstrap-clean-$(SHELLTYPE) does its
380 # thing, or else an empty loaddefs.el will overwrite the full one.
381 bootstrap-clean: $(lisp)/loaddefs.el
382         $(MAKE) $(MFLAGS) bootstrap-clean-$(SHELLTYPE)
384 bootstrap-clean-CMD:
385 #       if exist "$(EMACS)" $(MAKE) $(MFLAGS) autoloads
386         cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
387         -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g
389 bootstrap-clean-SH:
390 #       if test -f "$(EMACS)"; then $(MAKE) $(MFLAGS) autoloads; fi
391 #       -rm -f $(lisp)/*.elc $(lisp)/*/*.elc
392         cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el
393         -for dir in . $(WINS); do rm -f $$dir/*.elc; done
395 # Generate/update files for the bootstrap process.
396 # When done, remove bootstrap-emacs from ../bin, so that
397 # it will not be mistaken for an installed binary.
399 bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps
400         - $(DEL) "$(EMACS)"
403 # Assuming INSTALL_DIR is defined, copy the elisp files to it
404 # Windows 95 makes this harder than it should be.
406 install:
407                 - mkdir "$(INSTALL_DIR)/lisp"
408                 - $(DEL) ../same-dir.tst
409                 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
410                 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
411 #ifdef COPY_LISP_SOURCE
412                 $(IFNOTSAMEDIR) $(MAKE) $(MFLAGS) install-lisp-$(SHELLTYPE) $(ENDIF)
413 #else
414 #               $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF)
415 #               $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF)
416 #               $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF)
417 #               $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF)
418 #               $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF)
419 #               $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF)
420 #               $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
421 #               $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF)
422 #               $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF)
423 #               $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
424 #               $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF)
425 #endif
426                 - $(DEL) ../same-dir.tst
427                 - $(DEL) "$(INSTALL_DIR)/same-dir.tst"
429 # Need to copy *.el files first, to avoid "source file is newer" annoyance
430 # since cp does not preserve time stamps
431 install-lisp-SH:
432         cp -f *.el "$(INSTALL_DIR)/lisp"
433         for dir in $(WINS); do [ -d "$(INSTALL_DIR)/lisp/$$dir" ] || mkdir "$(INSTALL_DIR)/lisp/$$dir"; done
434         for dir in $(WINS); do cp -f $$dir/*.el "$(INSTALL_DIR)/lisp/$$dir"; done
435         for dir in . $(WINS); do cp $$dir/*.elc "$(INSTALL_DIR)/lisp/$$dir"; done
437 install-lisp-CMD:
438         cp -f *.el "$(INSTALL_DIR)/lisp"
439         for %%f in ($(WINS)) do if not exist "$(INSTALL_DIR)/lisp/%%f" mkdir "$(INSTALL_DIR)/lisp/%%f"
440         for %%f in ($(WINS)) do cp -f %%f/*.el "$(INSTALL_DIR)/lisp/%%f"
441         for %%f in (. $(WINS)) do cp -f %%f/*.elc "$(INSTALL_DIR)/lisp/%%f"
444 # Maintenance
446 # We used to delete *~ here, but that might inadvertently remove
447 # precious files if it happens to match their short 8+3 aliases.
448 clean:
449                 - $(DEL) *.el~