1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2000-2011 Free Software Foundation, Inc.
4 # Top level makefile for building GNU Emacs on Windows NT
6 # This file is part of GNU Emacs.
8 # GNU Emacs is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # GNU Emacs is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 # FIXME: This file uses DOS EOLs. Convert to Unix after 22.1 is out
23 # (and remove or replace this comment).
27 TMP_DIST_DIR = emacs-$(VERSION)
29 TRES = $(BLD)/emacs.res
30 CLIENTRES = $(BLD)/emacsclient.res
34 ALL = addpm ddeclient runemacs cmdproxy addsection preprep
39 addpm: stamp_BLD $(BLD)/addpm.exe
40 $(BLD)/addpm.exe: $(BLD)/addpm.$(O)
41 $(LINK) $(LINK_OUT)$@ \
42 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) \
43 $(USER32) $(OLE32) $(UUID) $(SHELL32)
45 ddeclient: stamp_BLD $(BLD)/ddeclient.exe
46 $(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
47 $(LINK) $(LINK_OUT)$@ \
48 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
50 cmdproxy: stamp_BLD $(BLD)/cmdproxy.exe
51 $(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
52 $(LINK) $(LINK_OUT)$@ \
53 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
55 addsection: stamp_BLD $(BLD)/addsection.exe
56 $(BLD)/addsection.exe: $(BLD)/addsection.$(O)
57 $(LINK) $(LINK_OUT)$@ \
58 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
60 preprep: stamp_BLD $(BLD)/preprep.exe
61 $(BLD)/preprep.exe: $(BLD)/preprep.$(O)
62 $(LINK) $(LINK_OUT)$@ \
63 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)
66 # The resource file. NT 3.10 requires the use of cvtres; even though
67 # it is not necessary on later versions, it is still ok to use it.
69 $(TRES): emacs.rc icons/emacs.ico emacs.manifest stamp_BLD
70 $(RC) $(RC_OUT)$(TRES) emacs.rc
72 $(CLIENTRES): emacsclient.rc stamp_BLD
73 $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
75 runemacs: stamp_BLD $(BLD)/runemacs.exe
76 $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
77 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
78 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
81 @echo Using $(THE_SHELL) as shell.
83 # These depend on stamp_BLD to make sure the $(BLD) directory is created
84 # before the compilation begins, even if Make runs several commands
85 # in parallel under "make -j".
87 $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
92 all: which-sh stamp_BLD $(ALL) $(CLIENTRES) maybe-bootstrap all-other-dirs-$(MAKETYPE)
94 all-other-dirs-nmake: addsection
100 $(MAKE) $(MFLAGS) all
102 $(MAKE) $(MFLAGS) all
105 all-other-dirs-gmake: addsection
106 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
107 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
108 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
109 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
111 recompile: recompile-$(MAKETYPE)
115 $(MAKE) $(MFLAGS) recompile
119 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
123 ### This is meant for Emacs maintainers only. It first cleans the
124 ### lisp subdirectory, removing all compiled Lisp files. Then a
125 ### special emacs executable is built from Lisp sources, which is then
126 ### used to compile Lisp files. The last step is a "normal" make.
128 maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
130 # dummy target to force other targets to be evaluated.
133 maybe-bootstrap-CMD: doit
135 @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing. You should either
136 @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow
138 @if not EXIST ..\lisp\abbrev.elc exit -1
140 maybe-bootstrap-SH: doit
141 @if [ ! -f ../lisp/abbrev.elc ] ; then \
143 echo "Essential Lisp files seem to be missing. You should either"; \
144 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \
149 # Bootstrap depends on cmdproxy because some Lisp functions
150 # loaded during bootstrap may need to run shell commands.
151 bootstrap: addsection cmdproxy bootstrap-$(MAKETYPE)
152 $(MAKE) $(MFLAGS) $(XMFLAGS) all
154 bootstrap-nmake: addsection cmdproxy
156 $(MAKE) $(MFLAGS) bootstrap-clean
158 $(MAKE) $(MFLAGS) clean
160 $(MAKE) $(MFLAGS) clean
162 $(MAKE) $(MFLAGS) bootstrap
163 $(MAKE) $(MFLAGS) bootstrap-clean
165 $(CP) $(BLD)/cmdproxy.exe ../bin
167 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
169 $(MAKE) $(MFLAGS) DOC
172 bootstrap-gmake: addsection cmdproxy
173 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
174 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
175 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
176 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
177 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
178 $(CP) $(BLD)/cmdproxy.exe ../bin
179 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
180 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
182 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
184 bootstrap-clean-nmake:
186 $(MAKE) $(MFLAGS) bootstrap-clean
188 $(MAKE) $(MFLAGS) bootstrap-clean
190 bootstrap-clean-gmake:
191 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
192 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
195 - mkdir "$(INSTALL_DIR)"
197 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
198 - mkdir "$(INSTALL_DIR)/bin"
201 # Build and install emacs in INSTALL_DIR
203 .PHONY: install-bin install-shortcuts
205 install: install-bin install-shortcuts
207 install-bin: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
208 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
209 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
210 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
211 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
212 - $(CP) README.W32 $(INSTALL_DIR)
213 - $(DEL) ../same-dir.tst
214 - $(DEL) $(INSTALL_DIR)/same-dir.tst
215 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
216 - mkdir "$(INSTALL_DIR)/etc"
217 - mkdir "$(INSTALL_DIR)/info"
218 - mkdir "$(INSTALL_DIR)/lock"
219 - mkdir "$(INSTALL_DIR)/data"
220 - mkdir "$(INSTALL_DIR)/site-lisp"
221 - mkdir "$(INSTALL_DIR)/etc/icons"
222 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
223 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
224 - $(CP_DIR) icons $(INSTALL_DIR)/etc
225 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
226 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
227 - $(CP) ../COPYING $(INSTALL_DIR)/bin
228 - $(DEL) ../same-dir.tst
229 - $(DEL) $(INSTALL_DIR)/same-dir.tst
231 install-other-dirs-nmake:
233 $(MAKE) $(MFLAGS) install
235 $(MAKE) $(MFLAGS) install
237 $(MAKE) $(MFLAGS) install
239 $(MAKE) $(MFLAGS) install
242 install-other-dirs-gmake:
243 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
244 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
245 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
246 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
249 "$(INSTALL_DIR)/bin/addpm" -q
252 mkdir $(TMP_DIST_DIR)
253 $(CP) "$(INSTALL_DIR)/BUGS" $(TMP_DIST_DIR)
254 $(CP) "$(INSTALL_DIR)/COPYING" $(TMP_DIST_DIR)
255 $(CP) "$(INSTALL_DIR)/README" $(TMP_DIST_DIR)
256 $(CP) "$(INSTALL_DIR)/README.W32" $(TMP_DIST_DIR)
257 $(CP) "$(INSTALL_DIR)/INSTALL" $(TMP_DIST_DIR)
258 $(CP_DIR) "$(INSTALL_DIR)/bin" $(TMP_DIST_DIR)
259 $(CP_DIR) "$(INSTALL_DIR)/etc" $(TMP_DIST_DIR)
260 $(CP_DIR) "$(INSTALL_DIR)/info" $(TMP_DIST_DIR)
261 $(CP_DIR) "$(INSTALL_DIR)/lisp" $(TMP_DIST_DIR)
262 $(CP_DIR) "$(INSTALL_DIR)/leim" $(TMP_DIST_DIR)
263 $(CP_DIR) "$(INSTALL_DIR)/site-lisp" $(TMP_DIST_DIR)
264 $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin
265 $(COMSPEC)$(ComSpec) /c $(ARGQUOTE)zipdist.bat $(VERSION)$(ARGQUOTE)
266 $(DEL_TREE) $(TMP_DIST_DIR)
269 # Note that doc/emacs/makefile knows how to
270 # put the info files in $(infodir),
271 # so we can do ok running make in the build dir.
272 info: force-info info-$(MAKETYPE)
276 $(MAKE) $(MFLAGS) info
278 $(MAKE) $(MFLAGS) info
280 $(MAKE) $(MFLAGS) info
282 $(MAKE) $(MFLAGS) info
286 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs info
287 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc info
288 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref info
289 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro info
293 clean: clean-other-dirs-$(MAKETYPE)
294 - $(DEL) $(COMPILER_TEMP_FILES)
295 - $(DEL_TREE) $(OBJDIR)
297 - $(DEL) ../etc/DOC ../etc/DOC-X
299 clean-other-dirs-nmake:
301 $(MAKE) $(MFLAGS) clean
303 $(MAKE) $(MFLAGS) clean
305 $(MAKE) $(MFLAGS) clean
307 $(MAKE) $(MFLAGS) clean
309 $(MAKE) $(MFLAGS) clean
311 $(MAKE) $(MFLAGS) clean
313 $(MAKE) $(MFLAGS) clean
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 ../leim clean
320 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
321 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
322 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
323 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
325 cleanall-other-dirs-nmake:
327 $(MAKE) $(MFLAGS) cleanall
329 $(MAKE) $(MFLAGS) cleanall
332 cleanall-other-dirs-gmake:
333 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
334 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
336 # We used to delete *~ here, but that might inadvertently remove
337 # precious files if it happens to match their short 8+3 aliases.
338 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
340 - $(DEL_TREE) obj-spd
345 - $(DEL) $(COMPILER_TEMP_FILES)
347 - $(DEL_TREE) obj-spd
351 - $(DEL) ../etc/DOC ../etc/DOC-X
352 - $(DEL) config.log Makefile
353 - $(DEL) ../README.W32
355 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
357 distclean-other-dirs-nmake:
359 $(MAKE) $(MFLAGS) distclean
361 $(MAKE) $(MFLAGS) distclean
363 $(MAKE) $(MFLAGS) distclean
365 $(MAKE) $(MFLAGS) distclean
367 $(MAKE) $(MFLAGS) distclean
369 $(MAKE) $(MFLAGS) distclean
371 $(MAKE) $(MFLAGS) distclean
373 $(MAKE) $(MFLAGS) distclean
376 distclean-other-dirs-gmake:
377 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
378 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
379 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
380 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
381 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
382 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
383 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
384 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
386 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
388 maintainer-clean-other-dirs-nmake:
390 $(MAKE) $(MFLAGS) maintainer-clean
392 $(MAKE) $(MFLAGS) maintainer-clean
394 $(MAKE) $(MFLAGS) maintainer-clean
396 $(MAKE) $(MFLAGS) maintainer-clean
398 $(MAKE) $(MFLAGS) maintainer-clean
400 $(MAKE) $(MFLAGS) maintainer-clean
402 $(MAKE) $(MFLAGS) maintainer-clean
404 $(MAKE) $(MFLAGS) maintainer-clean
407 maintainer-clean-other-dirs-gmake:
408 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
409 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
410 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
411 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
412 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
413 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
414 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
415 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean
420 TAGS: TAGS-$(MAKETYPE)
424 ../lib-src/$(BLD)/etags $(CURDIR)/*.c
425 $(MAKE) $(MFLAGS) -C ../src TAGS TAGS-LISP
426 $(MAKE) $(MFLAGS) -C ../lib-src TAGS
429 echo This target is not supported with NMake