Merge from emacs--rel--22
[bpt/emacs.git] / nt / makefile.w32-in
1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
3 # 2008 Free Software Foundation, Inc.
4 #
5 # Top level makefile for building GNU Emacs on Windows NT
6 #
7 # This file is part of GNU Emacs.
8
9 # GNU Emacs is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13
14 # GNU Emacs is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22
23 # FIXME: This file uses DOS EOLs. Convert to Unix after 22.1 is out
24 # (and remove or replace this comment).
25
26 TRES = $(BLD)/emacs.res
27 CLIENTRES = $(BLD)/emacsclient.res
28
29 XMFLAGS =
30
31 ALL = addpm ddeclient runemacs cmdproxy addsection preprep
32
33 .PHONY: $(ALL)
34
35
36 addpm: stamp_BLD $(BLD)/addpm.exe
37 $(BLD)/addpm.exe: $(BLD)/addpm.$(O)
38 $(LINK) $(LINK_OUT)$@ \
39 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
40
41 ddeclient: stamp_BLD $(BLD)/ddeclient.exe
42 $(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
43 $(LINK) $(LINK_OUT)$@ \
44 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
45
46 cmdproxy: stamp_BLD $(BLD)/cmdproxy.exe
47 $(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
48 $(LINK) $(LINK_OUT)$@ \
49 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
50
51 addsection: stamp_BLD $(BLD)/addsection.exe
52 $(BLD)/addsection.exe: $(BLD)/addsection.$(O)
53 $(LINK) $(LINK_OUT)$@ \
54 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
55
56 preprep: stamp_BLD $(BLD)/preprep.exe
57 $(BLD)/preprep.exe: $(BLD)/preprep.$(O)
58 $(LINK) $(LINK_OUT)$@ \
59 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)
60
61 #
62 # The resource file. NT 3.10 requires the use of cvtres; even though
63 # it is not necessary on later versions, it is still ok to use it.
64 #
65 $(TRES): emacs.rc icons/emacs.ico emacs.manifest stamp_BLD
66 $(RC) $(RC_OUT)$(TRES) emacs.rc
67
68 $(CLIENTRES): emacsclient.rc stamp_BLD
69 $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
70
71 runemacs: stamp_BLD $(BLD)/runemacs.exe
72 $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
73 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
74 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
75
76 which-sh:
77 @echo Using $(THE_SHELL) as shell.
78
79 # These depend on stamp_BLD to make sure the $(BLD) directory is created
80 # before the compilation begins, even if Make runs several commands
81 # in parallel under "make -j".
82 #
83 $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
84
85 #
86 # Build emacs
87 #
88 all: which-sh stamp_BLD $(ALL) $(CLIENTRES) maybe-bootstrap all-other-dirs-$(MAKETYPE)
89
90 all-other-dirs-nmake: addsection
91 cd ..\lib-src
92 $(MAKE) $(MFLAGS) all
93 cd ..\src
94 $(MAKE) $(MFLAGS) all
95 cd ..\lisp
96 $(MAKE) $(MFLAGS) all
97 cd ..\leim
98 $(MAKE) $(MFLAGS) all
99 cd ..\nt
100
101 all-other-dirs-gmake: addsection
102 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
103 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
104 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
105 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
106
107 recompile: recompile-$(MAKETYPE)
108
109 recompile-nmake:
110 cd ..\lisp
111 $(MAKE) $(MFLAGS) recompile
112 cd ..\nt
113
114 recompile-gmake:
115 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
116
117 #### Bootstrapping.
118
119 ### This is meant for Emacs maintainers only. It first cleans the
120 ### lisp subdirectory, removing all compiled Lisp files. Then a
121 ### special emacs executable is built from Lisp sources, which is then
122 ### used to compile Lisp files. The last step is a "normal" make.
123
124 maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
125
126 # dummy target to force other targets to be evaluated.
127 doit:
128
129 maybe-bootstrap-CMD: doit
130 @echo .
131 @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing. You should either
132 @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow
133 @echo .
134 @if not EXIST ..\lisp\abbrev.elc exit -1
135
136 maybe-bootstrap-SH: doit
137 @if [ ! -f ../lisp/abbrev.elc ] ; then \
138 echo; \
139 echo "Essential Lisp files seem to be missing. You should either"; \
140 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \
141 echo; \
142 exit -1; \
143 fi
144
145 # Bootstrap depends on cmdproxy because some Lisp functions
146 # loaded during bootstrap may need to run shell commands.
147 bootstrap: addsection cmdproxy bootstrap-$(MAKETYPE)
148 $(MAKE) $(MFLAGS) $(XMFLAGS) all
149
150 bootstrap-nmake: addsection cmdproxy
151 cd ..\lisp
152 $(MAKE) $(MFLAGS) bootstrap-clean
153 cd ..\src
154 $(MAKE) $(MFLAGS) clean
155 cd ..\lib-src
156 $(MAKE) $(MFLAGS) clean
157 cd ..\src
158 $(MAKE) $(MFLAGS) bootstrap
159 $(MAKE) $(MFLAGS) bootstrap-clean
160 cd ..\nt
161 $(CP) $(BLD)/cmdproxy.exe ../bin
162 cd ..\lisp
163 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
164 cd ..\lib-src
165 $(MAKE) $(MFLAGS) DOC
166 cd ..\nt
167
168 bootstrap-gmake: addsection cmdproxy
169 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
170 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
171 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
172 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
173 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
174 $(CP) $(BLD)/cmdproxy.exe ../bin
175 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
176 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
177
178 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
179
180 bootstrap-clean-nmake:
181 cd ..\src
182 $(MAKE) $(MFLAGS) bootstrap-clean
183 cd ..\lisp
184 $(MAKE) $(MFLAGS) bootstrap-clean
185
186 bootstrap-clean-gmake:
187 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
188 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
189
190 $(INSTALL_DIR):
191 - mkdir "$(INSTALL_DIR)"
192
193 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
194 - mkdir "$(INSTALL_DIR)/bin"
195
196 #
197 # Build and install emacs in INSTALL_DIR
198 #
199 install: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
200 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
201 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
202 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
203 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
204 - "$(INSTALL_DIR)/bin/addpm" -q
205 - $(DEL) ../same-dir.tst
206 - $(DEL) $(INSTALL_DIR)/same-dir.tst
207 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
208 - mkdir "$(INSTALL_DIR)/etc"
209 - mkdir "$(INSTALL_DIR)/info"
210 - mkdir "$(INSTALL_DIR)/lock"
211 - mkdir "$(INSTALL_DIR)/data"
212 - mkdir "$(INSTALL_DIR)/site-lisp"
213 - mkdir "$(INSTALL_DIR)/etc/icons"
214 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
215 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
216 - $(CP_DIR) icons $(INSTALL_DIR)/etc
217 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
218 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
219 - $(CP) ../COPYING $(INSTALL_DIR)/bin
220 - $(DEL) ../same-dir.tst
221 - $(DEL) $(INSTALL_DIR)/same-dir.tst
222
223 install-other-dirs-nmake:
224 cd ..\lib-src
225 $(MAKE) $(MFLAGS) install
226 cd ..\src
227 $(MAKE) $(MFLAGS) install
228 cd ..\lisp
229 $(MAKE) $(MFLAGS) install
230 cd ..\leim
231 $(MAKE) $(MFLAGS) install
232 cd ..\nt
233
234 install-other-dirs-gmake:
235 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
236 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
237 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
238 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
239
240 force-info:
241 # Note that doc/emacs/makefile knows how to
242 # put the info files in $(infodir),
243 # so we can do ok running make in the build dir.
244 info: force-info info-$(MAKETYPE)
245
246 info-nmake:
247 cd ..\doc\emacs
248 $(MAKE) $(MFLAGS) info
249 cd ..\misc
250 $(MAKE) $(MFLAGS) info
251 cd ..\lispref
252 $(MAKE) $(MFLAGS) info
253 cd ..\lispintro
254 $(MAKE) $(MFLAGS) info
255 cd $(MAKEDIR)
256
257 info-gmake:
258 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs info
259 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc info
260 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref info
261 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro info
262 #
263 # Maintenance
264 #
265 clean: clean-other-dirs-$(MAKETYPE)
266 - $(DEL) $(COMPILER_TEMP_FILES)
267 - $(DEL_TREE) $(OBJDIR)
268 - $(DEL) stamp_BLD
269 - $(DEL) ../etc/DOC ../etc/DOC-X
270
271 clean-other-dirs-nmake:
272 cd ..\lib-src
273 $(MAKE) $(MFLAGS) clean
274 cd ..\src
275 $(MAKE) $(MFLAGS) clean
276 cd ..\doc\lispintro
277 $(MAKE) $(MFLAGS) clean
278 cd ..\doc\lispref
279 $(MAKE) $(MFLAGS) clean
280 cd ..\leim
281 $(MAKE) $(MFLAGS) clean
282 cd ..\doc\emacs
283 $(MAKE) $(MFLAGS) clean
284 cd ..\doc\misc
285 $(MAKE) $(MFLAGS) clean
286 cd ..\nt
287
288 clean-other-dirs-gmake:
289 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
290 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
291 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
292 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
293 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
294 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
295 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
296
297 cleanall-other-dirs-nmake:
298 cd ..\lib-src
299 $(MAKE) $(MFLAGS) cleanall
300 cd ..\src
301 $(MAKE) $(MFLAGS) cleanall
302 cd ..\nt
303
304 cleanall-other-dirs-gmake:
305 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
306 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
307
308 # We used to delete *~ here, but that might inadvertently remove
309 # precious files if it happens to match their short 8+3 aliases.
310 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
311 - $(DEL_TREE) obj
312 - $(DEL_TREE) obj-spd
313 - $(DEL_TREE) oo
314 - $(DEL_TREE) oo-spd
315
316 top-distclean:
317 - $(DEL) $(COMPILER_TEMP_FILES)
318 - $(DEL_TREE) obj
319 - $(DEL_TREE) obj-spd
320 - $(DEL_TREE) oo
321 - $(DEL_TREE) oo-spd
322 - $(DEL) stamp_BLD
323 - $(DEL) ../etc/DOC ../etc/DOC-X
324 - $(DEL) config.log Makefile
325
326 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
327
328 distclean-other-dirs-nmake:
329 cd ..\lib-src
330 $(MAKE) $(MFLAGS) distclean
331 cd ..\src
332 $(MAKE) $(MFLAGS) distclean
333 cd ..\lisp
334 $(MAKE) $(MFLAGS) distclean
335 cd ..\leim
336 $(MAKE) $(MFLAGS) distclean
337 cd ..\doc\emacs
338 $(MAKE) $(MFLAGS) distclean
339 cd ..\doc\misc
340 $(MAKE) $(MFLAGS) distclean
341 cd ..\doc\lispintro
342 $(MAKE) $(MFLAGS) distclean
343 cd ..\doc\lispref
344 $(MAKE) $(MFLAGS) distclean
345 cd ..\nt
346
347 distclean-other-dirs-gmake:
348 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
349 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
350 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
351 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
352 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
353 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
354 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
355 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
356
357 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
358
359 maintainer-clean-other-dirs-nmake:
360 cd ..\lib-src
361 $(MAKE) $(MFLAGS) maintainer-clean
362 cd ..\src
363 $(MAKE) $(MFLAGS) maintainer-clean
364 cd ..\lisp
365 $(MAKE) $(MFLAGS) maintainer-clean
366 cd ..\leim
367 $(MAKE) $(MFLAGS) maintainer-clean
368 cd ..\doc\emacs
369 $(MAKE) $(MFLAGS) maintainer-clean
370 cd ..\doc\misc
371 $(MAKE) $(MFLAGS) maintainer-clean
372 cd ..\doc\lispintro
373 $(MAKE) $(MFLAGS) maintainer-clean
374 cd ..\doc\lispref
375 $(MAKE) $(MFLAGS) maintainer-clean
376 cd ..\nt
377
378 maintainer-clean-other-dirs-gmake:
379 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
380 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
381 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
382 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
383 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
384 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
385 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
386 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean
387
388 realclean: cleanall
389 - $(DEL_TREE) ../bin