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