Commit | Line | Data |
---|---|---|
bd6766d3 | 1 | # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API. |
92b47a4a TTN |
2 | # Copyright (C) 2000, 2001, 2002, 2003, 2004, |
3 | # 2005 Free Software Foundation, Inc. | |
7bbaaedd AI |
4 | # |
5 | # This file is part of GNU Emacs. | |
c45dbde8 | 6 | # |
7bbaaedd AI |
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. | |
c45dbde8 | 11 | # |
7bbaaedd AI |
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. | |
c45dbde8 | 16 | # |
7bbaaedd AI |
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 | |
086add15 LK |
19 | # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | # Boston, MA 02110-1301, USA. | |
7bbaaedd AI |
21 | # |
22 | ||
23 | ALL = | |
24 | ||
25 | all: $(ALL) | |
26 | ||
27 | SQUOTE=' | |
28 | # ' | |
29 | ||
6610f4b2 | 30 | lisp = $(CURDIR) |
9b006cb2 | 31 | srcdir = $(CURDIR)/.. |
7bbaaedd AI |
32 | |
33 | # You can specify a different executable on the make command line, | |
34 | # e.g. "make EMACS=../src/emacs ...". | |
35 | ||
587b5737 | 36 | EMACS = "$(THISDIR)/../bin/emacs.exe" |
7bbaaedd AI |
37 | |
38 | # Command line flags for Emacs. This must include --multibyte, | |
39 | # otherwise some files will not compile. | |
40 | ||
41 | EMACSOPT = -batch --no-init-file --no-site-file --multibyte | |
42 | ||
cc7aa053 AI |
43 | # Set EMACSLOADPATH correctly (already defined in environment). |
44 | EMACSLOADPATH=$(lisp) | |
45 | ||
7bbaaedd AI |
46 | lisptagsfiles1 = $(lisp)/*.el |
47 | lisptagsfiles2 = $(lisp)/*/*.el | |
48 | ETAGS = "../lib-src/$(BLD)/etags" | |
49 | ||
170a9e70 GM |
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. | |
7bbaaedd AI |
55 | |
56 | COMPILE_FIRST = \ | |
57 | $(lisp)/emacs-lisp/byte-opt.el \ | |
58 | $(lisp)/emacs-lisp/bytecomp.el \ | |
170a9e70 GM |
59 | $(lisp)/subr.el \ |
60 | $(lisp)/progmodes/cc-mode.el \ | |
61 | $(lisp)/progmodes/cc-vars.el | |
7bbaaedd AI |
62 | |
63 | # The actual Emacs command run in the targets below. | |
64 | ||
65 | emacs = $(EMACS) $(EMACSOPT) | |
66 | ||
67 | # Common command to find subdirectories | |
68 | ||
69 | setwins=subdirs=`find $$wd -type d -print`; \ | |
70 | for file in $$subdirs; do \ | |
71 | case $$file in */Old | */RCS | */CVS | */CVS/* | */=* ) ;; \ | |
72 | *) wins="$$wins $$file" ;; \ | |
73 | esac; \ | |
74 | done | |
75 | ||
76 | # Have to define the list of subdirs manually when not using sh. | |
77 | WINS=\ | |
1142be39 | 78 | calc \ |
7bbaaedd AI |
79 | calendar \ |
80 | emacs-lisp \ | |
81 | emulation \ | |
82 | eshell \ | |
83 | gnus \ | |
84 | international \ | |
85 | language \ | |
86 | mail \ | |
942da20c | 87 | mh-e \ |
7bbaaedd | 88 | net \ |
1142be39 | 89 | obsolete \ |
7bbaaedd AI |
90 | play \ |
91 | progmodes \ | |
92 | term \ | |
b036f5d8 | 93 | textmodes \ |
05cecc58 JB |
94 | toolbar \ |
95 | url | |
7bbaaedd AI |
96 | |
97 | doit: | |
98 | ||
99 | cus-load.el: | |
100 | touch $@ | |
101 | custom-deps: cus-load.el doit | |
102 | @echo Directories: $(WINS) | |
5459bcdf | 103 | -$(emacs) -l cus-dep --eval $(ARGQUOTE)(setq find-file-hook nil)$(ARGQUOTE) -f custom-make-dependencies $(lisp) $(WINS) |
7bbaaedd | 104 | |
9b006cb2 | 105 | finder-data: doit |
7bbaaedd AI |
106 | @echo Directories: $(WINS) |
107 | $(emacs) -l finder -f finder-compile-keywords-make-dist $(lisp) $(WINS) | |
108 | ||
109 | loaddefs.el: | |
e22b24eb AI |
110 | $(MAKE) $(MFLAGS) loaddefs.el-$(SHELLTYPE) |
111 | cp loaddefs.el-$(SHELLTYPE) $@ | |
112 | rm loaddefs.el-$(SHELLTYPE) | |
113 | ||
114 | loaddefs.el-SH: | |
115 | echo ";;; loaddefs.el --- automatically extracted autoloads" > $@ | |
116 | echo ";;" >> $@; echo ";;; Code:" >> $@ | |
117 | echo "(autoload 'define-minor-mode \"easy-mmode\")" >>$@ | |
118 | echo "(autoload 'define-ccl-program \"ccl\")" >>$@ | |
119 | echo "(autoload 'regexp-opt \"regexp-opt\")" >>$@ | |
120 | echo "(autoload 'string-to-list \"mule-util\")" >>$@ | |
121 | echo "(autoload 'define-derived-mode \"derived\")" >>$@ | |
122 | echo "(autoload 'encoded-kbd-mode \"encoded-kb\")" >>$@ | |
123 | echo "(defvar cvs-global-menu nil)" >>$@ | |
124 | echo "\f" >> $@ | |
125 | echo ";;; Local Variables:" >> $@ | |
126 | echo ";;; version-control: never" >> $@ | |
127 | echo ";;; no-byte-compile: t" >> $@ | |
128 | echo ";;; no-update-autoloads: t" >> $@ | |
129 | echo ";;; End:" >> $@ | |
130 | echo ";;; loaddefs.el ends here" >> $@ | |
131 | ||
132 | loaddefs.el-CMD: | |
7bbaaedd AI |
133 | echo ;;; loaddefs.el --- automatically extracted autoloads> $@ |
134 | echo ;;; Code:>> $@ | |
e22b24eb AI |
135 | echo (autoload 'define-minor-mode "easy-mmode")>> $@ |
136 | echo (autoload 'define-ccl-program "ccl")>> $@ | |
137 | echo (autoload 'regexp-opt "regexp-opt")>> $@ | |
138 | echo (autoload 'string-to-list "mule-util")>> $@ | |
139 | echo (autoload 'define-derived-mode "derived")>> $@ | |
140 | echo (autoload 'encoded-kbd-mode "encoded-kb")>> $@ | |
141 | echo (defvar cvs-global-menu nil)>> $@ | |
d5ef6196 | 142 | echo ;;; >> $@ |
7bbaaedd AI |
143 | echo ;;; Local Variables:>> $@ |
144 | echo ;;; version-control: never>> $@ | |
145 | echo ;;; no-byte-compile: t>> $@ | |
146 | echo ;;; no-update-autoloads: t>> $@ | |
147 | echo ;;; End:>> $@ | |
148 | echo ;;; loaddefs.el ends here>> $@ | |
149 | ||
150 | autoloads: loaddefs.el doit | |
151 | @echo Directories: $(WINS) | |
c5bdb93d | 152 | $(emacs) -l autoload \ |
5459bcdf | 153 | --eval $(ARGQUOTE)(setq find-file-hook nil \ |
c5bdb93d AI |
154 | find-file-suppress-same-file-warnings t \ |
155 | generated-autoload-file \ | |
156 | $(DQUOTE)$(lisp)/loaddefs.el$(DQUOTE))$(ARGQUOTE) \ | |
157 | -f batch-update-autoloads $(lisp) $(WINS) | |
7bbaaedd AI |
158 | |
159 | subdirs.el: | |
160 | $(MAKE) $(MFLAGS) update-subdirs | |
161 | ||
162 | # Need separate version for sh and native cmd.exe | |
163 | update-subdirs: update-subdirs-$(SHELLTYPE) | |
164 | ||
165 | update-subdirs-CMD: doit | |
c45dbde8 JB |
166 | echo ;; -*- no-byte-compile: t -*->subdirs.el |
167 | echo ;; In load-path, after this directory should come>> subdirs.el | |
7bbaaedd | 168 | echo ;; certain of its subdirectories. Here we specify them.>> subdirs.el |
d053bf7e | 169 | echo (normal-top-level-add-to-load-path $(SQUOTE)(>> subdirs.el |
80bb1e21 | 170 | @for %%d in ($(WINS)) do if not (%%d)==(term) echo "%%d">> subdirs.el |
d053bf7e | 171 | echo ))>> subdirs.el |
7bbaaedd AI |
172 | |
173 | update-subdirs-SH: doit | |
0cfc4b54 | 174 | $(srcdir)/update-subdirs $(lisp); \ |
e22b24eb | 175 | for file in $(WINS); do \ |
7bbaaedd AI |
176 | $(srcdir)/update-subdirs $$file; \ |
177 | done; | |
178 | ||
179 | updates: update-subdirs autoloads finder-data custom-deps | |
180 | ||
9b006cb2 AI |
181 | # Update the AUTHORS file. |
182 | ||
183 | update-authors: | |
8f801552 | 184 | $(emacs) -l authors -f batch-update-authors $(srcdir)/AUTHORS $(srcdir) |
9b006cb2 | 185 | |
7bbaaedd AI |
186 | TAGS: $(lisptagsfiles1) $(lisptagsfiles2) |
187 | $(ETAGS) $(lisptagsfiles1) $(lisptagsfiles2) | |
188 | ||
9b006cb2 AI |
189 | TAGS-LISP: $(lisptagsfiles1) $(lisptagsfiles2) |
190 | $(ETAGS) -o TAGS-LISP $(lisptagsfiles1) $(lisptagsfiles2) | |
7bbaaedd | 191 | |
49060c51 AI |
192 | .SUFFIXES: .elc .el |
193 | ||
7bbaaedd | 194 | .el.elc: |
cc7aa053 | 195 | -$(emacs) -f batch-byte-compile $< |
7bbaaedd | 196 | |
8f801552 LK |
197 | # Compile all Lisp files, but don't recompile those that are up to |
198 | # date. Some files don't actually get compiled because they set the | |
199 | # local variable no-byte-compile. | |
7bbaaedd | 200 | |
8f801552 LK |
201 | # All .elc files are made writable before compilation in case we |
202 | # checked out read-only (CVS option -r). Files MUST be compiled one by | |
203 | # one. If we compile several files in a row we can't make sure that | |
204 | # the compilation environment is clean. We also set the load-path of | |
205 | # the Emacs used for compilation to the current directory and its | |
206 | # subdirectories, to make sure require's and load's in the files being | |
207 | # compiled find the right files. | |
7bbaaedd AI |
208 | |
209 | # Need separate version for sh and native cmd.exe | |
d198b6f5 | 210 | compile: subdirs.el compile-$(SHELLTYPE) doit |
7bbaaedd | 211 | |
d198b6f5 | 212 | compile-CMD: |
80bb1e21 JR |
213 | # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g |
214 | for %%f in ($(COMPILE_FIRST)) do \ | |
215 | $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f | |
216 | for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \ | |
217 | $(emacs) -l loaddefs -f batch-byte-compile-if-not-done %%f/%%g | |
0702b995 | 218 | |
d198b6f5 | 219 | compile-SH: |
9b006cb2 AI |
220 | # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done |
221 | for el in $(COMPILE_FIRST); do \ | |
222 | echo Compiling $$el; \ | |
e22b24eb | 223 | $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \ |
9b006cb2 AI |
224 | done |
225 | for dir in $(lisp) $(WINS); do \ | |
226 | for el in $$dir/*.el; do \ | |
227 | if test -f $$el; \ | |
228 | then \ | |
229 | echo Compiling $$el; \ | |
e22b24eb | 230 | $(emacs) -l loaddefs -f batch-byte-compile-if-not-done $$el; \ |
9b006cb2 AI |
231 | fi \ |
232 | done; \ | |
233 | done | |
234 | ||
8f801552 LK |
235 | # Compile all Lisp files. This is like `compile' but compiles files |
236 | # unconditionally. Some files don't actually get compiled because they | |
237 | # set the local variable no-byte-compile. | |
238 | ||
9b006cb2 AI |
239 | compile-always: subdirs.el compile-always-$(SHELLTYPE) doit |
240 | ||
241 | compile-always-CMD: | |
80bb1e21 JR |
242 | # -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g |
243 | for %%f in ($(COMPILE_FIRST)) do $(emacs) -f batch-byte-compile %%f | |
244 | for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do $(emacs) -f batch-byte-compile %%f/%%g | |
7bbaaedd | 245 | |
9b006cb2 | 246 | compile-always-SH: |
7bbaaedd AI |
247 | # for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done |
248 | for el in $(COMPILE_FIRST); do \ | |
249 | echo Compiling $$el; \ | |
9b006cb2 | 250 | $(emacs) -f batch-byte-compile $$el || exit 1; \ |
7bbaaedd AI |
251 | done |
252 | for dir in $(lisp) $(WINS); do \ | |
253 | for el in $$dir/*.el; do \ | |
254 | echo Compiling $$el; \ | |
9b006cb2 | 255 | $(emacs) -f batch-byte-compile $$el || exit 1; \ |
7bbaaedd AI |
256 | done; \ |
257 | done | |
258 | ||
9b006cb2 AI |
259 | compile-calc: compile-calc-$(SHELLTYPE) |
260 | ||
261 | compile-calc-CMD: | |
80bb1e21 | 262 | for %%f in ($(lisp)/calc/*.el) do $(emacs) -f batch-byte-compile %%f |
9b006cb2 | 263 | |
c45dbde8 | 264 | compile-calc-SH: |
9b006cb2 AI |
265 | for el in $(lisp)/calc/*.el; do \ |
266 | echo Compiling $$el; \ | |
267 | $(emacs) -f batch-byte-compile $$el || exit 1; \ | |
268 | done | |
269 | ||
7bbaaedd AI |
270 | # Backup compiled Lisp files in elc.tar.gz. If that file already |
271 | # exists, make a backup of it. | |
272 | ||
273 | backup-compiled-files: | |
274 | -mv $(lisp)/elc.tar.gz $(lisp)/elc.tar.gz~ | |
275 | -tar czf $(lisp)/elc.tar.gz $(lisp)/*.elc $(lisp)/*/*.elc | |
276 | ||
277 | # Compile Lisp files, but save old compiled files first. | |
278 | ||
d198b6f5 | 279 | compile-after-backup: backup-compiled-files compile-always |
7bbaaedd AI |
280 | |
281 | # Recompile all Lisp files which are newer than their .elc files. | |
282 | # Note that this doesn't create .elc files. It only recompiles if an | |
283 | # .elc is present. | |
284 | ||
285 | recompile: doit | |
9b006cb2 | 286 | $(emacs) -f batch-byte-recompile-directory $(lisp) |
7bbaaedd | 287 | |
54ab09c4 MB |
288 | # Prepare a bootstrap in the lisp subdirectory. |
289 | # | |
e8dbbf6f EZ |
290 | # Build loaddefs.el to make sure it's up-to-date. If it's not, that |
291 | # might lead to errors during the bootstrap because something fails to | |
292 | # autoload as expected. If there is no emacs binary, then we can't | |
293 | # build autoloads yet. In that case we have to use ldefs-boot.el; | |
294 | # bootstrap should always work with ldefs-boot.el. (Because | |
295 | # loaddefs.el is an automatically generated file, we don't want to | |
296 | # store it in the source repository). | |
54ab09c4 MB |
297 | # |
298 | # Remove compiled Lisp files so that bootstrap-emacs will be built from | |
299 | # sources only. | |
7bbaaedd AI |
300 | |
301 | # Need separate version for sh and native cmd.exe | |
e22b24eb | 302 | bootstrap-clean: bootstrap-clean-$(SHELLTYPE) loaddefs.el |
7bbaaedd AI |
303 | |
304 | bootstrap-clean-CMD: | |
5de7f0f7 | 305 | # if exist $(EMACS) $(MAKE) $(MFLAGS) autoloads |
e8dbbf6f | 306 | cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el |
80bb1e21 | 307 | -for %%f in (. $(WINS)) do for %%g in (%%f\*.elc) do @$(DEL) %%g |
7bbaaedd AI |
308 | |
309 | bootstrap-clean-SH: | |
5de7f0f7 | 310 | # if test -f $(EMACS); then $(MAKE) $(MFLAGS) autoloads; fi |
a3599c30 | 311 | # -rm -f $(lisp)/*.elc $(lisp)/*/*.elc |
e8dbbf6f | 312 | cp $(lisp)/ldefs-boot.el $(lisp)/loaddefs.el |
a3599c30 | 313 | -for dir in . $(WINS); do rm -f $$dir/*.elc; done |
7bbaaedd AI |
314 | |
315 | # Generate/update files for the bootstrap process. | |
014b37b6 EZ |
316 | # When done, remove bootstrap-emacs from ../bin, so that |
317 | # it will not be mistaken for an installed binary. | |
7bbaaedd | 318 | |
d198b6f5 | 319 | bootstrap: update-subdirs autoloads compile finder-data custom-deps |
014b37b6 | 320 | - $(DEL) $(EMACS) |
7bbaaedd AI |
321 | |
322 | # | |
323 | # Assuming INSTALL_DIR is defined, copy the elisp files to it | |
324 | # Windows 95 makes this harder than it should be. | |
325 | # | |
326 | install: | |
327 | - mkdir "$(INSTALL_DIR)/lisp" | |
328 | - $(DEL) ../same-dir.tst | |
329 | - $(DEL) "$(INSTALL_DIR)/same-dir.tst" | |
330 | echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst" | |
331 | #ifdef COPY_LISP_SOURCE | |
332 | $(IFNOTSAMEDIR) $(CP_DIR) . "$(INSTALL_DIR)/lisp" $(ENDIF) | |
333 | #else | |
334 | # $(IFNOTSAMEDIR) $(CP_DIR) *.elc "$(INSTALL_DIR)/lisp" $(ENDIF) | |
335 | # $(IFNOTSAMEDIR) $(CP) cus-load.el "$(INSTALL_DIR)/lisp" $(ENDIF) | |
336 | # $(IFNOTSAMEDIR) $(CP) forms*.el "$(INSTALL_DIR)/lisp" $(ENDIF) | |
337 | # $(IFNOTSAMEDIR) $(CP) patcomp.el "$(INSTALL_DIR)/lisp" $(ENDIF) | |
338 | # $(IFNOTSAMEDIR) $(CP) subdirs.el "$(INSTALL_DIR)/lisp" $(ENDIF) | |
339 | # $(IFNOTSAMEDIR) $(CP) version.el "$(INSTALL_DIR)/lisp" $(ENDIF) | |
340 | # $(IFNOTSAMEDIR) $(CP) mail/blessmail.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF) | |
341 | # $(IFNOTSAMEDIR) $(CP) mail/sc.el "$(INSTALL_DIR)/lisp/mail" $(ENDIF) | |
342 | # $(IFNOTSAMEDIR) $(CP) play/bruce.el "$(INSTALL_DIR)/lisp/play" $(ENDIF) | |
343 | # $(IFNOTSAMEDIR) $(CP) international/latin-*.el "$(INSTALL_DIR)/lisp/international" $(ENDIF) | |
344 | # $(IFNOTSAMEDIR) $(CP) international/mule-conf.el "$(INSTALL_DIR)/lisp/international" $(ENDIF) | |
345 | #endif | |
346 | - $(DEL) ../same-dir.tst | |
347 | - $(DEL) "$(INSTALL_DIR)/same-dir.tst" | |
348 | ||
349 | # | |
350 | # Maintenance | |
c45dbde8 | 351 | # |
7bbaaedd AI |
352 | clean: |
353 | - $(DEL) *~ |