1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
3 # 2008 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) $(USER32)
41 ddeclient: stamp_BLD $(BLD)/ddeclient.exe
42 $(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
43 $(LINK) $(LINK_OUT)$@ \
44 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
46 cmdproxy: stamp_BLD $(BLD)/cmdproxy.exe
47 $(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
48 $(LINK) $(LINK_OUT)$@ \
49 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
51 addsection: stamp_BLD $(BLD)/addsection.exe
52 $(BLD)/addsection.exe: $(BLD)/addsection.$(O)
53 $(LINK) $(LINK_OUT)$@ \
54 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
56 preprep: stamp_BLD $(BLD)/preprep.exe
57 $(BLD)/preprep.exe: $(BLD)/preprep.$(O)
58 $(LINK) $(LINK_OUT)$@ \
59 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)
62 # The resource file. NT 3.10 requires the use of cvtres; even though
63 # it is not necessary on later versions, it is still ok to use it.
65 $(TRES): emacs.rc icons/emacs.ico emacs.manifest stamp_BLD
66 $(RC) $(RC_OUT)$(TRES) emacs.rc
68 $(CLIENTRES): emacsclient.rc stamp_BLD
69 $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
71 runemacs: stamp_BLD $(BLD)/runemacs.exe
72 $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
73 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
74 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
77 @echo Using $(THE_SHELL) as shell.
79 # These depend on stamp_BLD to make sure the $(BLD) directory is created
80 # before the compilation begins, even if Make runs several commands
81 # in parallel under "make -j".
83 $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
88 all: which-sh stamp_BLD $(ALL) $(CLIENTRES) maybe-bootstrap all-other-dirs-$(MAKETYPE)
90 all-other-dirs-nmake: addsection
101 all-other-dirs-gmake: addsection
102 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
103 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
104 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
105 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
107 recompile: recompile-$(MAKETYPE)
111 $(MAKE) $(MFLAGS) recompile
115 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
119 ### This is meant for Emacs maintainers only. It first cleans the
120 ### lisp subdirectory, removing all compiled Lisp files. Then a
121 ### special emacs executable is built from Lisp sources, which is then
122 ### used to compile Lisp files. The last step is a "normal" make.
124 maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
126 # dummy target to force other targets to be evaluated.
129 maybe-bootstrap-CMD: doit
131 @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing. You should either
132 @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow
134 @if not EXIST ..\lisp\abbrev.elc exit -1
136 maybe-bootstrap-SH: doit
137 @if [ ! -f ../lisp/abbrev.elc ] ; then \
139 echo "Essential Lisp files seem to be missing. You should either"; \
140 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \
145 # Bootstrap depends on cmdproxy because some Lisp functions
146 # loaded during bootstrap may need to run shell commands.
147 bootstrap: addsection cmdproxy bootstrap-$(MAKETYPE)
148 $(MAKE) $(MFLAGS) $(XMFLAGS) all
150 bootstrap-nmake: addsection cmdproxy
152 $(MAKE) $(MFLAGS) bootstrap-clean
154 $(MAKE) $(MFLAGS) clean
156 $(MAKE) $(MFLAGS) clean
158 $(MAKE) $(MFLAGS) bootstrap
159 $(MAKE) $(MFLAGS) bootstrap-clean
161 $(CP) $(BLD)/cmdproxy.exe ../bin
163 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
165 $(MAKE) $(MFLAGS) DOC
168 bootstrap-gmake: addsection cmdproxy
169 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
170 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
171 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
172 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
173 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
174 $(CP) $(BLD)/cmdproxy.exe ../bin
175 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
176 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
178 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
180 bootstrap-clean-nmake:
182 $(MAKE) $(MFLAGS) bootstrap-clean
184 $(MAKE) $(MFLAGS) bootstrap-clean
186 bootstrap-clean-gmake:
187 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
188 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
191 - mkdir "$(INSTALL_DIR)"
193 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
194 - mkdir "$(INSTALL_DIR)/bin"
197 # Build and install emacs in INSTALL_DIR
199 install: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
200 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
201 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
202 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
203 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
204 - "$(INSTALL_DIR)/bin/addpm" -q
205 - $(DEL) ../same-dir.tst
206 - $(DEL) $(INSTALL_DIR)/same-dir.tst
207 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
208 - mkdir "$(INSTALL_DIR)/etc"
209 - mkdir "$(INSTALL_DIR)/info"
210 - mkdir "$(INSTALL_DIR)/lock"
211 - mkdir "$(INSTALL_DIR)/data"
212 - mkdir "$(INSTALL_DIR)/site-lisp"
213 - mkdir "$(INSTALL_DIR)/etc/icons"
214 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
215 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
216 - $(CP_DIR) icons $(INSTALL_DIR)/etc
217 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
218 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
219 - $(CP) ../COPYING $(INSTALL_DIR)/bin
220 - $(DEL) ../same-dir.tst
221 - $(DEL) $(INSTALL_DIR)/same-dir.tst
223 install-other-dirs-nmake:
225 $(MAKE) $(MFLAGS) install
227 $(MAKE) $(MFLAGS) install
229 $(MAKE) $(MFLAGS) install
231 $(MAKE) $(MFLAGS) install
234 install-other-dirs-gmake:
235 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
236 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
237 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
238 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
241 # Note that doc/emacs/makefile knows how to
242 # put the info files in $(infodir),
243 # so we can do ok running make in the build dir.
244 info: force-info info-$(MAKETYPE)
248 $(MAKE) $(MFLAGS) info
250 $(MAKE) $(MFLAGS) info
252 $(MAKE) $(MFLAGS) info
254 $(MAKE) $(MFLAGS) info
258 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs info
259 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc info
260 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref info
261 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro info
265 clean: clean-other-dirs-$(MAKETYPE)
266 - $(DEL) $(COMPILER_TEMP_FILES)
267 - $(DEL_TREE) $(OBJDIR)
269 - $(DEL) ../etc/DOC ../etc/DOC-X
271 clean-other-dirs-nmake:
273 $(MAKE) $(MFLAGS) clean
275 $(MAKE) $(MFLAGS) clean
277 $(MAKE) $(MFLAGS) clean
279 $(MAKE) $(MFLAGS) clean
281 $(MAKE) $(MFLAGS) clean
283 $(MAKE) $(MFLAGS) clean
285 $(MAKE) $(MFLAGS) clean
288 clean-other-dirs-gmake:
289 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
290 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
291 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
292 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
293 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
294 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
295 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
297 cleanall-other-dirs-nmake:
299 $(MAKE) $(MFLAGS) cleanall
301 $(MAKE) $(MFLAGS) cleanall
304 cleanall-other-dirs-gmake:
305 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
306 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
308 # We used to delete *~ here, but that might inadvertently remove
309 # precious files if it happens to match their short 8+3 aliases.
310 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
312 - $(DEL_TREE) obj-spd
317 - $(DEL) $(COMPILER_TEMP_FILES)
319 - $(DEL_TREE) obj-spd
323 - $(DEL) ../etc/DOC ../etc/DOC-X
324 - $(DEL) config.log Makefile
326 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
328 distclean-other-dirs-nmake:
330 $(MAKE) $(MFLAGS) distclean
332 $(MAKE) $(MFLAGS) distclean
334 $(MAKE) $(MFLAGS) distclean
336 $(MAKE) $(MFLAGS) distclean
338 $(MAKE) $(MFLAGS) distclean
340 $(MAKE) $(MFLAGS) distclean
342 $(MAKE) $(MFLAGS) distclean
344 $(MAKE) $(MFLAGS) distclean
347 distclean-other-dirs-gmake:
348 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
349 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
350 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
351 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
352 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
353 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
354 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
355 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
357 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
359 maintainer-clean-other-dirs-nmake:
361 $(MAKE) $(MFLAGS) maintainer-clean
363 $(MAKE) $(MFLAGS) maintainer-clean
365 $(MAKE) $(MFLAGS) maintainer-clean
367 $(MAKE) $(MFLAGS) maintainer-clean
369 $(MAKE) $(MFLAGS) maintainer-clean
371 $(MAKE) $(MFLAGS) maintainer-clean
373 $(MAKE) $(MFLAGS) maintainer-clean
375 $(MAKE) $(MFLAGS) maintainer-clean
378 maintainer-clean-other-dirs-gmake:
379 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
380 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
381 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
382 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
383 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
384 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
385 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
386 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean