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 TMP_DIST_DIR = emacs-$(VERSION)
30 TRES = $(BLD)/emacs.res
31 CLIENTRES = $(BLD)/emacsclient.res
35 ALL = addpm ddeclient runemacs cmdproxy addsection preprep
40 addpm: stamp_BLD $(BLD)/addpm.exe
41 $(BLD)/addpm.exe: $(BLD)/addpm.$(O)
42 $(LINK) $(LINK_OUT)$@ \
43 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) \
44 $(USER32) $(OLE32) $(UUID) $(SHELL32)
46 ddeclient: stamp_BLD $(BLD)/ddeclient.exe
47 $(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
48 $(LINK) $(LINK_OUT)$@ \
49 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
51 cmdproxy: stamp_BLD $(BLD)/cmdproxy.exe
52 $(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
53 $(LINK) $(LINK_OUT)$@ \
54 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
56 addsection: stamp_BLD $(BLD)/addsection.exe
57 $(BLD)/addsection.exe: $(BLD)/addsection.$(O)
58 $(LINK) $(LINK_OUT)$@ \
59 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
61 preprep: stamp_BLD $(BLD)/preprep.exe
62 $(BLD)/preprep.exe: $(BLD)/preprep.$(O)
63 $(LINK) $(LINK_OUT)$@ \
64 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)
67 # The resource file. NT 3.10 requires the use of cvtres; even though
68 # it is not necessary on later versions, it is still ok to use it.
70 $(TRES): emacs.rc icons/emacs.ico emacs.manifest stamp_BLD
71 $(RC) $(RC_OUT)$(TRES) emacs.rc
73 $(CLIENTRES): emacsclient.rc stamp_BLD
74 $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
76 runemacs: stamp_BLD $(BLD)/runemacs.exe
77 $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
78 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
79 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
82 @echo Using $(THE_SHELL) as shell.
84 # These depend on stamp_BLD to make sure the $(BLD) directory is created
85 # before the compilation begins, even if Make runs several commands
86 # in parallel under "make -j".
88 $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
93 all: which-sh stamp_BLD $(ALL) $(CLIENTRES) maybe-bootstrap all-other-dirs-$(MAKETYPE)
95 all-other-dirs-nmake: addsection
101 $(MAKE) $(MFLAGS) all
103 $(MAKE) $(MFLAGS) all
106 all-other-dirs-gmake: addsection
107 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
108 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
109 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
110 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
112 recompile: recompile-$(MAKETYPE)
116 $(MAKE) $(MFLAGS) recompile
120 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
124 ### This is meant for Emacs maintainers only. It first cleans the
125 ### lisp subdirectory, removing all compiled Lisp files. Then a
126 ### special emacs executable is built from Lisp sources, which is then
127 ### used to compile Lisp files. The last step is a "normal" make.
129 maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
131 # dummy target to force other targets to be evaluated.
134 maybe-bootstrap-CMD: doit
136 @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing. You should either
137 @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow
139 @if not EXIST ..\lisp\abbrev.elc exit -1
141 maybe-bootstrap-SH: doit
142 @if [ ! -f ../lisp/abbrev.elc ] ; then \
144 echo "Essential Lisp files seem to be missing. You should either"; \
145 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \
150 # Bootstrap depends on cmdproxy because some Lisp functions
151 # loaded during bootstrap may need to run shell commands.
152 bootstrap: addsection cmdproxy bootstrap-$(MAKETYPE)
153 $(MAKE) $(MFLAGS) $(XMFLAGS) all
155 bootstrap-nmake: addsection cmdproxy
157 $(MAKE) $(MFLAGS) bootstrap-clean
159 $(MAKE) $(MFLAGS) clean
161 $(MAKE) $(MFLAGS) clean
163 $(MAKE) $(MFLAGS) bootstrap
164 $(MAKE) $(MFLAGS) bootstrap-clean
166 $(CP) $(BLD)/cmdproxy.exe ../bin
168 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
170 $(MAKE) $(MFLAGS) DOC
173 bootstrap-gmake: addsection cmdproxy
174 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
175 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
176 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
177 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
178 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
179 $(CP) $(BLD)/cmdproxy.exe ../bin
180 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
181 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
183 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
185 bootstrap-clean-nmake:
187 $(MAKE) $(MFLAGS) bootstrap-clean
189 $(MAKE) $(MFLAGS) bootstrap-clean
191 bootstrap-clean-gmake:
192 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
193 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
196 - mkdir "$(INSTALL_DIR)"
198 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
199 - mkdir "$(INSTALL_DIR)/bin"
202 # Build and install emacs in INSTALL_DIR
204 .PHONY: install-bin install-shortcuts
206 install: install-bin install-shortcuts
208 install-bin: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
209 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
210 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
211 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
212 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
213 - $(CP) README.W32 $(INSTALL_DIR)
214 - $(DEL) ../same-dir.tst
215 - $(DEL) $(INSTALL_DIR)/same-dir.tst
216 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
217 - mkdir "$(INSTALL_DIR)/etc"
218 - mkdir "$(INSTALL_DIR)/info"
219 - mkdir "$(INSTALL_DIR)/lock"
220 - mkdir "$(INSTALL_DIR)/data"
221 - mkdir "$(INSTALL_DIR)/site-lisp"
222 - mkdir "$(INSTALL_DIR)/etc/icons"
223 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
224 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
225 - $(CP_DIR) icons $(INSTALL_DIR)/etc
226 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
227 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
228 - $(CP) ../COPYING $(INSTALL_DIR)/bin
229 - $(DEL) ../same-dir.tst
230 - $(DEL) $(INSTALL_DIR)/same-dir.tst
232 install-other-dirs-nmake:
234 $(MAKE) $(MFLAGS) install
236 $(MAKE) $(MFLAGS) install
238 $(MAKE) $(MFLAGS) install
240 $(MAKE) $(MFLAGS) install
243 install-other-dirs-gmake:
244 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
245 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
246 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
247 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
250 "$(INSTALL_DIR)/bin/addpm" -q
253 mkdir $(TMP_DIST_DIR)
254 $(CP) "$(INSTALL_DIR)/BUGS" $(TMP_DIST_DIR)
255 $(CP) "$(INSTALL_DIR)/COPYING" $(TMP_DIST_DIR)
256 $(CP) "$(INSTALL_DIR)/README" $(TMP_DIST_DIR)
257 $(CP) "$(INSTALL_DIR)/README.W32" $(TMP_DIST_DIR)
258 $(CP) "$(INSTALL_DIR)/INSTALL" $(TMP_DIST_DIR)
259 $(CP_DIR) "$(INSTALL_DIR)/bin" $(TMP_DIST_DIR)
260 $(CP_DIR) "$(INSTALL_DIR)/etc" $(TMP_DIST_DIR)
261 $(CP_DIR) "$(INSTALL_DIR)/info" $(TMP_DIST_DIR)
262 $(CP_DIR) "$(INSTALL_DIR)/lisp" $(TMP_DIST_DIR)
263 $(CP_DIR) "$(INSTALL_DIR)/leim" $(TMP_DIST_DIR)
264 $(CP_DIR) "$(INSTALL_DIR)/site-lisp" $(TMP_DIST_DIR)
265 $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin
266 $(COMSPEC)$(ComSpec) /c $(ARGQUOTE)zipdist.bat $(VERSION)$(ARGQUOTE)
267 $(DEL_TREE) $(TMP_DIST_DIR)
270 # Note that doc/emacs/makefile knows how to
271 # put the info files in $(infodir),
272 # so we can do ok running make in the build dir.
273 info: force-info info-$(MAKETYPE)
277 $(MAKE) $(MFLAGS) info
279 $(MAKE) $(MFLAGS) info
281 $(MAKE) $(MFLAGS) info
283 $(MAKE) $(MFLAGS) info
287 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs info
288 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc info
289 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref info
290 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro info
294 clean: clean-other-dirs-$(MAKETYPE)
295 - $(DEL) $(COMPILER_TEMP_FILES)
296 - $(DEL_TREE) $(OBJDIR)
298 - $(DEL) ../etc/DOC ../etc/DOC-X
300 clean-other-dirs-nmake:
302 $(MAKE) $(MFLAGS) clean
304 $(MAKE) $(MFLAGS) clean
306 $(MAKE) $(MFLAGS) clean
308 $(MAKE) $(MFLAGS) clean
310 $(MAKE) $(MFLAGS) clean
312 $(MAKE) $(MFLAGS) clean
314 $(MAKE) $(MFLAGS) clean
317 clean-other-dirs-gmake:
318 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
319 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
320 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
321 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
322 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
323 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
324 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
326 cleanall-other-dirs-nmake:
328 $(MAKE) $(MFLAGS) cleanall
330 $(MAKE) $(MFLAGS) cleanall
333 cleanall-other-dirs-gmake:
334 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
335 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
337 # We used to delete *~ here, but that might inadvertently remove
338 # precious files if it happens to match their short 8+3 aliases.
339 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
341 - $(DEL_TREE) obj-spd
346 - $(DEL) $(COMPILER_TEMP_FILES)
348 - $(DEL_TREE) obj-spd
352 - $(DEL) ../etc/DOC ../etc/DOC-X
353 - $(DEL) config.log Makefile
354 - $(DEL) ../README.W32
356 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
358 distclean-other-dirs-nmake:
360 $(MAKE) $(MFLAGS) distclean
362 $(MAKE) $(MFLAGS) distclean
364 $(MAKE) $(MFLAGS) distclean
366 $(MAKE) $(MFLAGS) distclean
368 $(MAKE) $(MFLAGS) distclean
370 $(MAKE) $(MFLAGS) distclean
372 $(MAKE) $(MFLAGS) distclean
374 $(MAKE) $(MFLAGS) distclean
377 distclean-other-dirs-gmake:
378 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
379 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
380 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
381 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
382 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
383 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
384 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
385 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
387 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
389 maintainer-clean-other-dirs-nmake:
391 $(MAKE) $(MFLAGS) maintainer-clean
393 $(MAKE) $(MFLAGS) maintainer-clean
395 $(MAKE) $(MFLAGS) maintainer-clean
397 $(MAKE) $(MFLAGS) maintainer-clean
399 $(MAKE) $(MFLAGS) maintainer-clean
401 $(MAKE) $(MFLAGS) maintainer-clean
403 $(MAKE) $(MFLAGS) maintainer-clean
405 $(MAKE) $(MFLAGS) maintainer-clean
408 maintainer-clean-other-dirs-gmake:
409 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
410 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
411 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
412 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
413 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
414 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
415 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
416 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean