1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004,
3 # 2005, 2006, 2007, 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, or (at your option)
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; see the file COPYING. If not, write to the
19 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 # Boston, MA 02110-1301, USA.
27 # Set EMACSLOADPATH correctly (in case already defined in environment).
28 EMACSLOADPATH=$(CURDIR)/../lisp
31 # HAVE_CONFIG_H is required by some generic gnu sources stuck into
32 # the emacs source tree.
34 LOCAL_FLAGS = -Demacs=1 -DWINDOWSNT -DDOS_NT -DHAVE_CONFIG_H -I../nt/inc -D_UCHAR_T -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS)
36 EMACS = $(BLD)/emacs.exe
37 TEMACS = $(BLD)/temacs.exe
38 TEMACS_TMP = $(BLD)/temacs.bin
39 TLIB0 = $(BLD)/temacs0.$(A)
40 TLIB1 = $(BLD)/temacs1.$(A)
41 TLIBW32 = $(BLD)/temacw32.$(A)
42 TOBJ = $(BLD)/firstfile.$(O)
43 TRES = $(BLD)/emacs.res
44 TLASTLIB = $(BLD)/lastfile.$(A)
46 DOC = $(OBJDIR)/etc/DOC-X
48 FULL_LINK_FLAGS = $(LINK_FLAGS) $(TEMACS_EXTRA_LINK)
51 # Split up the objects into two sets so that we don't run out of
52 # command line space when we link them into a library.
54 # Put emacs.$(O) in a separate lib, since we need to have firstfile.$(O)
55 # as the "main" object file when linking.
57 OBJ0 = $(BLD)/emacs.$(O)
59 OBJ1 = $(BLD)/alloc.$(O) \
62 $(BLD)/bytecode.$(O) \
64 $(BLD)/callproc.$(O) \
65 $(BLD)/casefiddle.$(O) \
76 $(BLD)/filelock.$(O) \
77 $(BLD)/filemode.$(O) \
81 $(BLD)/keyboard.$(O) \
90 $(BLD)/w32inevt.$(O) \
92 $(BLD)/w32console.$(O) \
102 $(BLD)/termcap.$(O) \
105 $(BLD)/unexw32.$(O) \
108 $(BLD)/casetab.$(O) \
109 $(BLD)/floatfns.$(O) \
111 $(BLD)/gmalloc.$(O) \
112 $(BLD)/intervals.$(O) \
113 $(BLD)/composite.$(O) \
115 $(BLD)/textprop.$(O) \
116 $(BLD)/vm-limit.$(O) \
117 $(BLD)/region-cache.$(O) \
118 $(BLD)/strftime.$(O) \
119 $(BLD)/charset.$(O) \
120 $(BLD)/character.$(O) \
121 $(BLD)/chartab.$(O) \
123 $(BLD)/category.$(O) \
126 $(BLD)/fontset.$(O) \
132 WIN32OBJ = $(BLD)/w32term.$(O) \
133 $(BLD)/w32xfns.$(O) \
136 $(BLD)/w32select.$(O) \
137 $(BLD)/w32menu.$(O) \
141 FONTOBJ = $(BLD)/w32font.$(O) $(BLD)/w32uniscribe.$(O)
161 # Build the executable and dump it.
166 # The dumped executable
168 emacs: stamp_BLD $(EMACS)
169 $(EMACS): $(DOC) $(TEMACS)
170 "$(THISDIR)/$(BLD)/temacs.exe" -batch -l loadup dump
171 -"$(THISDIR)/$(BLD)/emacs.exe" -q -batch -f list-load-path-shadows
174 # The undumped executable
175 # Note the extra post-link step to insert a static preload heap section.
176 # If preload runs out of memory, increase the last argument to addsection
177 # (it is the preload heap size in MB).
179 temacs: stamp_BLD $(TEMACS)
180 $(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) \
181 ../nt/$(BLD)/addsection.exe
182 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
183 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21
184 echo $(OBJ0) > $(BLD)/buildobj.lst
185 echo $(OBJ1) >> $(BLD)/buildobj.lst
186 echo $(WIN32OBJ) >> $(BLD)/buildobj.lst
187 echo $(FONTOBJ) >> $(BLD)/buildobj.lst
189 bootstrap: bootstrap-emacs
192 # Build a temacs with a sufficiently large PURESIZE to load the
193 # Lisp files from loadup.el in source form.
195 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
196 # this can break with GNU Make 3.81 and later if sh.exe is used.
198 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(CFLAGS) -DPURESIZE=5000000$(ARGQUOTE)
201 # Dump an Emacs executable named bootstrap-emacs containing the
202 # files from loadup.el in source form.
204 bootstrap-emacs: bootstrap-temacs
205 "$(THISDIR)/$(BLD)/temacs.exe" -batch -l loadup bootstrap
207 $(CP) $(EMACS) ../bin
210 # Force recompile of files that depend on PURESIZE
213 - $(DEL) $(BLD)/alloc.$(O)
214 - $(DEL) $(BLD)/data.$(O)
215 - $(DEL) $(BLD)/intervals.$(O)
216 - $(DEL) $(BLD)/keyboard.$(O)
217 - $(DEL) $(BLD)/keymap.$(O)
220 # The resource file. NT 3.10 requires the use of cvtres; even though
221 # it is not necessary on later versions, it is still ok to use it.
223 $(TRES): ../nt/emacs.rc stamp_BLD
224 $(RC) $(RC_INCLUDE)../nt $(RC_OUT)$@ ../nt/emacs.rc
227 # Build the library. Split up the build into two phases...otherwise we
228 # run out of command line space.
232 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
235 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
236 $(TLIBW32): $(WIN32OBJ) $(FONTOBJ)
238 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
241 # Place lastfile.$(O) in its own library so that it can be loaded after
242 # the source libraries but before any system libraries. Doing so defines
243 # the end of Emacs' data section portably across compilers and systems.
245 $(TLASTLIB): $(BLD)/lastfile.$(O)
247 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
250 # Assuming INSTALL_DIR is defined, build and install emacs in it.
253 - mkdir "$(INSTALL_DIR)/bin"
254 $(CP) $(EMACS) $(INSTALL_DIR)/bin
259 # We used to delete *~, s/*~, m/*~ here, but that might inadvertently
260 # remove precious files if it happens to match their short 8+3 aliases.
262 - $(DEL) "s/*.h~" "m/*.h~"
263 - $(DEL) $(COMPILER_TEMP_FILES)
264 - $(DEL_TREE) $(OBJDIR)
268 - $(DEL) config.h epaths.h Makefile
270 maintainer-clean: distclean
275 - $(DEL_TREE) obj-spd
283 CONFIG_H = $(EMACS_ROOT)/src/s/ms-w32.h \
284 $(EMACS_ROOT)/src/m/intel386.h \
285 $(EMACS_ROOT)/src/config.h
287 $(BLD)/abbrev.$(O) : \
294 $(SRC)/dispextern.h \
300 $(BLD)/alloc.$(O) : \
303 $(SRC)/blockinput.h \
308 $(SRC)/dispextern.h \
319 $(BLD)/atimer.$(O) : \
323 $(SRC)/blockinput.h \
327 $(BLD)/buffer.$(O) : \
330 $(EMACS_ROOT)/nt/inc/sys/param.h \
331 $(SRC)/blockinput.h \
336 $(SRC)/dispextern.h \
342 $(SRC)/region-cache.h \
347 $(BLD)/bytecode.$(O) : \
355 $(BLD)/callint.$(O) : \
360 $(SRC)/dispextern.h \
367 $(BLD)/callproc.$(O) : \
370 $(EMACS_ROOT)/nt/inc/sys/param.h \
371 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
372 $(EMACS_ROOT)/nt/inc/sys/file.h \
388 $(BLD)/casefiddle.$(O) : \
389 $(SRC)/casefiddle.c \
399 $(BLD)/casetab.$(O) : \
405 $(BLD)/category.$(O) : \
422 $(BLD)/character.$(O) : \
432 $(BLD)/charset.$(O) : \
443 $(BLD)/chartab.$(O) : \
462 $(SRC)/dispextern.h \
470 $(BLD)/coding.$(O) : \
479 $(SRC)/dispextern.h \
487 $(BLD)/composite.$(O) : \
494 $(SRC)/dispextern.h \
511 $(BLD)/dired.$(O) : \
524 $(BLD)/dispnew.$(O) : \
527 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
528 $(EMACS_ROOT)/nt/inc/sys/file.h \
530 $(SRC)/blockinput.h \
537 $(SRC)/dispextern.h \
557 $(EMACS_ROOT)/nt/inc/sys/file.h \
564 $(BLD)/doprnt.$(O) : \
570 $(BLD)/editfns.$(O) : \
573 $(EMACS_ROOT)/nt/inc/pwd.h \
580 $(SRC)/dispextern.h \
588 $(BLD)/emacs.$(O) : \
591 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
592 $(EMACS_ROOT)/nt/inc/sys/file.h \
594 $(SRC)/blockinput.h \
598 $(SRC)/dispextern.h \
616 $(SRC)/blockinput.h \
618 $(SRC)/dispextern.h \
624 $(BLD)/fileio.$(O) : \
627 $(EMACS_ROOT)/nt/inc/pwd.h \
628 $(EMACS_ROOT)/nt/inc/sys/param.h \
629 $(EMACS_ROOT)/nt/inc/sys/file.h \
637 $(SRC)/dispextern.h \
644 $(BLD)/filelock.$(O) : \
647 $(EMACS_ROOT)/nt/inc/pwd.h \
648 $(EMACS_ROOT)/nt/inc/sys/file.h \
649 $(EMACS_ROOT)/src/epaths.h \
657 $(BLD)/filemode.$(O) : \
661 $(BLD)/firstfile.$(O) : \
665 $(BLD)/floatfns.$(O) : \
673 $(EMACS_ROOT)/nt/inc/langinfo.h \
674 $(EMACS_ROOT)/nt/inc/nl_types.h \
676 $(SRC)/blockinput.h \
684 $(SRC)/dispextern.h \
699 $(SRC)/dispextern.h \
707 $(BLD)/fontset.$(O) : \
714 $(SRC)/dispextern.h \
724 $(BLD)/frame.$(O) : \
728 $(SRC)/blockinput.h \
733 $(SRC)/dispextern.h \
745 $(BLD)/fringe.$(O) : \
749 $(SRC)/blockinput.h \
751 $(SRC)/dispextern.h \
758 $(BLD)/gmalloc.$(O) : \
761 $(EMACS_ROOT)/nt/inc/sys/param.h \
768 $(SRC)/blockinput.h \
769 $(SRC)/dispextern.h \
780 $(BLD)/indent.$(O) : \
788 $(SRC)/dispextern.h \
794 $(SRC)/region-cache.h \
801 $(BLD)/insdel.$(O) : \
805 $(SRC)/blockinput.h \
810 $(SRC)/dispextern.h \
812 $(SRC)/region-cache.h \
818 $(BLD)/intervals.$(O) : \
823 $(SRC)/dispextern.h \
831 $(BLD)/keyboard.$(O) : \
834 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
835 $(EMACS_ROOT)/nt/inc/sys/file.h \
837 $(SRC)/blockinput.h \
843 $(SRC)/dispextern.h \
863 $(BLD)/keymap.$(O) : \
867 $(SRC)/blockinput.h \
873 $(SRC)/dispextern.h \
883 $(BLD)/lastfile.$(O) : \
887 $(BLD)/lread.$(O) : \
890 $(EMACS_ROOT)/nt/inc/sys/file.h \
891 $(EMACS_ROOT)/src/epaths.h \
892 $(SRC)/blockinput.h \
900 $(SRC)/dispextern.h \
907 $(BLD)/macros.$(O) : \
912 $(SRC)/dispextern.h \
919 $(BLD)/marker.$(O) : \
930 $(BLD)/minibuf.$(O) : \
938 $(SRC)/dispextern.h \
952 $(EMACS_ROOT)/nt/inc/pwd.h \
958 $(BLD)/w32heap.$(O) : \
963 $(BLD)/w32inevt.$(O) : \
967 $(SRC)/blockinput.h \
977 $(BLD)/w32proc.$(O) : \
980 $(EMACS_ROOT)/nt/inc/langinfo.h \
981 $(EMACS_ROOT)/nt/inc/nl_types.h \
993 $(BLD)/w32console.$(O) : \
994 $(SRC)/w32console.c \
1000 $(SRC)/dispextern.h \
1003 $(SRC)/termhooks.h \
1008 $(BLD)/print.$(O) : \
1012 $(SRC)/character.h \
1014 $(SRC)/composite.h \
1015 $(SRC)/dispextern.h \
1017 $(SRC)/intervals.h \
1025 $(BLD)/process.$(O) : \
1028 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1029 $(EMACS_ROOT)/nt/inc/sys/file.h \
1031 $(SRC)/blockinput.h \
1034 $(SRC)/character.h \
1038 $(SRC)/composite.h \
1039 $(SRC)/dispextern.h \
1043 $(SRC)/sysselect.h \
1044 $(SRC)/syssignal.h \
1048 $(SRC)/termhooks.h \
1054 $(BLD)/ralloc.$(O) : \
1057 $(EMACS_ROOT)/nt/inc/sys/param.h \
1058 $(SRC)/getpagesize.h
1060 $(BLD)/regex.$(O) : \
1065 $(SRC)/character.h \
1070 $(BLD)/region-cache.$(O) : \
1071 $(SRC)/region-cache.c \
1074 $(SRC)/region-cache.h
1076 $(BLD)/scroll.$(O) : \
1079 $(SRC)/dispextern.h \
1083 $(SRC)/termhooks.h \
1088 $(BLD)/search.$(O) : \
1092 $(SRC)/blockinput.h \
1095 $(SRC)/character.h \
1098 $(SRC)/composite.h \
1099 $(SRC)/dispextern.h \
1100 $(SRC)/intervals.h \
1102 $(SRC)/region-cache.h \
1108 $(BLD)/sound.$(O) : \
1111 $(SRC)/dispextern.h \
1115 $(BLD)/strftime.$(O) : \
1119 $(BLD)/syntax.$(O) : \
1124 $(SRC)/character.h \
1127 $(SRC)/composite.h \
1128 $(SRC)/dispextern.h \
1129 $(SRC)/intervals.h \
1135 $(BLD)/sysdep.$(O) : \
1138 $(EMACS_ROOT)/nt/inc/sys/param.h \
1139 $(EMACS_ROOT)/nt/inc/sys/file.h \
1140 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1141 $(EMACS_ROOT)/nt/inc/sys/file.h \
1143 $(SRC)/blockinput.h \
1145 $(SRC)/dispextern.h \
1150 $(SRC)/sysselect.h \
1151 $(SRC)/syssignal.h \
1156 $(SRC)/termhooks.h \
1162 $(BLD)/term.$(O) : \
1166 $(SRC)/character.h \
1170 $(SRC)/dispextern.h \
1176 $(SRC)/termhooks.h \
1182 $(BLD)/termcap.$(O) : \
1185 $(EMACS_ROOT)/nt/inc/sys/file.h
1187 $(BLD)/terminal.$(O) : \
1197 $(BLD)/textprop.$(O) : \
1201 $(SRC)/composite.h \
1202 $(SRC)/dispextern.h \
1203 $(SRC)/intervals.h \
1208 $(BLD)/tparam.$(O) : \
1212 $(BLD)/undo.$(O) : \
1218 $(BLD)/unexw32.$(O) : \
1223 $(BLD)/vm-limit.$(O) : \
1228 $(BLD)/window.$(O) : \
1232 $(SRC)/blockinput.h \
1235 $(SRC)/composite.h \
1236 $(SRC)/dispextern.h \
1240 $(SRC)/intervals.h \
1250 $(BLD)/xdisp.$(O) : \
1254 $(SRC)/blockinput.h \
1257 $(SRC)/character.h \
1261 $(SRC)/composite.h \
1262 $(SRC)/dispextern.h \
1268 $(SRC)/intervals.h \
1273 $(SRC)/region-cache.h \
1276 $(SRC)/termhooks.h \
1282 $(BLD)/xfaces.$(O): \
1286 $(SRC)/blockinput.h \
1288 $(SRC)/character.h \
1290 $(SRC)/composite.h \
1291 $(SRC)/dispextern.h \
1295 $(SRC)/intervals.h \
1299 $(SRC)/termhooks.h \
1305 $(BLD)/w32fns.$(O): \
1309 $(SRC)/blockinput.h \
1312 $(SRC)/character.h \
1315 $(SRC)/composite.h \
1316 $(SRC)/dispextern.h \
1321 $(SRC)/intervals.h \
1324 $(SRC)/termhooks.h \
1331 $(BLD)/w32menu.$(O): \
1335 $(SRC)/blockinput.h \
1337 $(SRC)/character.h \
1340 $(SRC)/dispextern.h \
1345 $(SRC)/termhooks.h \
1351 $(BLD)/w32term.$(O): \
1355 $(SRC)/blockinput.h \
1358 $(SRC)/character.h \
1361 $(SRC)/composite.h \
1362 $(SRC)/dispextern.h \
1367 $(SRC)/intervals.h \
1373 $(SRC)/termhooks.h \
1381 $(BLD)/w32select.$(O): \
1382 $(SRC)/w32select.c \
1385 $(SRC)/blockinput.h \
1388 $(SRC)/character.h \
1391 $(SRC)/composite.h \
1392 $(SRC)/dispextern.h \
1401 $(BLD)/w32reg.$(O): \
1405 $(SRC)/blockinput.h \
1411 $(BLD)/w32xfns.$(O): \
1415 $(SRC)/blockinput.h \
1416 $(SRC)/character.h \
1426 $(BLD)/w32bdf.$(O): \
1430 $(SRC)/blockinput.h \
1431 $(SRC)/character.h \
1433 $(SRC)/dispextern.h \
1442 $(BLD)/w32font.$(O): \
1445 $(SRC)/character.h \
1447 $(SRC)/dispextern.h \
1455 $(BLD)/w32uniscribe.$(O): \
1456 $(SRC)/w32uniscribe.c \
1458 $(SRC)/character.h \
1460 $(SRC)/dispextern.h \
1468 # Each object file depends on stamp_BLD, because in parallel builds we must
1469 # make sure $(BLD) exists before starting compilations.
1471 $(OBJ0) $(OBJ1) $(WIN32OBJ) $(FONTOBJ) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD