1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
\r
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
\r
3 # 2008, 2009, 2010 Free Software Foundation, Inc.
\r
5 # Top level makefile for building GNU Emacs on Windows NT
\r
7 # This file is part of GNU Emacs.
\r
9 # GNU Emacs is free software: you can redistribute it and/or modify
\r
10 # it under the terms of the GNU General Public License as published by
\r
11 # the Free Software Foundation, either version 3 of the License, or
\r
12 # (at your option) any later version.
\r
14 # GNU Emacs is distributed in the hope that it will be useful,
\r
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 # GNU General Public License for more details.
\r
19 # You should have received a copy of the GNU General Public License
\r
20 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
\r
23 # FIXME: This file uses DOS EOLs. Convert to Unix after 22.1 is out
\r
24 # (and remove or replace this comment).
\r
28 TMP_DIST_DIR = emacs-$(VERSION)
\r
30 TRES = $(BLD)/emacs.res
\r
31 CLIENTRES = $(BLD)/emacsclient.res
\r
35 ALL = addpm ddeclient runemacs cmdproxy addsection preprep
\r
40 addpm: stamp_BLD $(BLD)/addpm.exe
\r
41 $(BLD)/addpm.exe: $(BLD)/addpm.$(O)
\r
42 $(LINK) $(LINK_OUT)$@ \
\r
43 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) \
\r
44 $(USER32) $(OLE32) $(UUID) $(SHELL32)
\r
46 ddeclient: stamp_BLD $(BLD)/ddeclient.exe
\r
47 $(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
\r
48 $(LINK) $(LINK_OUT)$@ \
\r
49 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
\r
51 cmdproxy: stamp_BLD $(BLD)/cmdproxy.exe
\r
52 $(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
\r
53 $(LINK) $(LINK_OUT)$@ \
\r
54 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
\r
56 addsection: stamp_BLD $(BLD)/addsection.exe
\r
57 $(BLD)/addsection.exe: $(BLD)/addsection.$(O)
\r
58 $(LINK) $(LINK_OUT)$@ \
\r
59 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
\r
61 preprep: stamp_BLD $(BLD)/preprep.exe
\r
62 $(BLD)/preprep.exe: $(BLD)/preprep.$(O)
\r
63 $(LINK) $(LINK_OUT)$@ \
\r
64 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)
\r
67 # The resource file. NT 3.10 requires the use of cvtres; even though
\r
68 # it is not necessary on later versions, it is still ok to use it.
\r
70 $(TRES): emacs.rc icons/emacs.ico emacs.manifest stamp_BLD
\r
71 $(RC) $(RC_OUT)$(TRES) emacs.rc
\r
73 $(CLIENTRES): emacsclient.rc stamp_BLD
\r
74 $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
\r
76 runemacs: stamp_BLD $(BLD)/runemacs.exe
\r
77 $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
\r
78 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
\r
79 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
\r
82 @echo Using $(THE_SHELL) as shell.
\r
84 # These depend on stamp_BLD to make sure the $(BLD) directory is created
\r
85 # before the compilation begins, even if Make runs several commands
\r
86 # in parallel under "make -j".
\r
88 $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
\r
93 all: which-sh stamp_BLD $(ALL) $(CLIENTRES) maybe-bootstrap all-other-dirs-$(MAKETYPE)
\r
95 all-other-dirs-nmake: addsection
\r
97 $(MAKE) $(MFLAGS) all
\r
99 $(MAKE) $(MFLAGS) all
\r
101 $(MAKE) $(MFLAGS) all
\r
103 $(MAKE) $(MFLAGS) all
\r
106 all-other-dirs-gmake: addsection
\r
107 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
\r
108 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
\r
109 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
\r
110 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
\r
112 recompile: recompile-$(MAKETYPE)
\r
116 $(MAKE) $(MFLAGS) recompile
\r
120 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
\r
122 #### Bootstrapping.
\r
124 ### This is meant for Emacs maintainers only. It first cleans the
\r
125 ### lisp subdirectory, removing all compiled Lisp files. Then a
\r
126 ### special emacs executable is built from Lisp sources, which is then
\r
127 ### used to compile Lisp files. The last step is a "normal" make.
\r
129 maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
\r
131 # dummy target to force other targets to be evaluated.
\r
134 maybe-bootstrap-CMD: doit
\r
136 @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing. You should either
\r
137 @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow
\r
139 @if not EXIST ..\lisp\abbrev.elc exit -1
\r
141 maybe-bootstrap-SH: doit
\r
142 @if [ ! -f ../lisp/abbrev.elc ] ; then \
\r
144 echo "Essential Lisp files seem to be missing. You should either"; \
\r
145 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \
\r
150 # Bootstrap depends on cmdproxy because some Lisp functions
\r
151 # loaded during bootstrap may need to run shell commands.
\r
152 bootstrap: addsection cmdproxy bootstrap-$(MAKETYPE)
\r
153 $(MAKE) $(MFLAGS) $(XMFLAGS) all
\r
155 bootstrap-nmake: addsection cmdproxy
\r
157 $(MAKE) $(MFLAGS) bootstrap-clean
\r
159 $(MAKE) $(MFLAGS) clean
\r
161 $(MAKE) $(MFLAGS) clean
\r
163 $(MAKE) $(MFLAGS) bootstrap
\r
164 $(MAKE) $(MFLAGS) bootstrap-clean
\r
166 $(CP) $(BLD)/cmdproxy.exe ../bin
\r
168 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
\r
170 $(MAKE) $(MFLAGS) DOC
\r
173 bootstrap-gmake: addsection cmdproxy
\r
174 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
\r
175 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
\r
176 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
\r
177 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
\r
178 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
\r
179 $(CP) $(BLD)/cmdproxy.exe ../bin
\r
180 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
\r
181 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
\r
183 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
\r
185 bootstrap-clean-nmake:
\r
187 $(MAKE) $(MFLAGS) bootstrap-clean
\r
189 $(MAKE) $(MFLAGS) bootstrap-clean
\r
191 bootstrap-clean-gmake:
\r
192 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
\r
193 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
\r
196 - mkdir "$(INSTALL_DIR)"
\r
198 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
\r
199 - mkdir "$(INSTALL_DIR)/bin"
\r
202 # Build and install emacs in INSTALL_DIR
\r
204 .PHONY: install-bin install-shortcuts
\r
206 install: install-bin install-shortcuts
\r
208 install-bin: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
\r
209 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
\r
210 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
\r
211 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
\r
212 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
\r
213 - $(CP) README.W32 $(INSTALL_DIR)
\r
214 - $(DEL) ../same-dir.tst
\r
215 - $(DEL) $(INSTALL_DIR)/same-dir.tst
\r
216 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
\r
217 - mkdir "$(INSTALL_DIR)/etc"
\r
218 - mkdir "$(INSTALL_DIR)/info"
\r
219 - mkdir "$(INSTALL_DIR)/lock"
\r
220 - mkdir "$(INSTALL_DIR)/data"
\r
221 - mkdir "$(INSTALL_DIR)/site-lisp"
\r
222 - mkdir "$(INSTALL_DIR)/etc/icons"
\r
223 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
\r
224 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
\r
225 - $(CP_DIR) icons $(INSTALL_DIR)/etc
\r
226 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
\r
227 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
\r
228 - $(CP) ../COPYING $(INSTALL_DIR)/bin
\r
229 - $(DEL) ../same-dir.tst
\r
230 - $(DEL) $(INSTALL_DIR)/same-dir.tst
\r
232 install-other-dirs-nmake:
\r
234 $(MAKE) $(MFLAGS) install
\r
236 $(MAKE) $(MFLAGS) install
\r
238 $(MAKE) $(MFLAGS) install
\r
240 $(MAKE) $(MFLAGS) install
\r
243 install-other-dirs-gmake:
\r
244 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
\r
245 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
\r
246 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
\r
247 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
\r
250 "$(INSTALL_DIR)/bin/addpm" -q
\r
253 mkdir $(TMP_DIST_DIR)
\r
254 $(CP) "$(INSTALL_DIR)/BUGS" $(TMP_DIST_DIR)
\r
255 $(CP) "$(INSTALL_DIR)/COPYING" $(TMP_DIST_DIR)
\r
256 $(CP) "$(INSTALL_DIR)/README" $(TMP_DIST_DIR)
\r
257 $(CP) "$(INSTALL_DIR)/README.W32" $(TMP_DIST_DIR)
\r
258 $(CP) "$(INSTALL_DIR)/INSTALL" $(TMP_DIST_DIR)
\r
259 $(CP_DIR) "$(INSTALL_DIR)/bin" $(TMP_DIST_DIR)
\r
260 $(CP_DIR) "$(INSTALL_DIR)/etc" $(TMP_DIST_DIR)
\r
261 $(CP_DIR) "$(INSTALL_DIR)/info" $(TMP_DIST_DIR)
\r
262 $(CP_DIR) "$(INSTALL_DIR)/lisp" $(TMP_DIST_DIR)
\r
263 $(CP_DIR) "$(INSTALL_DIR)/leim" $(TMP_DIST_DIR)
\r
264 $(CP_DIR) "$(INSTALL_DIR)/site-lisp" $(TMP_DIST_DIR)
\r
265 $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin
\r
266 $(COMSPEC)$(ComSpec) /c $(ARGQUOTE)zipdist.bat $(VERSION)$(ARGQUOTE)
\r
267 $(DEL_TREE) $(TMP_DIST_DIR)
\r
270 # Note that doc/emacs/makefile knows how to
\r
271 # put the info files in $(infodir),
\r
272 # so we can do ok running make in the build dir.
\r
273 info: force-info info-$(MAKETYPE)
\r
277 $(MAKE) $(MFLAGS) info
\r
279 $(MAKE) $(MFLAGS) info
\r
281 $(MAKE) $(MFLAGS) info
\r
283 $(MAKE) $(MFLAGS) info
\r
287 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs info
\r
288 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc info
\r
289 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref info
\r
290 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro info
\r
294 clean: clean-other-dirs-$(MAKETYPE)
\r
295 - $(DEL) $(COMPILER_TEMP_FILES)
\r
296 - $(DEL_TREE) $(OBJDIR)
\r
298 - $(DEL) ../etc/DOC ../etc/DOC-X
\r
300 clean-other-dirs-nmake:
\r
302 $(MAKE) $(MFLAGS) clean
\r
304 $(MAKE) $(MFLAGS) clean
\r
305 cd ..\doc\lispintro
\r
306 $(MAKE) $(MFLAGS) clean
\r
308 $(MAKE) $(MFLAGS) clean
\r
310 $(MAKE) $(MFLAGS) clean
\r
312 $(MAKE) $(MFLAGS) clean
\r
314 $(MAKE) $(MFLAGS) clean
\r
317 clean-other-dirs-gmake:
\r
318 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
\r
319 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
\r
320 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
\r
321 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
\r
322 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
\r
323 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
\r
324 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
\r
326 cleanall-other-dirs-nmake:
\r
328 $(MAKE) $(MFLAGS) cleanall
\r
330 $(MAKE) $(MFLAGS) cleanall
\r
333 cleanall-other-dirs-gmake:
\r
334 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
\r
335 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
\r
337 # We used to delete *~ here, but that might inadvertently remove
\r
338 # precious files if it happens to match their short 8+3 aliases.
\r
339 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
\r
341 - $(DEL_TREE) obj-spd
\r
343 - $(DEL_TREE) oo-spd
\r
346 - $(DEL) $(COMPILER_TEMP_FILES)
\r
348 - $(DEL_TREE) obj-spd
\r
350 - $(DEL_TREE) oo-spd
\r
352 - $(DEL) ../etc/DOC ../etc/DOC-X
\r
353 - $(DEL) config.log Makefile
\r
354 - $(DEL) ../README.W32
\r
356 distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
\r
358 distclean-other-dirs-nmake:
\r
360 $(MAKE) $(MFLAGS) distclean
\r
362 $(MAKE) $(MFLAGS) distclean
\r
364 $(MAKE) $(MFLAGS) distclean
\r
366 $(MAKE) $(MFLAGS) distclean
\r
368 $(MAKE) $(MFLAGS) distclean
\r
370 $(MAKE) $(MFLAGS) distclean
\r
371 cd ..\doc\lispintro
\r
372 $(MAKE) $(MFLAGS) distclean
\r
374 $(MAKE) $(MFLAGS) distclean
\r
377 distclean-other-dirs-gmake:
\r
378 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
\r
379 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
\r
380 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
\r
381 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
\r
382 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
\r
383 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
\r
384 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
\r
385 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
\r
387 maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
\r
389 maintainer-clean-other-dirs-nmake:
\r
391 $(MAKE) $(MFLAGS) maintainer-clean
\r
393 $(MAKE) $(MFLAGS) maintainer-clean
\r
395 $(MAKE) $(MFLAGS) maintainer-clean
\r
397 $(MAKE) $(MFLAGS) maintainer-clean
\r
399 $(MAKE) $(MFLAGS) maintainer-clean
\r
401 $(MAKE) $(MFLAGS) maintainer-clean
\r
402 cd ..\doc\lispintro
\r
403 $(MAKE) $(MFLAGS) maintainer-clean
\r
405 $(MAKE) $(MFLAGS) maintainer-clean
\r
408 maintainer-clean-other-dirs-gmake:
\r
409 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
\r
410 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
\r
411 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
\r
412 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
\r
413 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
\r
414 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
\r
415 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
\r
416 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean
\r
418 realclean: cleanall
\r
419 - $(DEL_TREE) ../bin
\r
421 TAGS: TAGS-$(MAKETYPE)
\r
425 ../lib-src/$(BLD)/etags $(CURDIR)/*.c
\r
426 $(MAKE) $(MFLAGS) -C ../src TAGS TAGS-LISP
\r
427 $(MAKE) $(MFLAGS) -C ../lib-src TAGS
\r
430 echo This target is not supported with NMake
\r