1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
\r
2 # Copyright (C) 2000-2012 Free Software Foundation, Inc.
\r
4 # Top level makefile for building GNU Emacs on Windows NT
\r
6 # This file is part of GNU Emacs.
\r
8 # GNU Emacs is free software: you can redistribute it and/or modify
\r
9 # it under the terms of the GNU General Public License as published by
\r
10 # the Free Software Foundation, either version 3 of the License, or
\r
11 # (at your option) any later version.
\r
13 # GNU Emacs is distributed in the hope that it will be useful,
\r
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
16 # GNU General Public License for more details.
\r
18 # You should have received a copy of the GNU General Public License
\r
19 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
\r
22 # FIXME: This file uses DOS EOLs. Convert to Unix after 22.1 is out
\r
23 # (and remove or replace this comment).
\r
27 TMP_DIST_DIR = emacs-$(VERSION)
\r
29 TRES = $(BLD)/emacs.res
\r
30 CLIENTRES = $(BLD)/emacsclient.res
\r
34 ALL = addpm ddeclient runemacs cmdproxy addsection preprep
\r
39 addpm: stamp_BLD $(BLD)/addpm.exe
\r
40 $(BLD)/addpm.exe: $(BLD)/addpm.$(O)
\r
41 $(LINK) $(LINK_OUT)$@ \
\r
42 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) \
\r
43 $(USER32) $(OLE32) $(UUID) $(SHELL32)
\r
45 ddeclient: stamp_BLD $(BLD)/ddeclient.exe
\r
46 $(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
\r
47 $(LINK) $(LINK_OUT)$@ \
\r
48 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
\r
50 cmdproxy: stamp_BLD $(BLD)/cmdproxy.exe
\r
51 $(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
\r
52 $(LINK) $(LINK_OUT)$@ \
\r
53 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
\r
55 addsection: stamp_BLD $(BLD)/addsection.exe
\r
56 $(BLD)/addsection.exe: $(BLD)/addsection.$(O)
\r
57 $(LINK) $(LINK_OUT)$@ \
\r
58 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
\r
60 preprep: stamp_BLD $(BLD)/preprep.exe
\r
61 $(BLD)/preprep.exe: $(BLD)/preprep.$(O)
\r
62 $(LINK) $(LINK_OUT)$@ \
\r
63 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)
\r
66 # The resource file. NT 3.10 requires the use of cvtres; even though
\r
67 # it is not necessary on later versions, it is still ok to use it.
\r
69 $(TRES): emacs.rc icons/emacs.ico emacs.manifest stamp_BLD
\r
70 $(RC) $(RC_OUT)$(TRES) emacs.rc
\r
72 $(CLIENTRES): emacsclient.rc stamp_BLD
\r
73 $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
\r
75 runemacs: stamp_BLD $(BLD)/runemacs.exe
\r
76 $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
\r
77 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
\r
78 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
\r
81 @echo Using $(THE_SHELL) as shell.
\r
83 # These depend on stamp_BLD to make sure the $(BLD) directory is created
\r
84 # before the compilation begins, even if Make runs several commands
\r
85 # in parallel under "make -j".
\r
87 $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
\r
92 all: which-sh stamp_BLD $(ALL) $(CLIENTRES) maybe-bootstrap all-other-dirs-$(MAKETYPE)
\r
94 all-other-dirs-nmake: addsection
\r
96 $(MAKE) $(MFLAGS) all
\r
98 $(MAKE) $(MFLAGS) all
\r
100 $(MAKE) $(MFLAGS) all
\r
102 $(MAKE) $(MFLAGS) all
\r
104 $(MAKE) $(MFLAGS) all
\r
107 all-other-dirs-gmake: addsection
\r
108 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all
\r
109 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
\r
110 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
\r
111 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
\r
112 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
\r
114 recompile: recompile-$(MAKETYPE)
\r
118 $(MAKE) $(MFLAGS) recompile
\r
122 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
\r
124 #### Bootstrapping.
\r
126 ### This is meant for Emacs maintainers only. It first cleans the
\r
127 ### lisp subdirectory, removing all compiled Lisp files. Then a
\r
128 ### special emacs executable is built from Lisp sources, which is then
\r
129 ### used to compile Lisp files. The last step is a "normal" make.
\r
131 maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
\r
133 # dummy target to force other targets to be evaluated.
\r
136 maybe-bootstrap-CMD: doit
\r
138 @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing. You should either
\r
139 @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow
\r
141 @if not EXIST ..\lisp\abbrev.elc exit -1
\r
143 maybe-bootstrap-SH: doit
\r
144 @if [ ! -f ../lisp/abbrev.elc ] ; then \
\r
146 echo "Essential Lisp files seem to be missing. You should either"; \
\r
147 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \
\r
152 # Bootstrap depends on cmdproxy because some Lisp functions
\r
153 # loaded during bootstrap may need to run shell commands.
\r
154 bootstrap: addsection cmdproxy bootstrap-$(MAKETYPE)
\r
155 $(MAKE) $(MFLAGS) $(XMFLAGS) all
\r
157 bootstrap-nmake: addsection cmdproxy
\r
159 $(MAKE) $(MFLAGS) bootstrap-clean
\r
161 $(MAKE) $(MFLAGS) clean
\r
163 $(MAKE) $(MFLAGS) clean make-docfile
\r
165 $(MAKE) $(MFLAGS) clean all
\r
167 $(MAKE) $(MFLAGS) bootstrap
\r
168 $(MAKE) $(MFLAGS) bootstrap-clean
\r
170 $(CP) $(BLD)/cmdproxy.exe ../bin
\r
172 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
\r
174 $(MAKE) $(MFLAGS) DOC
\r
177 bootstrap-gmake: addsection cmdproxy
\r
178 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
\r
179 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
\r
180 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean make-docfile
\r
181 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean all
\r
182 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
\r
183 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
\r
184 $(CP) $(BLD)/cmdproxy.exe ../bin
\r
185 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
\r
186 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
\r
188 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
\r
190 bootstrap-clean-nmake:
\r
192 $(MAKE) $(MFLAGS) bootstrap-clean
\r
194 $(MAKE) $(MFLAGS) clean
\r
196 $(MAKE) $(MFLAGS) bootstrap-clean
\r
198 bootstrap-clean-gmake:
\r
199 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
\r
200 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
\r
201 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
\r
204 - mkdir "$(INSTALL_DIR)"
\r
206 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
\r
207 - mkdir "$(INSTALL_DIR)/bin"
\r
210 # Build and install emacs in INSTALL_DIR
\r
212 .PHONY: install-bin install-shortcuts
\r
214 install: install-bin install-shortcuts
\r
216 install-bin: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
\r
217 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
\r
218 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
\r
219 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
\r
220 - $(CP) README.W32 $(INSTALL_DIR)
\r
221 - $(DEL) ../$(DIRNAME)_same-dir.tst
\r
222 - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
\r
223 echo SameDirTest > "$(INSTALL_DIR)/$(DIRNAME)_same-dir.tst"
\r
224 - mkdir "$(INSTALL_DIR)/etc"
\r
225 - mkdir "$(INSTALL_DIR)/info"
\r
226 - mkdir "$(INSTALL_DIR)/lock"
\r
227 - mkdir "$(INSTALL_DIR)/data"
\r
228 - mkdir "$(INSTALL_DIR)/site-lisp"
\r
229 - mkdir "$(INSTALL_DIR)/etc/icons"
\r
230 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
\r
231 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
\r
232 - $(CP_DIR) icons $(INSTALL_DIR)/etc
\r
233 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
\r
234 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
\r
235 - $(CP) ../COPYING $(INSTALL_DIR)/bin
\r
236 - $(DEL) ../$(DIRNAME)_same-dir.tst
\r
237 - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
\r
239 install-other-dirs-nmake: all
\r
241 $(MAKE) $(MFLAGS) install
\r
243 $(MAKE) $(MFLAGS) install
\r
245 $(MAKE) $(MFLAGS) install
\r
247 $(MAKE) $(MFLAGS) install
\r
250 install-other-dirs-gmake: all
\r
251 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
\r
252 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
\r
253 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
\r
254 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
\r
256 install-shortcuts: $(INSTALL_DIR)/bin
\r
257 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
\r
258 "$(INSTALL_DIR)/bin/addpm" -q
\r
260 maybe-copy-distfiles: maybe-copy-distfiles-$(SHELLTYPE)
\r
262 maybe-copy-distfiles-CMD: create-tmp-dist-dir doit
\r
263 @if not $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin
\r
265 maybe-copy-distfiles-SH: create-tmp-dist-dir doit
\r
266 @if [ ! $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" ] ; then \
\r
267 $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin ; \
\r
270 create-tmp-dist-dir:
\r
271 mkdir "$(TMP_DIST_DIR)"
\r
272 # Also create bin directory for dist files.
\r
273 mkdir "$(TMP_DIST_DIR)/bin"
\r
275 dist: install-bin maybe-copy-distfiles
\r
276 $(CP) "$(INSTALL_DIR)/BUGS" $(TMP_DIST_DIR)
\r
277 $(CP) "$(INSTALL_DIR)/COPYING" $(TMP_DIST_DIR)
\r
278 $(CP) "$(INSTALL_DIR)/README" $(TMP_DIST_DIR)
\r
279 $(CP) "$(INSTALL_DIR)/README.W32" $(TMP_DIST_DIR)
\r
280 $(CP_DIR) "$(INSTALL_DIR)/bin" $(TMP_DIST_DIR)
\r
281 $(CP_DIR) "$(INSTALL_DIR)/etc" $(TMP_DIST_DIR)
\r
282 $(CP_DIR) "$(INSTALL_DIR)/info" $(TMP_DIST_DIR)
\r
283 $(CP_DIR) "$(INSTALL_DIR)/lisp" $(TMP_DIST_DIR)
\r
284 $(CP_DIR) "$(INSTALL_DIR)/leim" $(TMP_DIST_DIR)
\r
285 $(CP_DIR) "$(INSTALL_DIR)/site-lisp" $(TMP_DIST_DIR)
\r
286 $(COMSPEC)$(ComSpec) /c $(ARGQUOTE)zipdist.bat $(VERSION)$(ARGQUOTE)
\r
287 $(DEL_TREE) $(TMP_DIST_DIR)
\r
290 # Note that doc/emacs/makefile knows how to
\r
291 # put the info files in $(infodir),
\r
292 # so we can do ok running make in the build dir.
\r
293 info: force-info info-$(MAKETYPE)
\r
297 $(MAKE) $(MFLAGS) info
\r
299 $(MAKE) $(MFLAGS) info
\r
301 $(MAKE) $(MFLAGS) info
\r
303 $(MAKE) $(MFLAGS) info
\r
307 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs info
\r
308 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc info
\r
309 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref info
\r
310 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro info
\r
314 clean: clean-other-dirs-$(MAKETYPE)
\r
315 - $(DEL) $(COMPILER_TEMP_FILES)
\r
316 - $(DEL_TREE) $(OBJDIR)
\r
318 - $(DEL) ../etc/DOC ../etc/DOC-X
\r
320 clean-other-dirs-nmake:
\r
322 $(MAKE) $(MFLAGS) clean
\r
324 $(MAKE) $(MFLAGS) clean
\r
326 $(MAKE) $(MFLAGS) clean
\r
327 cd ..\doc\lispintro
\r
328 $(MAKE) $(MFLAGS) clean
\r
330 $(MAKE) $(MFLAGS) clean
\r
332 $(MAKE) $(MFLAGS) clean
\r
334 $(MAKE) $(MFLAGS) clean
\r
336 $(MAKE) $(MFLAGS) clean
\r
339 clean-other-dirs-gmake:
\r
340 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
\r
341 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
\r
342 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
\r
343 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
\r
344 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
\r
345 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
\r
346 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
\r
347 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
\r
349 cleanall-other-dirs-nmake:
\r
351 $(MAKE) $(MFLAGS) cleanall
\r
353 $(MAKE) $(MFLAGS) cleanall
\r
355 $(MAKE) $(MFLAGS) cleanall
\r
358 cleanall-other-dirs-gmake:
\r
359 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib cleanall
\r
360 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
\r
361 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
\r
363 # We used to delete *~ here, but that might inadvertently remove
\r
364 # precious files if it happens to match their short 8+3 aliases.
\r
365 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
\r
367 - $(DEL_TREE) obj-spd
\r
369 - $(DEL_TREE) oo-spd
\r
372 - $(DEL) $(COMPILER_TEMP_FILES)
\r
374 - $(DEL_TREE) obj-spd
\r
376 - $(DEL_TREE) oo-spd
\r
378 - $(DEL) ../etc/DOC ../etc/DOC-X
\r
379 - $(DEL) config.log Makefile
\r
380 - $(DEL) ../README.W32
\r
382 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
\r
384 distclean-other-dirs-nmake:
\r
386 $(MAKE) $(MFLAGS) distclean
\r
388 $(MAKE) $(MFLAGS) distclean
\r
390 $(MAKE) $(MFLAGS) distclean
\r
392 $(MAKE) $(MFLAGS) distclean
\r
394 $(MAKE) $(MFLAGS) distclean
\r
396 $(MAKE) $(MFLAGS) distclean
\r
398 $(MAKE) $(MFLAGS) distclean
\r
400 $(MAKE) $(MFLAGS) distclean
\r
402 $(MAKE) $(MFLAGS) distclean
\r
405 distclean-other-dirs-gmake:
\r
406 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean
\r
407 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
\r
408 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
\r
409 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
\r
410 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
\r
411 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
\r
412 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
\r
413 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
\r
414 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
\r
416 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
\r
418 maintainer-clean-other-dirs-nmake:
\r
420 $(MAKE) $(MFLAGS) maintainer-clean
\r
422 $(MAKE) $(MFLAGS) maintainer-clean
\r
424 $(MAKE) $(MFLAGS) maintainer-clean
\r
426 $(MAKE) $(MFLAGS) maintainer-clean
\r
428 $(MAKE) $(MFLAGS) maintainer-clean
\r
430 $(MAKE) $(MFLAGS) maintainer-clean
\r
432 $(MAKE) $(MFLAGS) maintainer-clean
\r
434 $(MAKE) $(MFLAGS) maintainer-clean
\r
436 $(MAKE) $(MFLAGS) maintainer-clean
\r
439 maintainer-clean-other-dirs-gmake:
\r
440 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean
\r
441 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
\r
442 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
\r
443 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
\r
444 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
\r
445 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
\r
446 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
\r
447 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
\r
448 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean
\r
450 realclean: cleanall
\r
451 - $(DEL_TREE) ../bin
\r
453 TAGS: TAGS-$(MAKETYPE)
\r
457 ../lib-src/$(BLD)/etags $(CURDIR)/*.c
\r
458 $(MAKE) $(MFLAGS) -C ../src TAGS TAGS-LISP
\r
459 $(MAKE) $(MFLAGS) -C ../lib-src TAGS
\r
460 $(MAKE) $(MFLAGS) -C ../lib TAGS
\r
463 echo This target is not supported with NMake
\r