1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004,
3 # 2005, 2006, 2007 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 2, or (at your option)
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; see the file COPYING. If not, write to
21 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 # Boston, MA 02110-1301, USA.
24 # FIXME: This file uses DOS EOLs. Convert to Unix after 22.1 is out
25 # (and remove or replace this comment).
27 ALL = addpm ddeclient runemacs cmdproxy addsection preprep
31 TRES = $(BLD)/emacs.res
35 addpm: stamp_BLD $(BLD)/addpm.exe
36 $(BLD)/addpm.exe: $(BLD)/addpm.$(O)
37 $(LINK) $(LINK_OUT)$@ \
38 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
40 ddeclient: stamp_BLD $(BLD)/ddeclient.exe
41 $(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
42 $(LINK) $(LINK_OUT)$@ \
43 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
45 cmdproxy: stamp_BLD $(BLD)/cmdproxy.exe
46 $(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
47 $(LINK) $(LINK_OUT)$@ \
48 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
50 addsection: stamp_BLD $(BLD)/addsection.exe
51 $(BLD)/addsection.exe: $(BLD)/addsection.$(O)
52 $(LINK) $(LINK_OUT)$@ \
53 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
55 preprep: stamp_BLD $(BLD)/preprep.exe
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 stamp_BLD
65 $(RC) $(RC_OUT)$(BLD)/emacs.res emacs.rc
67 runemacs: stamp_BLD $(BLD)/runemacs.exe
68 $(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
69 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
70 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
73 @echo Using $(THE_SHELL) as shell.
75 # These depend on stamp_BLD to make sure the $(BLD) directory is created
76 # before the compilation begins, even if Make runs several commands
77 # in parallel under "make -j".
79 $(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
84 all: which-sh stamp_BLD $(ALL) maybe-bootstrap all-other-dirs-$(MAKETYPE)
86 all-other-dirs-nmake: addsection
97 all-other-dirs-gmake: addsection
98 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
99 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
100 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
101 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
103 recompile: recompile-$(MAKETYPE)
107 $(MAKE) $(MFLAGS) recompile
111 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
115 ### This is meant for Emacs maintainers only. It first cleans the
116 ### lisp subdirectory, removing all compiled Lisp files. Then a
117 ### special emacs executable is built from Lisp sources, which is then
118 ### used to compile Lisp files. The last step is a "normal" make.
120 maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
122 # dummy target to force other targets to be evaluated.
125 maybe-bootstrap-CMD: doit
127 @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing. You should either
128 @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow
130 @if not EXIST ..\lisp\abbrev.elc exit -1
132 maybe-bootstrap-SH: doit
133 @if [ ! -f ../lisp/abbrev.elc ] ; then \
135 echo "Essential Lisp files seem to be missing. You should either"; \
136 echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow."; \
141 bootstrap: addsection bootstrap-$(MAKETYPE)
142 $(MAKE) $(MFLAGS) $(XMFLAGS) all
144 bootstrap-nmake: addsection
146 $(MAKE) $(MFLAGS) bootstrap-clean
148 $(MAKE) $(MFLAGS) clean
150 $(MAKE) $(MFLAGS) clean
152 $(MAKE) $(MFLAGS) bootstrap
153 $(MAKE) $(MFLAGS) bootstrap-clean
155 $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
157 $(MAKE) $(MFLAGS) DOC
160 bootstrap-gmake: addsection
161 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
162 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
163 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
164 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
165 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
166 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
167 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
169 bootstrap-clean: bootstrap-clean-$(MAKETYPE)
171 bootstrap-clean-nmake:
173 $(MAKE) $(MFLAGS) bootstrap-clean
175 $(MAKE) $(MFLAGS) bootstrap-clean
177 bootstrap-clean-gmake:
178 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
179 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
182 - mkdir "$(INSTALL_DIR)"
184 $(INSTALL_DIR)/bin: $(INSTALL_DIR)
185 - mkdir "$(INSTALL_DIR)/bin"
188 # Build and install emacs in INSTALL_DIR
190 install: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
191 - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
192 - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
193 - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
194 - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
195 - "$(INSTALL_DIR)/bin/addpm" -q
196 - $(DEL) ../same-dir.tst
197 - $(DEL) $(INSTALL_DIR)/same-dir.tst
198 echo SameDirTest > "$(INSTALL_DIR)/same-dir.tst"
199 - mkdir "$(INSTALL_DIR)/etc"
200 - mkdir "$(INSTALL_DIR)/info"
201 - mkdir "$(INSTALL_DIR)/lock"
202 - mkdir "$(INSTALL_DIR)/data"
203 - mkdir "$(INSTALL_DIR)/site-lisp"
204 - mkdir "$(INSTALL_DIR)/etc/icons"
205 $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
206 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
207 - $(CP_DIR) icons $(INSTALL_DIR)/etc
208 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
209 - $(DEL) ../same-dir.tst
210 - $(DEL) $(INSTALL_DIR)/same-dir.tst
212 install-other-dirs-nmake:
214 $(MAKE) $(MFLAGS) install
216 $(MAKE) $(MFLAGS) install
218 $(MAKE) $(MFLAGS) install
220 $(MAKE) $(MFLAGS) install
223 install-other-dirs-gmake:
224 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
225 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
226 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
227 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
230 # Note that man/makefile knows how to
231 # put the info files in $(infodir),
232 # so we can do ok running make in the build dir.
233 info: force-info info-$(MAKETYPE)
237 $(MAKE) $(MFLAGS) info
239 $(MAKE) $(MFLAGS) info
241 $(MAKE) $(MFLAGS) info
244 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../man info
245 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lispref info
246 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lispintro info
250 clean: clean-other-dirs-$(MAKETYPE)
251 - $(DEL) *~ $(COMPILER_TEMP_FILES)
252 - $(DEL_TREE) $(OBJDIR)
254 - $(DEL) ../etc/DOC ../etc/DOC-X
256 clean-other-dirs-nmake:
258 $(MAKE) $(MFLAGS) clean
260 $(MAKE) $(MFLAGS) clean
262 $(MAKE) $(MFLAGS) clean
264 $(MAKE) $(MFLAGS) clean
266 $(MAKE) $(MFLAGS) clean
268 $(MAKE) $(MFLAGS) clean
270 $(MAKE) $(MFLAGS) clean
273 clean-other-dirs-gmake:
274 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
275 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
276 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp clean
277 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
279 cleanall-other-dirs-nmake:
281 $(MAKE) $(MFLAGS) cleanall
283 $(MAKE) $(MFLAGS) cleanall
286 cleanall-other-dirs-gmake:
287 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
288 $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
290 cleanall: clean cleanall-other-dirs-$(MAKETYPE)
292 - $(DEL_TREE) obj-spd