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.
5 # Top level makefile for building GNU Emacs on Windows NT
7 # This file is part of GNU Emacs.
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.
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.
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/>.
23 # FIXME: This file uses DOS EOLs. Convert to Unix after 22.1 is out
24 # (and remove or replace this comment).
28 TRES = $(BLD)/emacs.res
29 CLIENTRES = $(BLD)/emacsclient.res
33 ALL = addpm ddeclient runemacs cmdproxy addsection preprep
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)
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)
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)
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)
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)
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.
68 $(TRES): emacs.rc icons/emacs.ico emacs.manifest stamp_BLD
69 $(RC) $(RC_OUT)$(TRES) emacs.rc
71 $(CLIENTRES): emacsclient.rc stamp_BLD
72 $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
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)
80 @echo Using $(THE_SHELL) as shell.
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".
86 $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
91 all: which-sh stamp_BLD $(ALL) $(CLIENTRES) maybe-bootstrap all-other-dirs-$(MAKETYPE)
93 all-other-dirs-nmake: addsection
101 $(MAKE) $(MFLAGS) all
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
110 recompile: recompile-$(MAKETYPE)
114 $(MAKE) $(MFLAGS) recompile
118 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
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.
127 maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
129 # dummy target to force other targets to be evaluated.
132 maybe-bootstrap-CMD: doit
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
137 @if not EXIST ..\lisp\abbrev.elc exit -1
139 maybe-bootstrap-SH: doit
140 @if [ ! -f ../lisp/abbrev.elc ] ; then \
142 echo "Essential Lisp files seem to be missing. You should either"; \
143 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \
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
153 bootstrap-nmake: addsection cmdproxy
155 $(MAKE) $(MFLAGS) bootstrap-clean
157 $(MAKE) $(MFLAGS) clean
159 $(MAKE) $(MFLAGS) clean
161 $(MAKE) $(MFLAGS) bootstrap
162 $(MAKE) $(MFLAGS) bootstrap-clean
164 $(CP) $(BLD)/cmdproxy.exe ../bin
166 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
168 $(MAKE) $(MFLAGS) DOC
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
181 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
183 bootstrap-clean-nmake:
185 $(MAKE) $(MFLAGS) bootstrap-clean
187 $(MAKE) $(MFLAGS) bootstrap-clean
189 bootstrap-clean-gmake:
190 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
191 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
194 - mkdir "$(INSTALL_DIR)"
196 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
197 - mkdir "$(INSTALL_DIR)/bin"
200 # Build and install emacs in INSTALL_DIR
202 .PHONY: install-bin install-shortcuts
204 install: install-bin install-shortcuts
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
229 install-other-dirs-nmake:
231 $(MAKE) $(MFLAGS) install
233 $(MAKE) $(MFLAGS) install
235 $(MAKE) $(MFLAGS) install
237 $(MAKE) $(MFLAGS) install
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
247 "$(INSTALL_DIR)/bin/addpm" -q
250 $(CP) $(DIST_FILES) $(INSTALL_DIR)/bin
251 $(CP) README.W32 $(INSTALL_DIR)
252 $(COMSPEC)$(ComSpec) /c $(ARGQUOTE)zipdist.bat $(INSTALL_DIR) $(VERSION)$(ARGQUOTE)
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)
262 $(MAKE) $(MFLAGS) info
264 $(MAKE) $(MFLAGS) info
266 $(MAKE) $(MFLAGS) info
268 $(MAKE) $(MFLAGS) info
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
279 clean: clean-other-dirs-$(MAKETYPE)
280 - $(DEL) $(COMPILER_TEMP_FILES)
281 - $(DEL_TREE) $(OBJDIR)
283 - $(DEL) ../etc/DOC ../etc/DOC-X
285 clean-other-dirs-nmake:
287 $(MAKE) $(MFLAGS) clean
289 $(MAKE) $(MFLAGS) clean
291 $(MAKE) $(MFLAGS) clean
293 $(MAKE) $(MFLAGS) clean
295 $(MAKE) $(MFLAGS) clean
297 $(MAKE) $(MFLAGS) clean
299 $(MAKE) $(MFLAGS) clean
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
311 cleanall-other-dirs-nmake:
313 $(MAKE) $(MFLAGS) cleanall
315 $(MAKE) $(MFLAGS) cleanall
318 cleanall-other-dirs-gmake:
319 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
320 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
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)
326 - $(DEL_TREE) obj-spd
331 - $(DEL) $(COMPILER_TEMP_FILES)
333 - $(DEL_TREE) obj-spd
337 - $(DEL) ../etc/DOC ../etc/DOC-X
338 - $(DEL) config.log Makefile
340 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
342 distclean-other-dirs-nmake:
344 $(MAKE) $(MFLAGS) distclean
346 $(MAKE) $(MFLAGS) distclean
348 $(MAKE) $(MFLAGS) distclean
350 $(MAKE) $(MFLAGS) distclean
352 $(MAKE) $(MFLAGS) distclean
354 $(MAKE) $(MFLAGS) distclean
356 $(MAKE) $(MFLAGS) distclean
358 $(MAKE) $(MFLAGS) distclean
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
371 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
373 maintainer-clean-other-dirs-nmake:
375 $(MAKE) $(MFLAGS) maintainer-clean
377 $(MAKE) $(MFLAGS) maintainer-clean
379 $(MAKE) $(MFLAGS) maintainer-clean
381 $(MAKE) $(MFLAGS) maintainer-clean
383 $(MAKE) $(MFLAGS) maintainer-clean
385 $(MAKE) $(MFLAGS) maintainer-clean
387 $(MAKE) $(MFLAGS) maintainer-clean
389 $(MAKE) $(MFLAGS) maintainer-clean
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