1 # -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
2 # Copyright (C) 2000-2013 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 $(ALL) $(CLIENTRES) all-other-dirs-$(MAKETYPE)
94 all-other-dirs-$(MAKETYPE): maybe-bootstrap
96 all-other-dirs-nmake: addsection
100 $(MAKE) $(MFLAGS) all
102 $(MAKE) $(MFLAGS) all
104 $(MAKE) $(MFLAGS) all
106 $(MAKE) $(MFLAGS) all
109 all-other-dirs-gmake: addsection
110 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all
111 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
112 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
113 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
114 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
116 recompile: recompile-$(MAKETYPE)
120 $(MAKE) $(MFLAGS) recompile
124 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
128 ### This is meant for Emacs maintainers only. It first cleans the
129 ### lisp subdirectory, removing all compiled Lisp files. Then a
130 ### special emacs executable is built from Lisp sources, which is then
131 ### used to compile Lisp files. The last step is a "normal" make.
133 maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
135 # dummy target to force other targets to be evaluated.
138 maybe-bootstrap-CMD: doit
140 @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing. You should either
141 @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow
143 @if not EXIST ..\lisp\abbrev.elc exit -1
145 maybe-bootstrap-SH: doit
146 @if [ ! -f ../lisp/abbrev.elc ] ; then \
148 echo "Essential Lisp files seem to be missing. You should either"; \
149 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \
154 # Bootstrap depends on cmdproxy because some Lisp functions
155 # loaded during bootstrap may need to run shell commands.
156 bootstrap: addsection cmdproxy bootstrap-$(MAKETYPE)
157 $(MAKE) $(MFLAGS) $(XMFLAGS) all
159 bootstrap-nmake: addsection cmdproxy
161 $(MAKE) $(MFLAGS) bootstrap-clean
163 $(MAKE) $(MFLAGS) clean
165 $(MAKE) $(MFLAGS) clean make-docfile
167 $(MAKE) $(MFLAGS) clean all
169 $(MAKE) $(MFLAGS) bootstrap
170 $(MAKE) $(MFLAGS) bootstrap-clean
172 $(CP) $(BLD)/cmdproxy.exe ../bin
174 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
176 $(MAKE) $(MFLAGS) DOC
179 bootstrap-gmake: addsection cmdproxy
180 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
181 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
182 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
183 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src make-docfile
184 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
185 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all
186 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
187 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
188 $(CP) $(BLD)/cmdproxy.exe ../bin
189 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
190 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
192 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
194 bootstrap-clean-nmake:
196 $(MAKE) $(MFLAGS) bootstrap-clean
198 $(MAKE) $(MFLAGS) clean
200 $(MAKE) $(MFLAGS) bootstrap-clean
202 bootstrap-clean-gmake:
203 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
204 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
205 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
208 - mkdir "$(INSTALL_DIR)"
210 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
211 - mkdir "$(INSTALL_DIR)/bin"
214 # Build and install emacs in INSTALL_DIR
216 .PHONY: install-bin install-shortcuts
218 install: install-bin install-shortcuts
220 install-bin: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
221 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
222 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
223 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
224 - $(CP) README.W32 $(INSTALL_DIR)
225 - $(DEL) ../$(DIRNAME)_same-dir.tst
226 - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
227 echo SameDirTest > "$(INSTALL_DIR)/$(DIRNAME)_same-dir.tst"
228 - mkdir "$(INSTALL_DIR)/etc"
229 - mkdir "$(INSTALL_DIR)/info"
230 - mkdir "$(INSTALL_DIR)/lock"
231 - mkdir "$(INSTALL_DIR)/data"
232 - mkdir "$(INSTALL_DIR)/site-lisp"
233 - mkdir "$(INSTALL_DIR)/etc/icons"
234 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
235 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
236 - $(CP_DIR) icons $(INSTALL_DIR)/etc
237 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
238 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
239 - $(CP) ../COPYING $(INSTALL_DIR)/bin
240 - $(DEL) ../$(DIRNAME)_same-dir.tst
241 - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
243 install-other-dirs-nmake: all
245 $(MAKE) $(MFLAGS) install
247 $(MAKE) $(MFLAGS) install
249 $(MAKE) $(MFLAGS) install
251 $(MAKE) $(MFLAGS) install
254 install-other-dirs-gmake: all
255 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
256 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
257 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
258 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
260 install-addpm: $(INSTALL_DIR)/bin addpm
261 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
263 install-shortcuts: install-addpm
264 "$(INSTALL_DIR)/bin/addpm" -q
266 maybe-copy-distfiles: maybe-copy-distfiles-$(SHELLTYPE)
268 maybe-copy-distfiles-CMD: create-tmp-dist-dir doit
269 @if not $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin
271 maybe-copy-distfiles-SH: create-tmp-dist-dir doit
272 @if [ ! $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" ] ; then \
273 $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin ; \
277 mkdir "$(TMP_DIST_DIR)"
278 # Also create bin directory for dist files.
279 mkdir "$(TMP_DIST_DIR)/bin"
281 dist: install-bin install-addpm maybe-copy-distfiles
282 $(CP) "$(INSTALL_DIR)/BUGS" $(TMP_DIST_DIR)
283 $(CP) "$(INSTALL_DIR)/COPYING" $(TMP_DIST_DIR)
284 $(CP) "$(INSTALL_DIR)/README" $(TMP_DIST_DIR)
285 $(CP) "$(INSTALL_DIR)/README.W32" $(TMP_DIST_DIR)
286 $(CP_DIR) "$(INSTALL_DIR)/bin" $(TMP_DIST_DIR)
287 $(CP_DIR) "$(INSTALL_DIR)/etc" $(TMP_DIST_DIR)
288 $(CP_DIR) "$(INSTALL_DIR)/info" $(TMP_DIST_DIR)
289 $(CP_DIR) "$(INSTALL_DIR)/lisp" $(TMP_DIST_DIR)
290 $(CP_DIR) "$(INSTALL_DIR)/leim" $(TMP_DIST_DIR)
291 $(CP_DIR) "$(INSTALL_DIR)/site-lisp" $(TMP_DIST_DIR)
292 $(COMSPEC)$(ComSpec) /c $(ARGQUOTE)zipdist.bat $(VERSION)$(ARGQUOTE)
293 $(DEL_TREE) $(TMP_DIST_DIR)
296 # Note that doc/emacs/makefile knows how to
297 # put the info files in $(infodir),
298 # so we can do ok running make in the build dir.
299 info: force-info info-$(MAKETYPE)
303 $(MAKE) $(MFLAGS) info
305 $(MAKE) $(MFLAGS) info
307 $(MAKE) $(MFLAGS) info
309 $(MAKE) $(MFLAGS) info
312 info-gmake: emacs misc lispref lispintro
314 emacs misc lispref lispintro:
315 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/$@ info
320 clean: clean-other-dirs-$(MAKETYPE)
321 - $(DEL) $(COMPILER_TEMP_FILES)
322 - $(DEL_TREE) $(OBJDIR)
324 - $(DEL) ../etc/DOC ../etc/DOC-X
326 clean-other-dirs-nmake:
328 $(MAKE) $(MFLAGS) clean
330 $(MAKE) $(MFLAGS) clean
332 $(MAKE) $(MFLAGS) clean
334 $(MAKE) $(MFLAGS) clean
336 $(MAKE) $(MFLAGS) clean
338 $(MAKE) $(MFLAGS) clean
340 $(MAKE) $(MFLAGS) clean
342 $(MAKE) $(MFLAGS) clean
345 clean-other-dirs-gmake:
346 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
347 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
348 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
349 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
350 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
351 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
352 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
353 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
355 cleanall-other-dirs-nmake:
357 $(MAKE) $(MFLAGS) cleanall
359 $(MAKE) $(MFLAGS) cleanall
361 $(MAKE) $(MFLAGS) cleanall
364 cleanall-other-dirs-gmake:
365 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib cleanall
366 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
367 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
369 # We used to delete *~ here, but that might inadvertently remove
370 # precious files if it happens to match their short 8+3 aliases.
371 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
373 - $(DEL_TREE) obj-spd
378 - $(DEL) $(COMPILER_TEMP_FILES)
380 - $(DEL_TREE) obj-spd
384 - $(DEL) ../etc/DOC ../etc/DOC-X
385 - $(DEL) config.log Makefile
386 - $(DEL) ../README.W32
388 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
390 distclean-other-dirs-nmake:
392 $(MAKE) $(MFLAGS) distclean
394 $(MAKE) $(MFLAGS) distclean
396 $(MAKE) $(MFLAGS) distclean
398 $(MAKE) $(MFLAGS) distclean
400 $(MAKE) $(MFLAGS) distclean
402 $(MAKE) $(MFLAGS) distclean
404 $(MAKE) $(MFLAGS) distclean
406 $(MAKE) $(MFLAGS) distclean
408 $(MAKE) $(MFLAGS) distclean
411 distclean-other-dirs-gmake:
412 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean
413 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
414 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
415 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
416 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
417 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
418 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
419 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
420 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
422 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
424 maintainer-clean-other-dirs-nmake:
426 $(MAKE) $(MFLAGS) maintainer-clean
428 $(MAKE) $(MFLAGS) maintainer-clean
430 $(MAKE) $(MFLAGS) maintainer-clean
432 $(MAKE) $(MFLAGS) maintainer-clean
434 $(MAKE) $(MFLAGS) maintainer-clean
436 $(MAKE) $(MFLAGS) maintainer-clean
438 $(MAKE) $(MFLAGS) maintainer-clean
440 $(MAKE) $(MFLAGS) maintainer-clean
442 $(MAKE) $(MFLAGS) maintainer-clean
445 maintainer-clean-other-dirs-gmake:
446 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean
447 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
448 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
449 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
450 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
451 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
452 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
453 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
454 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean
459 TAGS: TAGS-$(MAKETYPE)
463 ../lib-src/$(BLD)/etags $(CURDIR)/*.c
464 $(MAKE) $(MFLAGS) -C ../src TAGS TAGS-LISP
465 $(MAKE) $(MFLAGS) -C ../lib-src TAGS
466 $(MAKE) $(MFLAGS) -C ../lib TAGS
469 echo This target is not supported with NMake