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