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 -DWINDOWSNT -DDOS_NT -DHAVE_CONFIG_H -I../nt/inc -D_UCHAR_T -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) \
130 WIN32OBJ = $(BLD)/w32term.$(O) \
131 $(BLD)/w32xfns.$(O) \
134 $(BLD)/w32select.$(O) \
135 $(BLD)/w32menu.$(O) \
139 FONTOBJ = $(BLD)/w32font.$(O) $(BLD)/w32uniscribe.$(O)
159 # Build the executable and dump it.
164 # The dumped executable
166 emacs: stamp_BLD $(EMACS)
167 $(EMACS): $(DOC) $(TEMACS)
168 "$(THISDIR)/$(BLD)/temacs.exe" -batch -l loadup dump
169 -"$(THISDIR)/$(BLD)/emacs.exe" -q -batch -f list-load-path-shadows
172 # The undumped executable
173 # Note the extra post-link step to insert a static preload heap section.
174 # If preload runs out of memory, increase the last argument to addsection
175 # (it is the preload heap size in MB).
177 temacs: stamp_BLD $(TEMACS)
178 $(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) \
179 ../nt/$(BLD)/addsection.exe
180 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
181 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21
182 echo $(OBJ0) > $(BLD)/buildobj.lst
183 echo $(OBJ1) >> $(BLD)/buildobj.lst
184 echo $(WIN32OBJ) >> $(BLD)/buildobj.lst
185 echo $(FONTOBJ) >> $(BLD)/buildobj.lst
187 bootstrap: bootstrap-emacs
190 # Build a temacs with a sufficiently large PURESIZE to load the
191 # Lisp files from loadup.el in source form.
193 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
194 # this can break with GNU Make 3.81 and later if sh.exe is used.
196 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(CFLAGS) -DPURESIZE=5000000$(ARGQUOTE)
199 # Dump an Emacs executable named bootstrap-emacs containing the
200 # files from loadup.el in source form.
202 bootstrap-emacs: bootstrap-temacs
203 "$(THISDIR)/$(BLD)/temacs.exe" -batch -l loadup bootstrap
205 $(CP) $(EMACS) ../bin
208 # Force recompile of files that depend on PURESIZE
211 - $(DEL) $(BLD)/alloc.$(O)
212 - $(DEL) $(BLD)/data.$(O)
213 - $(DEL) $(BLD)/intervals.$(O)
214 - $(DEL) $(BLD)/keyboard.$(O)
215 - $(DEL) $(BLD)/keymap.$(O)
218 # The resource file. NT 3.10 requires the use of cvtres; even though
219 # it is not necessary on later versions, it is still ok to use it.
221 $(TRES): ../nt/emacs.rc stamp_BLD
222 $(RC) $(RC_INCLUDE)../nt $(RC_OUT)$@ ../nt/emacs.rc
225 # Build the library. Split up the build into two phases...otherwise we
226 # run out of command line space.
230 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
233 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
234 $(TLIBW32): $(WIN32OBJ) $(FONTOBJ)
236 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
239 # Place lastfile.$(O) in its own library so that it can be loaded after
240 # the source libraries but before any system libraries. Doing so defines
241 # the end of Emacs' data section portably across compilers and systems.
243 $(TLASTLIB): $(BLD)/lastfile.$(O)
245 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
248 # Assuming INSTALL_DIR is defined, build and install emacs in it.
251 - mkdir "$(INSTALL_DIR)/bin"
252 $(CP) $(EMACS) $(INSTALL_DIR)/bin
257 # We used to delete *~, s/*~, m/*~ here, but that might inadvertently
258 # remove precious files if it happens to match their short 8+3 aliases.
260 - $(DEL) "s/*.h~" "m/*.h~"
261 - $(DEL) $(COMPILER_TEMP_FILES)
262 - $(DEL_TREE) $(OBJDIR)
266 - $(DEL) config.h epaths.h Makefile
268 maintainer-clean: distclean
273 - $(DEL_TREE) obj-spd
281 CONFIG_H = $(EMACS_ROOT)/src/s/ms-w32.h \
282 $(EMACS_ROOT)/src/m/intel386.h \
283 $(EMACS_ROOT)/src/config.h
285 $(BLD)/abbrev.$(O) : \
292 $(SRC)/dispextern.h \
298 $(BLD)/alloc.$(O) : \
301 $(SRC)/blockinput.h \
306 $(SRC)/dispextern.h \
317 $(BLD)/atimer.$(O) : \
321 $(SRC)/blockinput.h \
325 $(BLD)/buffer.$(O) : \
328 $(EMACS_ROOT)/nt/inc/sys/param.h \
329 $(SRC)/blockinput.h \
334 $(SRC)/dispextern.h \
340 $(SRC)/region-cache.h \
345 $(BLD)/bytecode.$(O) : \
353 $(BLD)/callint.$(O) : \
358 $(SRC)/dispextern.h \
365 $(BLD)/callproc.$(O) : \
368 $(EMACS_ROOT)/nt/inc/sys/param.h \
369 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
370 $(EMACS_ROOT)/nt/inc/sys/file.h \
386 $(BLD)/casefiddle.$(O) : \
387 $(SRC)/casefiddle.c \
397 $(BLD)/casetab.$(O) : \
403 $(BLD)/category.$(O) : \
420 $(BLD)/character.$(O) : \
430 $(BLD)/charset.$(O) : \
441 $(BLD)/chartab.$(O) : \
460 $(SRC)/dispextern.h \
468 $(BLD)/coding.$(O) : \
477 $(SRC)/dispextern.h \
485 $(BLD)/composite.$(O) : \
492 $(SRC)/dispextern.h \
509 $(BLD)/dired.$(O) : \
522 $(BLD)/dispnew.$(O) : \
525 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
526 $(EMACS_ROOT)/nt/inc/sys/file.h \
528 $(SRC)/blockinput.h \
535 $(SRC)/dispextern.h \
555 $(EMACS_ROOT)/nt/inc/sys/file.h \
562 $(BLD)/doprnt.$(O) : \
568 $(BLD)/editfns.$(O) : \
571 $(EMACS_ROOT)/nt/inc/pwd.h \
578 $(SRC)/dispextern.h \
586 $(BLD)/emacs.$(O) : \
589 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
590 $(EMACS_ROOT)/nt/inc/sys/file.h \
592 $(SRC)/blockinput.h \
596 $(SRC)/dispextern.h \
614 $(SRC)/blockinput.h \
616 $(SRC)/dispextern.h \
622 $(BLD)/fileio.$(O) : \
625 $(EMACS_ROOT)/nt/inc/pwd.h \
626 $(EMACS_ROOT)/nt/inc/sys/param.h \
627 $(EMACS_ROOT)/nt/inc/sys/file.h \
635 $(SRC)/dispextern.h \
642 $(BLD)/filelock.$(O) : \
645 $(EMACS_ROOT)/nt/inc/pwd.h \
646 $(EMACS_ROOT)/nt/inc/sys/file.h \
647 $(EMACS_ROOT)/src/epaths.h \
655 $(BLD)/filemode.$(O) : \
659 $(BLD)/firstfile.$(O) : \
663 $(BLD)/floatfns.$(O) : \
671 $(EMACS_ROOT)/nt/inc/langinfo.h \
672 $(EMACS_ROOT)/nt/inc/nl_types.h \
674 $(SRC)/blockinput.h \
682 $(SRC)/dispextern.h \
697 $(SRC)/dispextern.h \
705 $(BLD)/fontset.$(O) : \
712 $(SRC)/dispextern.h \
722 $(BLD)/frame.$(O) : \
726 $(SRC)/blockinput.h \
731 $(SRC)/dispextern.h \
743 $(BLD)/fringe.$(O) : \
747 $(SRC)/blockinput.h \
749 $(SRC)/dispextern.h \
756 $(BLD)/gmalloc.$(O) : \
759 $(EMACS_ROOT)/nt/inc/sys/param.h \
766 $(SRC)/blockinput.h \
767 $(SRC)/dispextern.h \
778 $(BLD)/indent.$(O) : \
786 $(SRC)/dispextern.h \
792 $(SRC)/region-cache.h \
799 $(BLD)/insdel.$(O) : \
803 $(SRC)/blockinput.h \
808 $(SRC)/dispextern.h \
810 $(SRC)/region-cache.h \
816 $(BLD)/intervals.$(O) : \
821 $(SRC)/dispextern.h \
829 $(BLD)/keyboard.$(O) : \
832 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
833 $(EMACS_ROOT)/nt/inc/sys/file.h \
835 $(SRC)/blockinput.h \
841 $(SRC)/dispextern.h \
861 $(BLD)/keymap.$(O) : \
865 $(SRC)/blockinput.h \
871 $(SRC)/dispextern.h \
881 $(BLD)/lastfile.$(O) : \
885 $(BLD)/lread.$(O) : \
888 $(EMACS_ROOT)/nt/inc/sys/file.h \
889 $(EMACS_ROOT)/src/epaths.h \
890 $(SRC)/blockinput.h \
898 $(SRC)/dispextern.h \
905 $(BLD)/macros.$(O) : \
910 $(SRC)/dispextern.h \
917 $(BLD)/marker.$(O) : \
928 $(BLD)/minibuf.$(O) : \
936 $(SRC)/dispextern.h \
950 $(EMACS_ROOT)/nt/inc/pwd.h \
956 $(BLD)/w32heap.$(O) : \
961 $(BLD)/w32inevt.$(O) : \
965 $(SRC)/blockinput.h \
975 $(BLD)/w32proc.$(O) : \
978 $(EMACS_ROOT)/nt/inc/langinfo.h \
979 $(EMACS_ROOT)/nt/inc/nl_types.h \
991 $(BLD)/w32console.$(O) : \
992 $(SRC)/w32console.c \
998 $(SRC)/dispextern.h \
1001 $(SRC)/termhooks.h \
1006 $(BLD)/print.$(O) : \
1010 $(SRC)/character.h \
1012 $(SRC)/composite.h \
1013 $(SRC)/dispextern.h \
1015 $(SRC)/intervals.h \
1023 $(BLD)/process.$(O) : \
1026 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1027 $(EMACS_ROOT)/nt/inc/sys/file.h \
1029 $(SRC)/blockinput.h \
1032 $(SRC)/character.h \
1036 $(SRC)/composite.h \
1037 $(SRC)/dispextern.h \
1041 $(SRC)/sysselect.h \
1042 $(SRC)/syssignal.h \
1046 $(SRC)/termhooks.h \
1052 $(BLD)/ralloc.$(O) : \
1055 $(EMACS_ROOT)/nt/inc/sys/param.h \
1056 $(SRC)/getpagesize.h
1058 $(BLD)/regex.$(O) : \
1063 $(SRC)/character.h \
1068 $(BLD)/region-cache.$(O) : \
1069 $(SRC)/region-cache.c \
1072 $(SRC)/region-cache.h
1074 $(BLD)/scroll.$(O) : \
1077 $(SRC)/dispextern.h \
1081 $(SRC)/termhooks.h \
1086 $(BLD)/search.$(O) : \
1090 $(SRC)/blockinput.h \
1093 $(SRC)/character.h \
1096 $(SRC)/composite.h \
1097 $(SRC)/dispextern.h \
1098 $(SRC)/intervals.h \
1100 $(SRC)/region-cache.h \
1106 $(BLD)/sound.$(O) : \
1109 $(SRC)/dispextern.h \
1113 $(BLD)/strftime.$(O) : \
1117 $(BLD)/syntax.$(O) : \
1122 $(SRC)/character.h \
1125 $(SRC)/composite.h \
1126 $(SRC)/dispextern.h \
1127 $(SRC)/intervals.h \
1133 $(BLD)/sysdep.$(O) : \
1136 $(EMACS_ROOT)/nt/inc/sys/param.h \
1137 $(EMACS_ROOT)/nt/inc/sys/file.h \
1138 $(EMACS_ROOT)/nt/inc/sys/ioctl.h \
1139 $(EMACS_ROOT)/nt/inc/sys/file.h \
1141 $(SRC)/blockinput.h \
1143 $(SRC)/dispextern.h \
1148 $(SRC)/sysselect.h \
1149 $(SRC)/syssignal.h \
1154 $(SRC)/termhooks.h \
1160 $(BLD)/term.$(O) : \
1164 $(SRC)/character.h \
1168 $(SRC)/dispextern.h \
1174 $(SRC)/termhooks.h \
1180 $(BLD)/termcap.$(O) : \
1183 $(EMACS_ROOT)/nt/inc/sys/file.h
1185 $(BLD)/terminal.$(O) : \
1195 $(BLD)/textprop.$(O) : \
1199 $(SRC)/composite.h \
1200 $(SRC)/dispextern.h \
1201 $(SRC)/intervals.h \
1206 $(BLD)/tparam.$(O) : \
1210 $(BLD)/undo.$(O) : \
1216 $(BLD)/unexw32.$(O) : \
1221 $(BLD)/vm-limit.$(O) : \
1226 $(BLD)/window.$(O) : \
1230 $(SRC)/blockinput.h \
1233 $(SRC)/composite.h \
1234 $(SRC)/dispextern.h \
1238 $(SRC)/intervals.h \
1248 $(BLD)/xdisp.$(O) : \
1252 $(SRC)/blockinput.h \
1255 $(SRC)/character.h \
1259 $(SRC)/composite.h \
1260 $(SRC)/dispextern.h \
1266 $(SRC)/intervals.h \
1271 $(SRC)/region-cache.h \
1274 $(SRC)/termhooks.h \
1280 $(BLD)/xfaces.$(O): \
1284 $(SRC)/blockinput.h \
1286 $(SRC)/character.h \
1288 $(SRC)/composite.h \
1289 $(SRC)/dispextern.h \
1293 $(SRC)/intervals.h \
1297 $(SRC)/termhooks.h \
1303 $(BLD)/w32fns.$(O): \
1307 $(SRC)/blockinput.h \
1310 $(SRC)/character.h \
1313 $(SRC)/composite.h \
1314 $(SRC)/dispextern.h \
1319 $(SRC)/intervals.h \
1322 $(SRC)/termhooks.h \
1329 $(BLD)/w32menu.$(O): \
1333 $(SRC)/blockinput.h \
1335 $(SRC)/character.h \
1338 $(SRC)/dispextern.h \
1343 $(SRC)/termhooks.h \
1349 $(BLD)/w32term.$(O): \
1353 $(SRC)/blockinput.h \
1356 $(SRC)/character.h \
1359 $(SRC)/composite.h \
1360 $(SRC)/dispextern.h \
1365 $(SRC)/intervals.h \
1371 $(SRC)/termhooks.h \
1379 $(BLD)/w32select.$(O): \
1380 $(SRC)/w32select.c \
1383 $(SRC)/blockinput.h \
1386 $(SRC)/character.h \
1389 $(SRC)/composite.h \
1390 $(SRC)/dispextern.h \
1399 $(BLD)/w32reg.$(O): \
1403 $(SRC)/blockinput.h \
1409 $(BLD)/w32xfns.$(O): \
1413 $(SRC)/blockinput.h \
1414 $(SRC)/character.h \
1424 $(BLD)/w32bdf.$(O): \
1428 $(SRC)/blockinput.h \
1429 $(SRC)/character.h \
1431 $(SRC)/dispextern.h \
1440 $(BLD)/w32font.$(O): \
1443 $(SRC)/character.h \
1445 $(SRC)/dispextern.h \
1453 $(BLD)/w32uniscribe.$(O): \
1454 $(SRC)/w32uniscribe.c \
1456 $(SRC)/character.h \
1458 $(SRC)/dispextern.h \
1466 # Each object file depends on stamp_BLD, because in parallel builds we must
1467 # make sure $(BLD) exists before starting compilations.
1469 $(OBJ0) $(OBJ1) $(WIN32OBJ) $(FONTOBJ) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD