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