A better solution for the last change:
[bpt/emacs.git] / nt / makefile.w32-in
CommitLineData
bd6766d3 1# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.\r
b65d8176 2# Copyright (C) 2000, 2001, 2002, 2003, 2004,\r
4e6835db 3# 2005, 2006, 2007 Free Software Foundation, Inc.\r
8af54a64
AI
4#\r
5# Top level makefile for building GNU Emacs on Windows NT\r
6#\r
7# This file is part of GNU Emacs.\r
177c0ea7 8#\r
8af54a64
AI
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
4a9f99bd 11# the Free Software Foundation; either version 3, or (at your option)\r
8af54a64 12# any later version.\r
177c0ea7 13#\r
8af54a64
AI
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
177c0ea7 18#\r
8af54a64
AI
19# You should have received a copy of the GNU General Public License\r
20# along with GNU Emacs; see the file COPYING. If not, write to\r
364c38d3
LK
21# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\r
22# Boston, MA 02110-1301, USA.\r
8af54a64 23\r
7e5f4e57
EZ
24# FIXME: This file uses DOS EOLs. Convert to Unix after 22.1 is out\r
25# (and remove or replace this comment).\r
26\r
8af54a64
AI
27ALL = addpm ddeclient runemacs cmdproxy addsection preprep\r
28\r
29.PHONY: $(ALL)\r
30\r
31TRES = $(BLD)/emacs.res\r
32\r
b47342e3
EZ
33XMFLAGS =\r
34\r
35addpm: stamp_BLD $(BLD)/addpm.exe\r
8af54a64
AI
36$(BLD)/addpm.exe: $(BLD)/addpm.$(O)\r
37 $(LINK) $(LINK_OUT)$@ \\r
38 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)\r
39\r
b47342e3 40ddeclient: stamp_BLD $(BLD)/ddeclient.exe\r
8af54a64
AI
41$(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)\r
42 $(LINK) $(LINK_OUT)$@ \\r
43 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)\r
44\r
b47342e3 45cmdproxy: stamp_BLD $(BLD)/cmdproxy.exe\r
8af54a64
AI
46$(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)\r
47 $(LINK) $(LINK_OUT)$@ \\r
48 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)\r
49\r
b47342e3 50addsection: stamp_BLD $(BLD)/addsection.exe\r
8af54a64
AI
51$(BLD)/addsection.exe: $(BLD)/addsection.$(O)\r
52 $(LINK) $(LINK_OUT)$@ \\r
53 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)\r
54\r
b47342e3 55preprep: stamp_BLD $(BLD)/preprep.exe\r
8af54a64
AI
56$(BLD)/preprep.exe: $(BLD)/preprep.$(O)\r
57 $(LINK) $(LINK_OUT)$@ \\r
58 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)\r
59\r
60#\r
61# The resource file. NT 3.10 requires the use of cvtres; even though\r
62# it is not necessary on later versions, it is still ok to use it.\r
63#\r
b47342e3 64$(TRES): emacs.rc stamp_BLD\r
2126efcc 65 $(RC) $(RC_OUT)$(BLD)/emacs.res emacs.rc\r
8af54a64 66\r
b47342e3 67runemacs: stamp_BLD $(BLD)/runemacs.exe\r
8af54a64
AI
68$(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)\r
69 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \\r
70 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)\r
71\r
72which-sh:\r
73 @echo Using $(THE_SHELL) as shell.\r
74\r
b47342e3
EZ
75# These depend on stamp_BLD to make sure the $(BLD) directory is created\r
76# before the compilation begins, even if Make runs several commands\r
77# in parallel under "make -j".\r
78#\r
79$(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD\r
32d0013e 80\r
8af54a64
AI
81#\r
82# Build emacs\r
83#\r
b47342e3 84all: which-sh stamp_BLD $(ALL) maybe-bootstrap all-other-dirs-$(MAKETYPE)\r
8af54a64 85\r
32d0013e 86all-other-dirs-nmake: addsection\r
8af54a64 87 cd ..\lib-src\r
d572c005 88 $(MAKE) $(MFLAGS) all\r
8af54a64 89 cd ..\src\r
d572c005 90 $(MAKE) $(MFLAGS) all\r
8af54a64 91 cd ..\lisp\r
d572c005 92 $(MAKE) $(MFLAGS) all\r
8af54a64 93 cd ..\leim\r
d572c005 94 $(MAKE) $(MFLAGS) all\r
8af54a64
AI
95 cd ..\nt\r
96\r
32d0013e 97all-other-dirs-gmake: addsection\r
b47342e3
EZ
98 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all\r
99 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all\r
100 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all\r
101 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all\r
8af54a64
AI
102\r
103recompile: recompile-$(MAKETYPE)\r
104\r
105recompile-nmake:\r
106 cd ..\lisp\r
d572c005 107 $(MAKE) $(MFLAGS) recompile\r
8af54a64
AI
108 cd ..\nt\r
109\r
110recompile-gmake:\r
b47342e3 111 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile\r
8af54a64
AI
112\r
113#### Bootstrapping.\r
114\r
115### This is meant for Emacs maintainers only. It first cleans the\r
116### lisp subdirectory, removing all compiled Lisp files. Then a\r
117### special emacs executable is built from Lisp sources, which is then\r
118### used to compile Lisp files. The last step is a "normal" make.\r
119\r
c3c57777
JR
120maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)\r
121\r
122# dummy target to force other targets to be evaluated.\r
123doit:\r
124\r
125maybe-bootstrap-CMD: doit\r
d5ef6196 126 @echo .\r
c3c57777
JR
127 @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing. You should either\r
128 @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow\r
d5ef6196 129 @echo .\r
c3c57777
JR
130 @if not EXIST ..\lisp\abbrev.elc exit -1\r
131\r
132maybe-bootstrap-SH: doit\r
133 @if [ ! -f ../lisp/abbrev.elc ] ; then \\r
134 echo; \\r
135 echo "Essential Lisp files seem to be missing. You should either"; \\r
136 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \\r
137 echo; \\r
138 exit -1; \\r
139 fi\r
140\r
f37b8e41
EZ
141# Bootstrap depends on cmdproxy because some Lisp functions\r
142# loaded during bootstrap may need to run shell commands.\r
143bootstrap: addsection cmdproxy bootstrap-$(MAKETYPE)\r
55b5878d 144 $(MAKE) $(MFLAGS) $(XMFLAGS) all\r
8af54a64 145\r
f37b8e41 146bootstrap-nmake: addsection cmdproxy\r
8af54a64
AI
147 cd ..\lisp\r
148 $(MAKE) $(MFLAGS) bootstrap-clean\r
149 cd ..\src\r
150 $(MAKE) $(MFLAGS) clean\r
151 cd ..\lib-src\r
dc728514 152 $(MAKE) $(MFLAGS) clean\r
8af54a64
AI
153 cd ..\src\r
154 $(MAKE) $(MFLAGS) bootstrap\r
155 $(MAKE) $(MFLAGS) bootstrap-clean\r
128c1013 156 cd ..\nt\r
f37b8e41 157 $(CP) $(BLD)/cmdproxy.exe ../bin\r
8af54a64 158 cd ..\lisp\r
73dfa0bf 159 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap\r
dc728514
JB
160 cd ..\lib-src\r
161 $(MAKE) $(MFLAGS) DOC\r
8af54a64
AI
162 cd ..\nt\r
163\r
f37b8e41 164bootstrap-gmake: addsection cmdproxy\r
b47342e3
EZ
165 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean\r
166 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean\r
167 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean\r
d572c005 168 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap\r
b47342e3 169 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean\r
f37b8e41 170 $(CP) $(BLD)/cmdproxy.exe ../bin\r
b47342e3
EZ
171 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap\r
172 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC\r
8af54a64
AI
173\r
174bootstrap-clean: bootstrap-clean-$(MAKETYPE)\r
175\r
176bootstrap-clean-nmake:\r
177 cd ..\src\r
178 $(MAKE) $(MFLAGS) bootstrap-clean\r
179 cd ..\lisp\r
180 $(MAKE) $(MFLAGS) bootstrap-clean\r
181\r
182bootstrap-clean-gmake:\r
b47342e3
EZ
183 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean\r
184 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean\r
8af54a64
AI
185\r
186$(INSTALL_DIR):\r
187 - mkdir "$(INSTALL_DIR)"\r
188\r
189$(INSTALL_DIR)/bin: $(INSTALL_DIR)\r
190 - mkdir "$(INSTALL_DIR)/bin"\r
191\r
192#\r
193# Build and install emacs in INSTALL_DIR\r
194#\r
195install: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)\r
196 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin\r
197 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin\r
198 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin\r
199 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin\r
f8985061 200 - "$(INSTALL_DIR)/bin/addpm" -q\r
8af54a64
AI
201 - $(DEL) ../same-dir.tst\r
202 - $(DEL) $(INSTALL_DIR)/same-dir.tst\r
203 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"\r
204 - mkdir "$(INSTALL_DIR)/etc"\r
205 - mkdir "$(INSTALL_DIR)/info"\r
206 - mkdir "$(INSTALL_DIR)/lock"\r
207 - mkdir "$(INSTALL_DIR)/data"\r
208 - mkdir "$(INSTALL_DIR)/site-lisp"\r
209 - mkdir "$(INSTALL_DIR)/etc/icons"\r
210 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)\r
211 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)\r
212 - $(CP_DIR) icons $(INSTALL_DIR)/etc\r
213 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)\r
da3ef617
JR
214 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)\r
215 - $(CP) ../COPYING $(INSTALL_DIR)/bin\r
8af54a64
AI
216 - $(DEL) ../same-dir.tst\r
217 - $(DEL) $(INSTALL_DIR)/same-dir.tst\r
218\r
219install-other-dirs-nmake:\r
220 cd ..\lib-src\r
221 $(MAKE) $(MFLAGS) install\r
222 cd ..\src\r
223 $(MAKE) $(MFLAGS) install\r
224 cd ..\lisp\r
225 $(MAKE) $(MFLAGS) install\r
226 cd ..\leim\r
227 $(MAKE) $(MFLAGS) install\r
228 cd ..\nt\r
229\r
230install-other-dirs-gmake:\r
b47342e3
EZ
231 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install\r
232 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install\r
233 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install\r
234 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install\r
8af54a64 235\r
fd1f2f1e 236force-info:\r
d038b84d 237# Note that doc/emacs/makefile knows how to\r
fd1f2f1e
JR
238# put the info files in $(infodir),\r
239# so we can do ok running make in the build dir.\r
5eb3d2a5
JR
240info: force-info info-$(MAKETYPE)\r
241\r
242info-nmake:\r
d038b84d 243 cd ..\doc\emacs\r
5eb3d2a5 244 $(MAKE) $(MFLAGS) info\r
d038b84d 245 cd ..\doc\misc\r
5eb3d2a5 246 $(MAKE) $(MFLAGS) info\r
d038b84d
GM
247 cd ..\doc\lispref\r
248 $(MAKE) $(MFLAGS) info\r
249 cd ..\doc\lispintro\r
5eb3d2a5
JR
250 $(MAKE) $(MFLAGS) info\r
251\r
252info-gmake:\r
d038b84d
GM
253 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs info\r
254 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc info\r
255 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref info\r
256 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro info\r
8af54a64
AI
257#\r
258# Maintenance\r
177c0ea7 259#\r
8af54a64 260clean: clean-other-dirs-$(MAKETYPE)\r
f37b8e41 261 - $(DEL) $(COMPILER_TEMP_FILES)\r
8af54a64 262 - $(DEL_TREE) $(OBJDIR)\r
e313b518 263 - $(DEL) stamp_BLD\r
8af54a64
AI
264 - $(DEL) ../etc/DOC ../etc/DOC-X\r
265\r
266clean-other-dirs-nmake:\r
267 cd ..\lib-src\r
268 $(MAKE) $(MFLAGS) clean\r
269 cd ..\src\r
270 $(MAKE) $(MFLAGS) clean\r
271 cd ..\lisp\r
272 $(MAKE) $(MFLAGS) clean\r
d038b84d 273 cd ..\doc\lispintro\r
fd1f2f1e 274 $(MAKE) $(MFLAGS) clean\r
d038b84d 275 cd ..\doc\lispref\r
fd1f2f1e 276 $(MAKE) $(MFLAGS) clean\r
8af54a64
AI
277 cd ..\leim\r
278 $(MAKE) $(MFLAGS) clean\r
d038b84d
GM
279 cd ..\doc\emacs\r
280 $(MAKE) $(MFLAGS) clean\r
281 cd ..\doc\misc\r
fd1f2f1e 282 $(MAKE) $(MFLAGS) clean\r
8af54a64
AI
283 cd ..\nt\r
284\r
285clean-other-dirs-gmake:\r
b47342e3
EZ
286 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean\r
287 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean\r
288 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp clean\r
289 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean\r
8af54a64
AI
290\r
291cleanall-other-dirs-nmake:\r
292 cd ..\lib-src\r
293 $(MAKE) $(MFLAGS) cleanall\r
294 cd ..\src\r
295 $(MAKE) $(MFLAGS) cleanall\r
296 cd ..\nt\r
297\r
298cleanall-other-dirs-gmake:\r
b47342e3
EZ
299 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall\r
300 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall\r
8af54a64 301\r
f37b8e41
EZ
302# We used to delete *~ here, but that might inadvertently remove\r
303# precious files if it happens to match their short 8+3 aliases.\r
8af54a64
AI
304cleanall: clean cleanall-other-dirs-$(MAKETYPE)\r
305 - $(DEL_TREE) obj\r
306 - $(DEL_TREE) obj-spd\r
307 - $(DEL_TREE) oo\r
308 - $(DEL_TREE) oo-spd\r
309\r
310realclean: cleanall\r
311 - $(DEL_TREE) ../bin\r