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).
26 TRES = $(BLD)/emacs.res
27 CLIENTRES = $(BLD)/emacsclient.res
31 ALL = addpm ddeclient runemacs cmdproxy addsection preprep
36 addpm: stamp_BLD $(BLD)/addpm.exe
37 $(BLD)/addpm.exe: $(BLD)/addpm.$(O)
38 $(LINK) $(LINK_OUT)$@ \
39 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) \
40 $(USER32) $(OLE32) $(UUID) $(SHELL32)
42 ddeclient: stamp_BLD $(BLD)/ddeclient.exe
43 $(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
44 $(LINK) $(LINK_OUT)$@ \
45 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
47 cmdproxy: stamp_BLD $(BLD)/cmdproxy.exe
48 $(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
49 $(LINK) $(LINK_OUT)$@ \
50 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
52 addsection: stamp_BLD $(BLD)/addsection.exe
53 $(BLD)/addsection.exe: $(BLD)/addsection.$(O)
54 $(LINK) $(LINK_OUT)$@ \
55 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
57 preprep: stamp_BLD $(BLD)/preprep.exe
58 $(BLD)/preprep.exe: $(BLD)/preprep.$(O)
59 $(LINK) $(LINK_OUT)$@ \
60 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)
63 # The resource file. NT 3.10 requires the use of cvtres; even though
64 # it is not necessary on later versions, it is still ok to use it.
66 $(TRES): emacs.rc icons/emacs.ico emacs.manifest stamp_BLD
67 $(RC) $(RC_OUT)$(TRES) emacs.rc
69 $(CLIENTRES): emacsclient.rc stamp_BLD
70 $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
72 runemacs: stamp_BLD $(BLD)/runemacs.exe
73 $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
74 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
75 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
78 @echo Using $(THE_SHELL) as shell.
80 # These depend on stamp_BLD to make sure the $(BLD) directory is created
81 # before the compilation begins, even if Make runs several commands
82 # in parallel under "make -j".
84 $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
89 all: which-sh stamp_BLD $(ALL) $(CLIENTRES) maybe-bootstrap all-other-dirs-$(MAKETYPE)
91 all-other-dirs-nmake: addsection
102 all-other-dirs-gmake: addsection
103 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
104 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
105 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
106 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
108 recompile: recompile-$(MAKETYPE)
112 $(MAKE) $(MFLAGS) recompile
116 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
120 ### This is meant for Emacs maintainers only. It first cleans the
121 ### lisp subdirectory, removing all compiled Lisp files. Then a
122 ### special emacs executable is built from Lisp sources, which is then
123 ### used to compile Lisp files. The last step is a "normal" make.
125 maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
127 # dummy target to force other targets to be evaluated.
130 maybe-bootstrap-CMD: doit
132 @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing. You should either
133 @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow
135 @if not EXIST ..\lisp\abbrev.elc exit -1
137 maybe-bootstrap-SH: doit
138 @if [ ! -f ../lisp/abbrev.elc ] ; then \
140 echo "Essential Lisp files seem to be missing. You should either"; \
141 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \
146 # Bootstrap depends on cmdproxy because some Lisp functions
147 # loaded during bootstrap may need to run shell commands.
148 bootstrap: addsection cmdproxy bootstrap-$(MAKETYPE)
149 $(MAKE) $(MFLAGS) $(XMFLAGS) all
151 bootstrap-nmake: addsection cmdproxy
153 $(MAKE) $(MFLAGS) bootstrap-clean
155 $(MAKE) $(MFLAGS) clean
157 $(MAKE) $(MFLAGS) clean
159 $(MAKE) $(MFLAGS) bootstrap
160 $(MAKE) $(MFLAGS) bootstrap-clean
162 $(CP) $(BLD)/cmdproxy.exe ../bin
164 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
166 $(MAKE) $(MFLAGS) DOC
169 bootstrap-gmake: addsection cmdproxy
170 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
171 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
172 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
173 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
174 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
175 $(CP) $(BLD)/cmdproxy.exe ../bin
176 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
177 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
179 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
181 bootstrap-clean-nmake:
183 $(MAKE) $(MFLAGS) bootstrap-clean
185 $(MAKE) $(MFLAGS) bootstrap-clean
187 bootstrap-clean-gmake:
188 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
189 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
192 - mkdir "$(INSTALL_DIR)"
194 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
195 - mkdir "$(INSTALL_DIR)/bin"
198 # Build and install emacs in INSTALL_DIR
200 install: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
201 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
202 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
203 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
204 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
205 - "$(INSTALL_DIR)/bin/addpm" -q
206 - $(DEL) ../same-dir.tst
207 - $(DEL) $(INSTALL_DIR)/same-dir.tst
208 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
209 - mkdir "$(INSTALL_DIR)/etc"
210 - mkdir "$(INSTALL_DIR)/info"
211 - mkdir "$(INSTALL_DIR)/lock"
212 - mkdir "$(INSTALL_DIR)/data"
213 - mkdir "$(INSTALL_DIR)/site-lisp"
214 - mkdir "$(INSTALL_DIR)/etc/icons"
215 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
216 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
217 - $(CP_DIR) icons $(INSTALL_DIR)/etc
218 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
219 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
220 - $(CP) ../COPYING $(INSTALL_DIR)/bin
221 - $(DEL) ../same-dir.tst
222 - $(DEL) $(INSTALL_DIR)/same-dir.tst
224 install-other-dirs-nmake:
226 $(MAKE) $(MFLAGS) install
228 $(MAKE) $(MFLAGS) install
230 $(MAKE) $(MFLAGS) install
232 $(MAKE) $(MFLAGS) install
235 install-other-dirs-gmake:
236 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
237 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
238 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
239 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
242 # Note that doc/emacs/makefile knows how to
243 # put the info files in $(infodir),
244 # so we can do ok running make in the build dir.
245 info: force-info info-$(MAKETYPE)
249 $(MAKE) $(MFLAGS) info
251 $(MAKE) $(MFLAGS) info
253 $(MAKE) $(MFLAGS) info
255 $(MAKE) $(MFLAGS) info
259 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs info
260 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc info
261 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref info
262 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro info
266 clean: clean-other-dirs-$(MAKETYPE)
267 - $(DEL) $(COMPILER_TEMP_FILES)
268 - $(DEL_TREE) $(OBJDIR)
270 - $(DEL) ../etc/DOC ../etc/DOC-X
272 clean-other-dirs-nmake:
274 $(MAKE) $(MFLAGS) clean
276 $(MAKE) $(MFLAGS) clean
278 $(MAKE) $(MFLAGS) clean
280 $(MAKE) $(MFLAGS) clean
282 $(MAKE) $(MFLAGS) clean
284 $(MAKE) $(MFLAGS) clean
286 $(MAKE) $(MFLAGS) clean
289 clean-other-dirs-gmake:
290 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
291 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
292 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
293 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
294 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
295 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
296 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
298 cleanall-other-dirs-nmake:
300 $(MAKE) $(MFLAGS) cleanall
302 $(MAKE) $(MFLAGS) cleanall
305 cleanall-other-dirs-gmake:
306 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
307 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
309 # We used to delete *~ here, but that might inadvertently remove
310 # precious files if it happens to match their short 8+3 aliases.
311 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
313 - $(DEL_TREE) obj-spd
318 - $(DEL) $(COMPILER_TEMP_FILES)
320 - $(DEL_TREE) obj-spd
324 - $(DEL) ../etc/DOC ../etc/DOC-X
325 - $(DEL) config.log Makefile
327 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
329 distclean-other-dirs-nmake:
331 $(MAKE) $(MFLAGS) distclean
333 $(MAKE) $(MFLAGS) distclean
335 $(MAKE) $(MFLAGS) distclean
337 $(MAKE) $(MFLAGS) distclean
339 $(MAKE) $(MFLAGS) distclean
341 $(MAKE) $(MFLAGS) distclean
343 $(MAKE) $(MFLAGS) distclean
345 $(MAKE) $(MFLAGS) distclean
348 distclean-other-dirs-gmake:
349 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
350 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
351 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
352 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
353 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
354 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
355 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
356 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
358 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
360 maintainer-clean-other-dirs-nmake:
362 $(MAKE) $(MFLAGS) maintainer-clean
364 $(MAKE) $(MFLAGS) maintainer-clean
366 $(MAKE) $(MFLAGS) maintainer-clean
368 $(MAKE) $(MFLAGS) maintainer-clean
370 $(MAKE) $(MFLAGS) maintainer-clean
372 $(MAKE) $(MFLAGS) maintainer-clean
374 $(MAKE) $(MFLAGS) maintainer-clean
376 $(MAKE) $(MFLAGS) maintainer-clean
379 maintainer-clean-other-dirs-gmake:
380 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
381 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
382 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
383 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
384 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
385 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
386 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
387 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean