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