1 # -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
2 # Copyright (C) 2000-2015 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
32 LOCAL_FLAGS = -DOLD_PATHS=1
36 ALL = $(BLD)/addpm.exe $(BLD)/ddeclient.exe $(BLD)/runemacs.exe \
37 $(BLD)/cmdproxy.exe $(BLD)/addsection.exe $(BLD)/preprep.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 $(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
45 $(LINK) $(LINK_OUT)$@ \
46 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
48 $(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
49 $(LINK) $(LINK_OUT)$@ \
50 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
52 $(BLD)/addsection.exe: $(BLD)/addsection.$(O)
53 $(LINK) $(LINK_OUT)$@ \
54 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
56 $(BLD)/preprep.exe: $(BLD)/preprep.$(O)
57 $(LINK) $(LINK_OUT)$@ \
58 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)
61 # The resource file. NT 3.10 requires the use of cvtres; even though
62 # it is not necessary on later versions, it is still ok to use it.
64 $(TRES): emacs.rc icons/emacs.ico $(EMACS_MANIFEST) stamp_BLD
65 $(RC) $(RC_OUT)$(TRES) emacs.rc
67 $(CLIENTRES): emacsclient.rc stamp_BLD
68 $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
70 $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
71 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
72 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
75 @echo Using $(THE_SHELL) as shell.
77 # These depend on stamp_BLD to make sure the $(BLD) directory is created
78 # before the compilation begins, even if Make runs several commands
79 # in parallel under "make -j".
81 $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
86 all: which-sh $(ALL) $(CLIENTRES) all-other-dirs-$(MAKETYPE)
88 all-other-dirs-$(MAKETYPE): maybe-bootstrap
90 all-other-dirs-nmake: $(BLD)/addsection.exe
100 $(MAKE) $(MFLAGS) all
103 all-other-dirs-gmake: $(BLD)/addsection.exe
104 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all
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: $(BLD)/addsection.exe $(BLD)/cmdproxy.exe bootstrap-$(MAKETYPE)
151 $(MAKE) $(MFLAGS) $(XMFLAGS) all
153 bootstrap-nmake: $(BLD)/addsection.exe $(BLD)/cmdproxy.exe
155 $(MAKE) $(MFLAGS) bootstrap-clean
157 $(MAKE) $(MFLAGS) clean
159 $(MAKE) $(MFLAGS) clean make-docfile
161 $(MAKE) $(MFLAGS) clean all
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: $(BLD)/addsection.exe $(BLD)/cmdproxy.exe
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 ../lib-src make-docfile
178 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
179 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all
180 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
181 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
182 $(CP) $(BLD)/cmdproxy.exe ../bin
183 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
184 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
186 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
188 bootstrap-clean-nmake:
190 $(MAKE) $(MFLAGS) bootstrap-clean
192 $(MAKE) $(MFLAGS) clean
194 $(MAKE) $(MFLAGS) bootstrap-clean
196 bootstrap-clean-gmake:
197 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
198 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
199 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
202 - mkdir "$(INSTALL_DIR)"
204 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
205 - mkdir "$(INSTALL_DIR)/bin"
208 # Build and install emacs in INSTALL_DIR
210 .PHONY: install-bin install-shortcuts
212 install: install-bin install-shortcuts
214 install-bin: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
215 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
216 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
217 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
218 - $(CP) README.W32 $(INSTALL_DIR)
219 - $(DEL) ../$(DIRNAME)_same-dir.tst
220 - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
221 echo SameDirTest > "$(INSTALL_DIR)/$(DIRNAME)_same-dir.tst"
222 - mkdir "$(INSTALL_DIR)/etc"
223 - mkdir "$(INSTALL_DIR)/info"
224 - mkdir "$(INSTALL_DIR)/lock"
225 - mkdir "$(INSTALL_DIR)/data"
226 - mkdir "$(INSTALL_DIR)/site-lisp"
227 - mkdir "$(INSTALL_DIR)/etc/icons"
228 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
229 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
230 - $(CP_DIR) icons $(INSTALL_DIR)/etc
231 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
232 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
233 - $(CP) ../COPYING $(INSTALL_DIR)/bin
234 - $(DEL) ../$(DIRNAME)_same-dir.tst
235 - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
237 install-other-dirs-nmake: all
239 $(MAKE) $(MFLAGS) install
241 $(MAKE) $(MFLAGS) install
243 $(MAKE) $(MFLAGS) install
245 $(MAKE) $(MFLAGS) install
248 install-other-dirs-gmake: all
249 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
250 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
251 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
252 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
254 install-addpm: $(INSTALL_DIR)/bin $(BLD)/addpm.exe
255 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
257 install-shortcuts: install-addpm
258 "$(INSTALL_DIR)/bin/addpm" -q
260 maybe-copy-distfiles: maybe-copy-distfiles-$(SHELLTYPE)
262 maybe-copy-distfiles-CMD: create-tmp-dist-dir doit
263 @if not $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin
265 maybe-copy-distfiles-SH: create-tmp-dist-dir doit
266 @if [ ! $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" ] ; then \
267 $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin ; \
271 mkdir "$(TMP_DIST_DIR)"
272 # Also create bin directory for dist files.
273 mkdir "$(TMP_DIST_DIR)/bin"
275 dist: install-bin install-addpm maybe-copy-distfiles
276 $(CP) "$(INSTALL_DIR)/BUGS" $(TMP_DIST_DIR)
277 $(CP) "$(INSTALL_DIR)/COPYING" $(TMP_DIST_DIR)
278 $(CP) "$(INSTALL_DIR)/README" $(TMP_DIST_DIR)
279 $(CP) "$(INSTALL_DIR)/README.W32" $(TMP_DIST_DIR)
280 $(CP_DIR) "$(INSTALL_DIR)/bin" $(TMP_DIST_DIR)
281 $(CP_DIR) "$(INSTALL_DIR)/etc" $(TMP_DIST_DIR)
282 $(CP_DIR) "$(INSTALL_DIR)/info" $(TMP_DIST_DIR)
283 $(CP_DIR) "$(INSTALL_DIR)/lisp" $(TMP_DIST_DIR)
284 $(CP_DIR) "$(INSTALL_DIR)/leim" $(TMP_DIST_DIR)
285 $(CP_DIR) "$(INSTALL_DIR)/site-lisp" $(TMP_DIST_DIR)
286 $(COMSPEC)$(ComSpec) /c $(ARGQUOTE)zipdist.bat $(VERSION)$(ARGQUOTE)
287 $(DEL_TREE) $(TMP_DIST_DIR)
290 # Note that doc/emacs/makefile knows how to
291 # put the info files in $(infodir),
292 # so we can do ok running make in the build dir.
293 info: force-info info-$(MAKETYPE)
297 $(MAKE) $(MFLAGS) info
299 $(MAKE) $(MFLAGS) info
301 $(MAKE) $(MFLAGS) info
303 $(MAKE) $(MFLAGS) info
306 info-gmake: emacs misc lispref lispintro
308 emacs misc lispref lispintro:
309 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/$@ info
314 clean: clean-other-dirs-$(MAKETYPE)
315 - $(DEL) $(COMPILER_TEMP_FILES)
316 - $(DEL_TREE) $(OBJDIR)
320 clean-other-dirs-nmake:
322 $(MAKE) $(MFLAGS) clean
324 $(MAKE) $(MFLAGS) clean
326 $(MAKE) $(MFLAGS) clean
328 $(MAKE) $(MFLAGS) clean
330 $(MAKE) $(MFLAGS) clean
332 $(MAKE) $(MFLAGS) clean
334 $(MAKE) $(MFLAGS) clean
336 $(MAKE) $(MFLAGS) clean
339 clean-other-dirs-gmake:
340 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
341 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
342 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
343 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
344 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
345 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
346 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
347 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
349 cleanall-other-dirs-nmake:
351 $(MAKE) $(MFLAGS) cleanall
353 $(MAKE) $(MFLAGS) cleanall
355 $(MAKE) $(MFLAGS) cleanall
358 cleanall-other-dirs-gmake:
359 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib cleanall
360 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
361 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
363 # We used to delete *~ here, but that might inadvertently remove
364 # precious files if it happens to match their short 8+3 aliases.
365 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
367 - $(DEL_TREE) obj-spd
372 - $(DEL) $(COMPILER_TEMP_FILES)
374 - $(DEL_TREE) obj-spd
379 - $(DEL) config.log Makefile
380 - $(DEL) ../README.W32
382 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
384 distclean-other-dirs-nmake:
386 $(MAKE) $(MFLAGS) distclean
388 $(MAKE) $(MFLAGS) distclean
390 $(MAKE) $(MFLAGS) distclean
392 $(MAKE) $(MFLAGS) distclean
394 $(MAKE) $(MFLAGS) distclean
396 $(MAKE) $(MFLAGS) distclean
398 $(MAKE) $(MFLAGS) distclean
400 $(MAKE) $(MFLAGS) distclean
402 $(MAKE) $(MFLAGS) distclean
405 distclean-other-dirs-gmake:
406 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean
407 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
408 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
409 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
410 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
411 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
412 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
413 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
414 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
416 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
418 maintainer-clean-other-dirs-nmake:
420 $(MAKE) $(MFLAGS) maintainer-clean
422 $(MAKE) $(MFLAGS) maintainer-clean
424 $(MAKE) $(MFLAGS) maintainer-clean
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
439 maintainer-clean-other-dirs-gmake:
440 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean
441 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
442 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
443 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
444 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
445 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
446 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
447 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
448 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean
453 TAGS: TAGS-$(MAKETYPE)
457 ../lib-src/$(BLD)/etags $(CURDIR)/*.c
458 $(MAKE) $(MFLAGS) -C ../src TAGS TAGS-LISP
459 $(MAKE) $(MFLAGS) -C ../lib-src TAGS
460 $(MAKE) $(MFLAGS) -C ../lib TAGS
463 echo This target is not supported with NMake