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