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
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 \
297 $(BLD)/alloc.$(O) : \
300 $(SRC)/blockinput.h \
305 $(SRC)/dispextern.h \
316 $(BLD)/atimer.$(O) : \
320 $(SRC)/blockinput.h \
324 $(BLD)/buffer.$(O) : \
327 $(EMACS_ROOT)/nt/inc/sys/param.h \
328 $(SRC)/blockinput.h \
333 $(SRC)/dispextern.h \
339 $(SRC)/region-cache.h \
344 $(BLD)/bytecode.$(O) : \
352 $(BLD)/callint.$(O) : \
357 $(SRC)/dispextern.h \
364 $(BLD)/callproc.$(O) : \
367 $(EMACS_ROOT)/nt/inc/sys/param.h \
368 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
369 $(EMACS_ROOT)/nt/inc/sys/file.h \
385 $(BLD)/casefiddle.$(O) : \
386 $(SRC)/casefiddle.c \
396 $(BLD)/casetab.$(O) : \
402 $(BLD)/category.$(O) : \
419 $(BLD)/character.$(O) : \
429 $(BLD)/charset.$(O) : \
440 $(BLD)/chartab.$(O) : \
459 $(SRC)/dispextern.h \
467 $(BLD)/coding.$(O) : \
476 $(SRC)/dispextern.h \
484 $(BLD)/composite.$(O) : \
491 $(SRC)/dispextern.h \
508 $(BLD)/dired.$(O) : \
521 $(BLD)/dispnew.$(O) : \
524 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
525 $(EMACS_ROOT)/nt/inc/sys/file.h \
527 $(SRC)/blockinput.h \
534 $(SRC)/dispextern.h \
554 $(EMACS_ROOT)/nt/inc/sys/file.h \
561 $(BLD)/doprnt.$(O) : \
567 $(BLD)/editfns.$(O) : \
570 $(EMACS_ROOT)/nt/inc/pwd.h \
577 $(SRC)/dispextern.h \
585 $(BLD)/emacs.$(O) : \
588 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
589 $(EMACS_ROOT)/nt/inc/sys/file.h \
591 $(SRC)/blockinput.h \
595 $(SRC)/dispextern.h \
613 $(SRC)/blockinput.h \
615 $(SRC)/dispextern.h \
621 $(BLD)/fileio.$(O) : \
624 $(EMACS_ROOT)/nt/inc/pwd.h \
625 $(EMACS_ROOT)/nt/inc/sys/param.h \
626 $(EMACS_ROOT)/nt/inc/sys/file.h \
634 $(SRC)/dispextern.h \
641 $(BLD)/filelock.$(O) : \
644 $(EMACS_ROOT)/nt/inc/pwd.h \
645 $(EMACS_ROOT)/nt/inc/sys/file.h \
646 $(EMACS_ROOT)/src/epaths.h \
654 $(BLD)/filemode.$(O) : \
658 $(BLD)/firstfile.$(O) : \
662 $(BLD)/floatfns.$(O) : \
670 $(EMACS_ROOT)/nt/inc/langinfo.h \
671 $(EMACS_ROOT)/nt/inc/nl_types.h \
673 $(SRC)/blockinput.h \
681 $(SRC)/dispextern.h \
696 $(SRC)/dispextern.h \
704 $(BLD)/fontset.$(O) : \
711 $(SRC)/dispextern.h \
721 $(BLD)/frame.$(O) : \
725 $(SRC)/blockinput.h \
730 $(SRC)/dispextern.h \
742 $(BLD)/fringe.$(O) : \
746 $(SRC)/blockinput.h \
748 $(SRC)/dispextern.h \
755 $(BLD)/gmalloc.$(O) : \
758 $(EMACS_ROOT)/nt/inc/sys/param.h \
765 $(SRC)/blockinput.h \
766 $(SRC)/dispextern.h \
777 $(BLD)/indent.$(O) : \
785 $(SRC)/dispextern.h \
791 $(SRC)/region-cache.h \
798 $(BLD)/insdel.$(O) : \
802 $(SRC)/blockinput.h \
807 $(SRC)/dispextern.h \
809 $(SRC)/region-cache.h \
815 $(BLD)/intervals.$(O) : \
820 $(SRC)/dispextern.h \
828 $(BLD)/keyboard.$(O) : \
831 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
832 $(EMACS_ROOT)/nt/inc/sys/file.h \
834 $(SRC)/blockinput.h \
840 $(SRC)/dispextern.h \
860 $(BLD)/keymap.$(O) : \
864 $(SRC)/blockinput.h \
870 $(SRC)/dispextern.h \
880 $(BLD)/lastfile.$(O) : \
884 $(BLD)/lread.$(O) : \
887 $(EMACS_ROOT)/nt/inc/sys/file.h \
888 $(EMACS_ROOT)/src/epaths.h \
889 $(SRC)/blockinput.h \
897 $(SRC)/dispextern.h \
904 $(BLD)/macros.$(O) : \
909 $(SRC)/dispextern.h \
916 $(BLD)/marker.$(O) : \
927 $(BLD)/minibuf.$(O) : \
935 $(SRC)/dispextern.h \
949 $(EMACS_ROOT)/nt/inc/pwd.h \
955 $(BLD)/w32heap.$(O) : \
960 $(BLD)/w32inevt.$(O) : \
964 $(SRC)/blockinput.h \
974 $(BLD)/w32proc.$(O) : \
977 $(EMACS_ROOT)/nt/inc/langinfo.h \
978 $(EMACS_ROOT)/nt/inc/nl_types.h \
990 $(BLD)/w32console.$(O) : \
991 $(SRC)/w32console.c \
997 $(SRC)/dispextern.h \
1000 $(SRC)/termhooks.h \
1005 $(BLD)/print.$(O) : \
1009 $(SRC)/character.h \
1011 $(SRC)/composite.h \
1012 $(SRC)/dispextern.h \
1014 $(SRC)/intervals.h \
1022 $(BLD)/process.$(O) : \
1025 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1026 $(EMACS_ROOT)/nt/inc/sys/file.h \
1028 $(SRC)/blockinput.h \
1031 $(SRC)/character.h \
1035 $(SRC)/composite.h \
1036 $(SRC)/dispextern.h \
1040 $(SRC)/sysselect.h \
1041 $(SRC)/syssignal.h \
1045 $(SRC)/termhooks.h \
1051 $(BLD)/ralloc.$(O) : \
1054 $(EMACS_ROOT)/nt/inc/sys/param.h \
1055 $(SRC)/getpagesize.h
1057 $(BLD)/regex.$(O) : \
1062 $(SRC)/character.h \
1067 $(BLD)/region-cache.$(O) : \
1068 $(SRC)/region-cache.c \
1071 $(SRC)/region-cache.h
1073 $(BLD)/scroll.$(O) : \
1076 $(SRC)/dispextern.h \
1080 $(SRC)/termhooks.h \
1085 $(BLD)/search.$(O) : \
1089 $(SRC)/blockinput.h \
1092 $(SRC)/character.h \
1095 $(SRC)/composite.h \
1096 $(SRC)/dispextern.h \
1097 $(SRC)/intervals.h \
1099 $(SRC)/region-cache.h \
1105 $(BLD)/sound.$(O) : \
1108 $(SRC)/dispextern.h \
1112 $(BLD)/strftime.$(O) : \
1116 $(BLD)/syntax.$(O) : \
1121 $(SRC)/character.h \
1124 $(SRC)/composite.h \
1125 $(SRC)/dispextern.h \
1126 $(SRC)/intervals.h \
1132 $(BLD)/sysdep.$(O) : \
1135 $(EMACS_ROOT)/nt/inc/sys/param.h \
1136 $(EMACS_ROOT)/nt/inc/sys/file.h \
1137 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1138 $(EMACS_ROOT)/nt/inc/sys/file.h \
1140 $(SRC)/blockinput.h \
1142 $(SRC)/dispextern.h \
1147 $(SRC)/sysselect.h \
1148 $(SRC)/syssignal.h \
1153 $(SRC)/termhooks.h \
1159 $(BLD)/term.$(O) : \
1163 $(SRC)/character.h \
1167 $(SRC)/dispextern.h \
1173 $(SRC)/termhooks.h \
1179 $(BLD)/termcap.$(O) : \
1182 $(EMACS_ROOT)/nt/inc/sys/file.h
1184 $(BLD)/terminal.$(O) : \
1194 $(BLD)/textprop.$(O) : \
1198 $(SRC)/composite.h \
1199 $(SRC)/dispextern.h \
1200 $(SRC)/intervals.h \
1205 $(BLD)/tparam.$(O) : \
1209 $(BLD)/undo.$(O) : \
1215 $(BLD)/unexw32.$(O) : \
1220 $(BLD)/vm-limit.$(O) : \
1225 $(BLD)/window.$(O) : \
1229 $(SRC)/blockinput.h \
1232 $(SRC)/composite.h \
1233 $(SRC)/dispextern.h \
1237 $(SRC)/intervals.h \
1247 $(BLD)/xdisp.$(O) : \
1251 $(SRC)/blockinput.h \
1254 $(SRC)/character.h \
1258 $(SRC)/composite.h \
1259 $(SRC)/dispextern.h \
1265 $(SRC)/intervals.h \
1270 $(SRC)/region-cache.h \
1273 $(SRC)/termhooks.h \
1279 $(BLD)/xfaces.$(O): \
1283 $(SRC)/blockinput.h \
1285 $(SRC)/character.h \
1287 $(SRC)/composite.h \
1288 $(SRC)/dispextern.h \
1292 $(SRC)/intervals.h \
1296 $(SRC)/termhooks.h \
1302 $(BLD)/w32fns.$(O): \
1306 $(SRC)/blockinput.h \
1309 $(SRC)/character.h \
1312 $(SRC)/composite.h \
1313 $(SRC)/dispextern.h \
1318 $(SRC)/intervals.h \
1321 $(SRC)/termhooks.h \
1328 $(BLD)/w32menu.$(O): \
1332 $(SRC)/blockinput.h \
1334 $(SRC)/character.h \
1337 $(SRC)/dispextern.h \
1342 $(SRC)/termhooks.h \
1348 $(BLD)/w32term.$(O): \
1352 $(SRC)/blockinput.h \
1355 $(SRC)/character.h \
1358 $(SRC)/composite.h \
1359 $(SRC)/dispextern.h \
1364 $(SRC)/intervals.h \
1370 $(SRC)/termhooks.h \
1378 $(BLD)/w32select.$(O): \
1379 $(SRC)/w32select.c \
1382 $(SRC)/blockinput.h \
1385 $(SRC)/character.h \
1388 $(SRC)/composite.h \
1389 $(SRC)/dispextern.h \
1398 $(BLD)/w32reg.$(O): \
1402 $(SRC)/blockinput.h \
1408 $(BLD)/w32xfns.$(O): \
1412 $(SRC)/blockinput.h \
1413 $(SRC)/character.h \
1423 $(BLD)/w32bdf.$(O): \
1427 $(SRC)/blockinput.h \
1428 $(SRC)/character.h \
1430 $(SRC)/dispextern.h \
1439 $(BLD)/w32font.$(O): \
1442 $(SRC)/character.h \
1444 $(SRC)/dispextern.h \
1452 $(BLD)/w32uniscribe.$(O): \
1453 $(SRC)/w32uniscribe.c \
1455 $(SRC)/character.h \
1457 $(SRC)/dispextern.h \
1465 # Each object file depends on stamp_BLD, because in parallel builds we must
1466 # make sure $(BLD) exists before starting compilations.
1468 $(OBJ0) $(OBJ1) $(WIN32OBJ) $(FONTOBJ) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD