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 # This file is part of GNU Emacs.
7 # GNU Emacs is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # GNU Emacs is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 # Set EMACSLOADPATH correctly (in case already defined in environment).
26 EMACSLOADPATH=$(CURDIR)/../lisp
29 # HAVE_CONFIG_H is required by some generic gnu sources stuck into
30 # the emacs source tree.
32 LOCAL_FLAGS = -Demacs=1 -DHAVE_CONFIG_H -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS)
34 EMACS = $(BLD)/emacs.exe
35 TEMACS = $(BLD)/temacs.exe
36 TEMACS_TMP = $(BLD)/temacs.bin
37 TLIB0 = $(BLD)/temacs0.$(A)
38 TLIB1 = $(BLD)/temacs1.$(A)
39 TLIBW32 = $(BLD)/temacw32.$(A)
40 TOBJ = $(BLD)/firstfile.$(O)
41 TRES = $(BLD)/emacs.res
42 TLASTLIB = $(BLD)/lastfile.$(A)
44 DOC = $(OBJDIR)/etc/DOC-X
46 FULL_LINK_FLAGS = $(LINK_FLAGS) $(TEMACS_EXTRA_LINK)
49 # Split up the objects into two sets so that we don't run out of
50 # command line space when we link them into a library.
52 # Put emacs.$(O) in a separate lib, since we need to have firstfile.$(O)
53 # as the "main" object file when linking.
55 OBJ0 = $(BLD)/emacs.$(O)
57 OBJ1 = $(BLD)/alloc.$(O) \
60 $(BLD)/bytecode.$(O) \
62 $(BLD)/callproc.$(O) \
63 $(BLD)/casefiddle.$(O) \
74 $(BLD)/filelock.$(O) \
75 $(BLD)/filemode.$(O) \
79 $(BLD)/keyboard.$(O) \
88 $(BLD)/w32inevt.$(O) \
90 $(BLD)/w32console.$(O) \
100 $(BLD)/termcap.$(O) \
103 $(BLD)/unexw32.$(O) \
106 $(BLD)/casetab.$(O) \
107 $(BLD)/floatfns.$(O) \
109 $(BLD)/gmalloc.$(O) \
110 $(BLD)/intervals.$(O) \
111 $(BLD)/composite.$(O) \
113 $(BLD)/textprop.$(O) \
114 $(BLD)/vm-limit.$(O) \
115 $(BLD)/region-cache.$(O) \
116 $(BLD)/strftime.$(O) \
117 $(BLD)/charset.$(O) \
118 $(BLD)/character.$(O) \
119 $(BLD)/chartab.$(O) \
121 $(BLD)/category.$(O) \
124 $(BLD)/fontset.$(O) \
127 $(BLD)/terminal.$(O) \
130 WIN32OBJ = $(BLD)/w32term.$(O) \
131 $(BLD)/w32xfns.$(O) \
134 $(BLD)/w32select.$(O) \
135 $(BLD)/w32menu.$(O) \
138 FONTOBJ = $(BLD)/w32font.$(O) $(BLD)/w32uniscribe.$(O)
158 # Build the executable and dump it.
163 # The dumped executable
165 emacs: stamp_BLD $(EMACS)
166 $(EMACS): $(DOC) $(TEMACS)
167 "$(THISDIR)/$(BLD)/temacs.exe" -batch -l loadup dump
168 -"$(THISDIR)/$(BLD)/emacs.exe" -q -batch -f list-load-path-shadows
171 # The undumped executable
172 # Note the extra post-link step to insert a static preload heap section.
173 # If preload runs out of memory, increase the last argument to addsection
174 # (it is the preload heap size in MB).
176 temacs: stamp_BLD $(TEMACS)
177 $(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) \
178 ../nt/$(BLD)/addsection.exe
179 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
180 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21
181 echo $(OBJ0) > $(BLD)/buildobj.lst
182 echo $(OBJ1) >> $(BLD)/buildobj.lst
183 echo $(WIN32OBJ) >> $(BLD)/buildobj.lst
184 echo $(FONTOBJ) >> $(BLD)/buildobj.lst
186 bootstrap: bootstrap-emacs
189 # Build a temacs with a sufficiently large PURESIZE to load the
190 # Lisp files from loadup.el in source form.
192 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
193 # this can break with GNU Make 3.81 and later if sh.exe is used.
195 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(CFLAGS) -DPURESIZE=5000000$(ARGQUOTE)
198 # Dump an Emacs executable named bootstrap-emacs containing the
199 # files from loadup.el in source form.
201 bootstrap-emacs: bootstrap-temacs
202 "$(THISDIR)/$(BLD)/temacs.exe" -batch -l loadup bootstrap
204 $(CP) $(EMACS) ../bin
207 # Force recompile of files that depend on PURESIZE
210 - $(DEL) $(BLD)/alloc.$(O)
211 - $(DEL) $(BLD)/data.$(O)
212 - $(DEL) $(BLD)/intervals.$(O)
213 - $(DEL) $(BLD)/keyboard.$(O)
214 - $(DEL) $(BLD)/keymap.$(O)
217 # The resource file. NT 3.10 requires the use of cvtres; even though
218 # it is not necessary on later versions, it is still ok to use it.
220 $(TRES): ../nt/emacs.rc stamp_BLD
221 $(RC) $(RC_INCLUDE)../nt $(RC_OUT)$@ ../nt/emacs.rc
224 # Build the library. Split up the build into two phases...otherwise we
225 # run out of command line space.
229 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
232 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
233 $(TLIBW32): $(WIN32OBJ) $(FONTOBJ)
235 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
238 # Place lastfile.$(O) in its own library so that it can be loaded after
239 # the source libraries but before any system libraries. Doing so defines
240 # the end of Emacs' data section portably across compilers and systems.
242 $(TLASTLIB): $(BLD)/lastfile.$(O)
244 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
247 # Assuming INSTALL_DIR is defined, build and install emacs in it.
250 - mkdir "$(INSTALL_DIR)/bin"
251 $(CP) $(EMACS) $(INSTALL_DIR)/bin
256 # We used to delete *~, s/*~, m/*~ here, but that might inadvertently
257 # remove precious files if it happens to match their short 8+3 aliases.
259 - $(DEL) "s/*.h~" "m/*.h~"
260 - $(DEL) $(COMPILER_TEMP_FILES)
261 - $(DEL_TREE) $(OBJDIR)
265 - $(DEL) config.h epaths.h Makefile
267 maintainer-clean: distclean
272 - $(DEL_TREE) obj-spd
280 CONFIG_H = $(EMACS_ROOT)/src/s/ms-w32.h \
281 $(EMACS_ROOT)/src/m/intel386.h \
282 $(EMACS_ROOT)/src/config.h
284 $(BLD)/abbrev.$(O) : \
291 $(SRC)/dispextern.h \
296 $(BLD)/alloc.$(O) : \
299 $(SRC)/blockinput.h \
304 $(SRC)/dispextern.h \
314 $(BLD)/atimer.$(O) : \
318 $(SRC)/blockinput.h \
322 $(BLD)/buffer.$(O) : \
325 $(EMACS_ROOT)/nt/inc/sys/param.h \
326 $(SRC)/blockinput.h \
331 $(SRC)/dispextern.h \
337 $(SRC)/region-cache.h \
341 $(BLD)/bytecode.$(O) : \
349 $(BLD)/callint.$(O) : \
354 $(SRC)/dispextern.h \
360 $(BLD)/callproc.$(O) : \
363 $(EMACS_ROOT)/nt/inc/sys/param.h \
364 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
365 $(EMACS_ROOT)/nt/inc/sys/file.h \
381 $(BLD)/casefiddle.$(O) : \
382 $(SRC)/casefiddle.c \
392 $(BLD)/casetab.$(O) : \
398 $(BLD)/category.$(O) : \
415 $(BLD)/character.$(O) : \
425 $(BLD)/charset.$(O) : \
436 $(BLD)/chartab.$(O) : \
455 $(SRC)/dispextern.h \
462 $(BLD)/coding.$(O) : \
471 $(SRC)/dispextern.h \
478 $(BLD)/composite.$(O) : \
485 $(SRC)/dispextern.h \
501 $(BLD)/dired.$(O) : \
514 $(BLD)/dispnew.$(O) : \
517 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
518 $(EMACS_ROOT)/nt/inc/sys/file.h \
520 $(SRC)/blockinput.h \
527 $(SRC)/dispextern.h \
546 $(EMACS_ROOT)/nt/inc/sys/file.h \
553 $(BLD)/doprnt.$(O) : \
559 $(BLD)/editfns.$(O) : \
562 $(EMACS_ROOT)/nt/inc/pwd.h \
569 $(SRC)/dispextern.h \
576 $(BLD)/emacs.$(O) : \
579 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
580 $(EMACS_ROOT)/nt/inc/sys/file.h \
582 $(SRC)/blockinput.h \
586 $(SRC)/dispextern.h \
603 $(SRC)/blockinput.h \
605 $(SRC)/dispextern.h \
610 $(BLD)/fileio.$(O) : \
613 $(EMACS_ROOT)/nt/inc/pwd.h \
614 $(EMACS_ROOT)/nt/inc/sys/param.h \
615 $(EMACS_ROOT)/nt/inc/sys/file.h \
623 $(SRC)/dispextern.h \
629 $(BLD)/filelock.$(O) : \
632 $(EMACS_ROOT)/nt/inc/pwd.h \
633 $(EMACS_ROOT)/nt/inc/sys/file.h \
634 $(EMACS_ROOT)/src/epaths.h \
642 $(BLD)/filemode.$(O) : \
646 $(BLD)/firstfile.$(O) : \
650 $(BLD)/floatfns.$(O) : \
658 $(EMACS_ROOT)/nt/inc/langinfo.h \
659 $(EMACS_ROOT)/nt/inc/nl_types.h \
661 $(SRC)/blockinput.h \
669 $(SRC)/dispextern.h \
683 $(SRC)/dispextern.h \
691 $(BLD)/fontset.$(O) : \
698 $(SRC)/dispextern.h \
707 $(BLD)/frame.$(O) : \
711 $(SRC)/blockinput.h \
716 $(SRC)/dispextern.h \
727 $(BLD)/fringe.$(O) : \
731 $(SRC)/blockinput.h \
733 $(SRC)/dispextern.h \
739 $(BLD)/gmalloc.$(O) : \
742 $(EMACS_ROOT)/nt/inc/sys/param.h \
749 $(SRC)/blockinput.h \
750 $(SRC)/dispextern.h \
760 $(BLD)/indent.$(O) : \
768 $(SRC)/dispextern.h \
774 $(SRC)/region-cache.h \
780 $(BLD)/insdel.$(O) : \
784 $(SRC)/blockinput.h \
789 $(SRC)/dispextern.h \
791 $(SRC)/region-cache.h \
796 $(BLD)/intervals.$(O) : \
801 $(SRC)/dispextern.h \
808 $(BLD)/keyboard.$(O) : \
811 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
812 $(EMACS_ROOT)/nt/inc/sys/file.h \
814 $(SRC)/blockinput.h \
820 $(SRC)/dispextern.h \
839 $(BLD)/keymap.$(O) : \
843 $(SRC)/blockinput.h \
849 $(SRC)/dispextern.h \
858 $(BLD)/lastfile.$(O) : \
862 $(BLD)/lread.$(O) : \
865 $(EMACS_ROOT)/nt/inc/sys/file.h \
866 $(EMACS_ROOT)/src/epaths.h \
867 $(SRC)/blockinput.h \
875 $(SRC)/dispextern.h \
881 $(BLD)/macros.$(O) : \
886 $(SRC)/dispextern.h \
892 $(BLD)/marker.$(O) : \
910 $(SRC)/blockinput.h \
911 $(SRC)/dispextern.h \
915 $(BLD)/minibuf.$(O) : \
923 $(SRC)/dispextern.h \
936 $(EMACS_ROOT)/nt/inc/pwd.h \
942 $(BLD)/w32heap.$(O) : \
947 $(BLD)/w32inevt.$(O) : \
951 $(SRC)/blockinput.h \
960 $(BLD)/w32proc.$(O) : \
963 $(EMACS_ROOT)/nt/inc/langinfo.h \
964 $(EMACS_ROOT)/nt/inc/nl_types.h \
975 $(BLD)/w32console.$(O) : \
976 $(SRC)/w32console.c \
982 $(SRC)/dispextern.h \
989 $(BLD)/print.$(O) : \
996 $(SRC)/dispextern.h \
1005 $(BLD)/process.$(O) : \
1008 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1009 $(EMACS_ROOT)/nt/inc/sys/file.h \
1011 $(SRC)/blockinput.h \
1014 $(SRC)/character.h \
1018 $(SRC)/composite.h \
1019 $(SRC)/dispextern.h \
1023 $(SRC)/sysselect.h \
1024 $(SRC)/syssignal.h \
1028 $(SRC)/termhooks.h \
1033 $(BLD)/ralloc.$(O) : \
1036 $(EMACS_ROOT)/nt/inc/sys/param.h \
1037 $(SRC)/getpagesize.h
1039 $(BLD)/regex.$(O) : \
1044 $(SRC)/character.h \
1049 $(BLD)/region-cache.$(O) : \
1050 $(SRC)/region-cache.c \
1053 $(SRC)/region-cache.h
1055 $(BLD)/scroll.$(O) : \
1058 $(SRC)/dispextern.h \
1062 $(SRC)/termhooks.h \
1066 $(BLD)/search.$(O) : \
1070 $(SRC)/blockinput.h \
1073 $(SRC)/character.h \
1076 $(SRC)/composite.h \
1077 $(SRC)/dispextern.h \
1078 $(SRC)/intervals.h \
1080 $(SRC)/region-cache.h \
1085 $(BLD)/sound.$(O) : \
1088 $(SRC)/dispextern.h \
1092 $(BLD)/strftime.$(O) : \
1096 $(BLD)/syntax.$(O) : \
1101 $(SRC)/character.h \
1104 $(SRC)/composite.h \
1105 $(SRC)/dispextern.h \
1106 $(SRC)/intervals.h \
1111 $(BLD)/sysdep.$(O) : \
1114 $(EMACS_ROOT)/nt/inc/sys/param.h \
1115 $(EMACS_ROOT)/nt/inc/sys/file.h \
1116 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1117 $(EMACS_ROOT)/nt/inc/sys/file.h \
1119 $(SRC)/blockinput.h \
1121 $(SRC)/dispextern.h \
1126 $(SRC)/sysselect.h \
1127 $(SRC)/syssignal.h \
1132 $(SRC)/termhooks.h \
1137 $(BLD)/term.$(O) : \
1141 $(SRC)/character.h \
1145 $(SRC)/dispextern.h \
1151 $(SRC)/termhooks.h \
1156 $(BLD)/termcap.$(O) : \
1159 $(EMACS_ROOT)/nt/inc/sys/file.h
1161 $(BLD)/terminal.$(O) : \
1171 $(BLD)/textprop.$(O) : \
1175 $(SRC)/composite.h \
1176 $(SRC)/dispextern.h \
1177 $(SRC)/intervals.h \
1181 $(BLD)/tparam.$(O) : \
1185 $(BLD)/undo.$(O) : \
1191 $(BLD)/unexw32.$(O) : \
1196 $(BLD)/vm-limit.$(O) : \
1201 $(BLD)/window.$(O) : \
1205 $(SRC)/blockinput.h \
1208 $(SRC)/composite.h \
1209 $(SRC)/dispextern.h \
1213 $(SRC)/intervals.h \
1222 $(BLD)/xdisp.$(O) : \
1226 $(SRC)/blockinput.h \
1229 $(SRC)/character.h \
1233 $(SRC)/composite.h \
1234 $(SRC)/dispextern.h \
1240 $(SRC)/intervals.h \
1245 $(SRC)/region-cache.h \
1248 $(SRC)/termhooks.h \
1253 $(BLD)/xfaces.$(O): \
1257 $(SRC)/blockinput.h \
1259 $(SRC)/character.h \
1261 $(SRC)/composite.h \
1262 $(SRC)/dispextern.h \
1266 $(SRC)/intervals.h \
1270 $(SRC)/termhooks.h \
1275 $(BLD)/w32fns.$(O): \
1279 $(SRC)/blockinput.h \
1282 $(SRC)/character.h \
1285 $(SRC)/composite.h \
1286 $(SRC)/dispextern.h \
1291 $(SRC)/intervals.h \
1294 $(SRC)/termhooks.h \
1300 $(BLD)/w32menu.$(O): \
1304 $(SRC)/blockinput.h \
1306 $(SRC)/character.h \
1309 $(SRC)/dispextern.h \
1314 $(SRC)/termhooks.h \
1319 $(BLD)/w32term.$(O): \
1323 $(SRC)/blockinput.h \
1326 $(SRC)/character.h \
1329 $(SRC)/composite.h \
1330 $(SRC)/dispextern.h \
1335 $(SRC)/intervals.h \
1341 $(SRC)/termhooks.h \
1348 $(BLD)/w32select.$(O): \
1349 $(SRC)/w32select.c \
1352 $(SRC)/blockinput.h \
1355 $(SRC)/character.h \
1358 $(SRC)/composite.h \
1359 $(SRC)/dispextern.h \
1367 $(BLD)/w32reg.$(O): \
1371 $(SRC)/blockinput.h \
1376 $(BLD)/w32xfns.$(O): \
1380 $(SRC)/blockinput.h \
1381 $(SRC)/character.h \
1390 $(BLD)/w32font.$(O): \
1393 $(SRC)/character.h \
1395 $(SRC)/dispextern.h \
1403 $(BLD)/w32uniscribe.$(O): \
1404 $(SRC)/w32uniscribe.c \
1406 $(SRC)/character.h \
1408 $(SRC)/dispextern.h \
1416 # Each object file depends on stamp_BLD, because in parallel builds we must
1417 # make sure $(BLD) exists before starting compilations.
1419 $(OBJ0) $(OBJ1) $(WIN32OBJ) $(FONTOBJ) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD