1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2000-2011 Free Software Foundation, Inc.
4 # This file is part of GNU Emacs.
6 # GNU Emacs is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # GNU Emacs is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24 # Set EMACSLOADPATH correctly (in case already defined in environment).
25 EMACSLOADPATH=$(CURDIR)/../lisp
27 # Size in MBs of the static heap in temacs.exe.
31 # HAVE_CONFIG_H is required by some generic gnu sources stuck into
32 # the emacs source tree.
34 LOCAL_FLAGS = -Demacs=1 -DHAVE_CONFIG_H -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS)
37 EMACS = $(BLD)/emacs.exe
38 TEMACS = $(BLD)/temacs.exe
39 TEMACS_TMP = $(BLD)/temacs.bin
40 TLIB0 = $(BLD)/temacs0.$(A)
41 TLIB1 = $(BLD)/temacs1.$(A)
42 TLIB2 = $(BLD)/temacs2.$(A)
43 TOBJ = $(BLD)/firstfile.$(O)
44 TRES = $(BLD)/emacs.res
45 TLASTLIB = $(BLD)/lastfile.$(A)
46 GNULIB = ../lib/$(BLD)/libgnu.$(A)
48 DOC = $(OBJDIR)/etc/DOC-X
50 FULL_LINK_FLAGS = $(LINK_FLAGS) $(TEMACS_EXTRA_LINK)
53 # Split up the objects into two sets so that we don't run out of
54 # command line space when we link them into a library.
56 # Put emacs.$(O) in a separate lib, since we need to have firstfile.$(O)
57 # as the "main" object file when linking.
59 OBJ0 = $(BLD)/emacs.$(O)
61 OBJ1 = $(BLD)/alloc.$(O) \
64 $(BLD)/bytecode.$(O) \
66 $(BLD)/callproc.$(O) \
67 $(BLD)/casefiddle.$(O) \
77 $(BLD)/filelock.$(O) \
81 $(BLD)/keyboard.$(O) \
89 $(BLD)/w32inevt.$(O) \
91 $(BLD)/w32console.$(O) \
100 OBJ2 = $(BLD)/sysdep.$(O) \
104 $(BLD)/unexw32.$(O) \
107 $(BLD)/casetab.$(O) \
108 $(BLD)/floatfns.$(O) \
110 $(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) \
119 $(BLD)/charset.$(O) \
120 $(BLD)/character.$(O) \
121 $(BLD)/chartab.$(O) \
123 $(BLD)/category.$(O) \
126 $(BLD)/fontset.$(O) \
129 $(BLD)/terminal.$(O) \
131 $(BLD)/w32term.$(O) \
132 $(BLD)/w32xfns.$(O) \
135 $(BLD)/w32select.$(O) \
136 $(BLD)/w32menu.$(O) \
138 $(BLD)/w32font.$(O) \
139 $(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" -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) $(TLIB2) $(TLASTLIB) $(TOBJ) $(TRES) \
181 ../nt/$(BLD)/addsection.exe $(GNULIB)
182 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
183 "$(THISDIR)/../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP $(HEAPSIZE)
185 # These omit firstfile.${O}, but there's no documentation in there
187 buildobj.h: $(SRC)/makefile.w32-in
188 $(MAKE) $(MFLAGS) make-buildobj-$(SHELLTYPE)
190 # Cannot have blanks between the backslash and the redirection
191 # characters, because CMD's `echo' will put them in buildobj.h.
193 echo #define BUILDOBJ ^"\> buildobj.h
194 echo $(OBJ0) \>> buildobj.h
195 echo $(OBJ1) \>> buildobj.h
196 echo $(OBJ2) \>> buildobj.h
200 # The above line is here to countermand the single quote
201 # on the last "echo" command above, wrt font-lock.
203 echo '#define BUILDOBJ $(DQUOTE)\' > buildobj.h
204 echo $(OBJ0) '\' >> buildobj.h
205 echo $(OBJ1) '\' >> buildobj.h
206 echo $(OBJ2) '\' >> buildobj.h
207 echo '$(DQUOTE)' >> buildobj.h
209 GLOBAL_SOURCES = dosfns.c msdos.c \
210 xterm.c xfns.c xmenu.c xselect.c xrdb.c xsmfns.c fringe.c image.c \
211 fontset.c menu.c dbusbind.c \
212 w32.c w32console.c w32fns.c w32heap.c w32inevt.c \
213 w32menu.c w32proc.c w32reg.c w32select.c w32term.c w32xfns.c \
214 font.c w32font.c w32uniscribe.c \
215 dispnew.c frame.c scroll.c xdisp.c window.c bidi.c \
216 charset.c coding.c category.c ccl.c character.c chartab.c \
217 cm.c term.c terminal.c xfaces.c \
218 emacs.c keyboard.c macros.c keymap.c sysdep.c \
219 buffer.c filelock.c insdel.c marker.c \
220 minibuf.c fileio.c dired.c \
221 cmds.c casetab.c casefiddle.c indent.c search.c regex.c undo.c \
222 alloc.c data.c doc.c editfns.c callint.c \
223 eval.c floatfns.c fns.c print.c lread.c \
224 syntax.c bytecode.c \
225 process.c callproc.c unexw32.c \
226 region-cache.c sound.c atimer.c \
227 doprnt.c intervals.c textprop.c composite.c \
229 SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
230 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o
231 obj = $(GLOBAL_SOURCES:.c=.o)
236 gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES)
238 "$(THISDIR)/../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
239 cmd /c "fc /b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h"
243 bootstrap: bootstrap-emacs
246 # Build a temacs with a sufficiently large PURESIZE to load the
247 # Lisp files from loadup.el in source form.
249 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
250 # this can break with GNU Make 3.81 and later if sh.exe is used.
251 bootstrap-temacs-CMD:
252 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(ESC_CFLAGS) -DPURESIZE=5000000$(ARGQUOTE)
255 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(CFLAGS) -DPURESIZE=5000000$(ARGQUOTE)
258 $(MAKE) $(MFLAGS) bootstrap-temacs-$(SHELLTYPE)
261 # Dump an Emacs executable named bootstrap-emacs containing the
262 # files from loadup.el in source form.
264 bootstrap-emacs: bootstrap-temacs
265 "$(THISDIR)/$(BLD)/temacs.exe" -batch -l loadup bootstrap
267 $(CP) $(EMACS) ../bin
270 # Force recompile of files that depend on PURESIZE
273 - $(DEL) $(BLD)/alloc.$(O)
274 - $(DEL) $(BLD)/data.$(O)
275 - $(DEL) $(BLD)/intervals.$(O)
276 - $(DEL) $(BLD)/keyboard.$(O)
277 - $(DEL) $(BLD)/keymap.$(O)
280 # The resource file. NT 3.10 requires the use of cvtres; even though
281 # it is not necessary on later versions, it is still ok to use it.
283 $(TRES): ../nt/emacs.rc stamp_BLD
284 $(RC) $(RC_INCLUDE)../nt $(RC_OUT)$@ ../nt/emacs.rc
287 # Build the library. Split up the build into two phases...otherwise we
288 # run out of command line space.
292 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
295 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
298 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
301 # Place lastfile.$(O) in its own library so that it can be loaded after
302 # the source libraries but before any system libraries. Doing so defines
303 # the end of Emacs' data section portably across compilers and systems.
305 $(TLASTLIB): $(BLD)/lastfile.$(O)
307 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
310 # Assuming INSTALL_DIR is defined, build and install emacs in it.
313 - mkdir "$(INSTALL_DIR)/bin"
314 $(CP) $(EMACS) $(INSTALL_DIR)/bin
319 # We used to delete *~, s/*~, m/*~ here, but that might inadvertently
320 # remove precious files if it happens to match their short 8+3 aliases.
322 - $(DEL) "s/*.h~" "m/*.h~"
323 - $(DEL) $(COMPILER_TEMP_FILES)
324 - $(DEL_TREE) $(OBJDIR)
325 - $(DEL) stamp_BLD gl-stamp globals.h
329 - $(DEL) config.h epaths.h Makefile
331 maintainer-clean: distclean
336 - $(DEL_TREE) obj-spd
340 ## Arrange to make a tags table TAGS-LISP for ../lisp,
341 ## plus TAGS for the C files, which includes ../lisp/TAGS by reference.
343 ## This works only with GNU Make.
345 TAGS: $(OBJ0) $(OBJ1) $(OBJ2) $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h
346 $(MAKE) $(MFLAGS) TAGS-$(MAKETYPE)
348 TAGS-LISP: $(OBJ0) $(OBJ1) $(OBJ2)
349 $(MAKE) $(MFLAGS) TAGS-LISP-$(MAKETYPE)
352 ../lib-src/$(BLD)/etags.exe --include=TAGS-LISP --include=../nt/TAGS \
353 --regex=@../nt/emacs-src.tags \
355 ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
357 ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
359 $(CURDIR)/*.h $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h
362 echo This target is not supported with NMake
367 $(MAKE) $(MFLAGS) -C ../lisp TAGS-LISP DEST=../src
370 echo This target is not supported with NMake
374 $(MAKE) $(MFLAGS) nt-TAGS-$(MAKETYPE)
377 $(MAKE) $(MFLAGS) -C ../nt TAGS
380 echo This target is not supported with NMake
383 full-tags: TAGS TAGS-LISP ../nt/TAGS
389 GNU_LIB = $(EMACS_ROOT)/lib
390 NT_INC = $(EMACS_ROOT)/nt/inc
392 SYSTIME_H = $(SRC)/systime.h \
394 ATIMER_H = $(SRC)/atimer.h \
396 BLOCKINPUT_H = $(SRC)/blockinput.h \
398 CAREADLINKAT_H = $(GNU_LIB)/careadlinkat.h \
400 CHARACTER_H = $(SRC)/character.h \
402 CHARSET_H = $(SRC)/charset.h \
404 CODING_H = $(SRC)/coding.h \
406 MS_W32_H = $(SRC)/s/ms-w32.h \
408 CONFIG_H = $(SRC)/config.h \
409 $(SRC)/m/intel386.h \
411 DIR_H = $(NT_INC)/sys/dir.h \
413 W32GUI_H = $(SRC)/w32gui.h \
415 DISPEXTERN_H = $(SRC)/dispextern.h \
417 FILEMODE_H = $(GNU_LIB)/filemode.h \
419 FONT_H = $(SRC)/font.h \
421 FRAME_H = $(SRC)/frame.h \
423 FTOASTR_H = $(GNU_LIB)/ftoastr.h \
424 $(GNU_LIB)/intprops.h
425 GRP_H = $(NT_INC)/grp.h \
427 INTERVALS_H = $(SRC)/intervals.h \
430 INTTYPES_H = $(NT_INC)/inttypes.h \
432 KEYBOARD_H = $(SRC)/keyboard.h \
435 LANGINFO_H = $(NT_INC)/langinfo.h \
437 LISP_H = $(SRC)/lisp.h \
439 $(GNU_LIB)/intprops.h \
441 MD5_H = $(GNU_LIB)/md5.h \
443 MENU_H = $(SRC)/menu.h \
445 PROCESS_H = $(SRC)/process.h \
448 SHA1_H = $(GNU_LIB)/sha1.h \
450 SHA256_H = $(GNU_LIB)/sha256.h \
452 U64_H = $(GNU_LIB)/u64.h \
454 SHA512_H = $(GNU_LIB)/sha512.h \
456 SOCKET_H = $(NT_INC)/sys/socket.h \
458 SYSTTY_H = $(SRC)/systty.h \
459 $(NT_INC)/sys/ioctl.h \
461 TERMHOOKS_H = $(SRC)/termhooks.h \
463 W32TERM_H = $(SRC)/w32term.h \
465 WINDOW_H = $(SRC)/window.h \
468 $(BLD)/alloc.$(O) : \
475 $(GNU_LIB)/verify.h \
487 $(BLD)/atimer.$(O) : \
490 $(NT_INC)/sys/time.h \
506 $(BLD)/buffer.$(O) : \
512 $(SRC)/region-cache.h \
513 $(NT_INC)/sys/param.h \
514 $(NT_INC)/sys/stat.h \
516 $(GNU_LIB)/verify.h \
526 $(BLD)/bytecode.$(O) : \
535 $(BLD)/callint.$(O) : \
546 $(BLD)/callproc.$(O) : \
555 $(NT_INC)/sys/file.h \
567 $(BLD)/casefiddle.$(O) : \
568 $(SRC)/casefiddle.c \
578 $(BLD)/casetab.$(O) : \
585 $(BLD)/category.$(O) : \
604 $(BLD)/character.$(O) : \
609 $(GNU_LIB)/intprops.h \
615 $(BLD)/charset.$(O) : \
626 $(BLD)/chartab.$(O) : \
648 $(BLD)/coding.$(O) : \
662 $(BLD)/composite.$(O) : \
681 $(GNU_LIB)/intprops.h \
690 $(BLD)/dired.$(O) : \
696 $(NT_INC)/sys/stat.h \
709 $(BLD)/dispnew.$(O) : \
739 $(NT_INC)/sys/file.h \
746 $(BLD)/doprnt.$(O) : \
753 $(BLD)/editfns.$(O) : \
758 $(GNU_LIB)/intprops.h \
759 $(GNU_LIB)/strftime.h \
760 $(GNU_LIB)/verify.h \
771 $(BLD)/emacs.$(O) : \
781 $(NT_INC)/sys/file.h \
804 $(BLD)/fileio.$(O) : \
809 $(NT_INC)/sys/stat.h \
822 $(BLD)/filelock.$(O) : \
826 $(NT_INC)/sys/file.h \
827 $(NT_INC)/sys/stat.h \
835 $(BLD)/firstfile.$(O) : \
839 $(BLD)/floatfns.$(O) : \
851 $(GNU_LIB)/intprops.h \
882 $(BLD)/fontset.$(O) : \
901 $(BLD)/frame.$(O) : \
919 $(BLD)/fringe.$(O) : \
930 $(BLD)/gmalloc.$(O) : \
932 $(SRC)/getpagesize.h \
936 $(BLD)/gnutls.$(O) : \
943 $(BLD)/image.$(O) : \
961 $(BLD)/indent.$(O) : \
968 $(SRC)/region-cache.h \
980 $(BLD)/insdel.$(O) : \
983 $(SRC)/region-cache.h \
984 $(GNU_LIB)/intprops.h \
992 $(BLD)/intervals.$(O) : \
997 $(GNU_LIB)/intprops.h \
1003 $(BLD)/keyboard.$(O) : \
1012 $(SRC)/syssignal.h \
1015 $(NT_INC)/sys/ioctl.h \
1016 $(NT_INC)/unistd.h \
1032 $(BLD)/keymap.$(O) : \
1049 $(BLD)/lastfile.$(O) : \
1053 $(BLD)/lread.$(O) : \
1058 $(NT_INC)/sys/file.h \
1059 $(NT_INC)/sys/stat.h \
1060 $(NT_INC)/unistd.h \
1072 $(BLD)/macros.$(O) : \
1082 $(BLD)/marker.$(O) : \
1089 $(BLD)/menu.$(O) : \
1103 $(BLD)/minibuf.$(O) : \
1124 $(NT_INC)/sys/file.h \
1125 $(NT_INC)/sys/time.h \
1126 $(GNU_LIB)/allocator.h \
1137 $(BLD)/w32heap.$(O) : \
1143 $(BLD)/w32inevt.$(O) : \
1155 $(BLD)/w32proc.$(O) : \
1157 $(SRC)/syssignal.h \
1161 $(NT_INC)/nl_types.h \
1162 $(NT_INC)/sys/file.h \
1172 $(BLD)/w32console.$(O) : \
1173 $(SRC)/w32console.c \
1185 $(BLD)/print.$(O) : \
1204 $(BLD)/process.$(O) : \
1208 $(SRC)/composite.h \
1210 $(SRC)/sysselect.h \
1211 $(SRC)/syssignal.h \
1214 $(NT_INC)/arpa/inet.h \
1216 $(NT_INC)/netinet/in.h \
1217 $(NT_INC)/sys/file.h \
1218 $(NT_INC)/sys/ioctl.h \
1219 $(NT_INC)/sys/stat.h \
1220 $(NT_INC)/unistd.h \
1237 $(BLD)/ralloc.$(O) : \
1239 $(SRC)/getpagesize.h \
1240 $(NT_INC)/unistd.h \
1245 $(BLD)/regex.$(O) : \
1251 $(NT_INC)/unistd.h \
1256 $(BLD)/region-cache.$(O) : \
1257 $(SRC)/region-cache.c \
1259 $(SRC)/region-cache.h \
1263 $(BLD)/scroll.$(O) : \
1274 $(BLD)/search.$(O) : \
1280 $(SRC)/region-cache.h \
1289 $(BLD)/sound.$(O) : \
1291 $(SRC)/syssignal.h \
1292 $(NT_INC)/unistd.h \
1298 $(BLD)/syntax.$(O) : \
1311 $(BLD)/sysdep.$(O) : \
1314 $(SRC)/sysselect.h \
1315 $(SRC)/syssignal.h \
1321 $(NT_INC)/sys/file.h \
1322 $(NT_INC)/sys/stat.h \
1323 $(NT_INC)/unistd.h \
1324 $(GNU_LIB)/allocator.h \
1325 $(GNU_LIB)/ignore-value.h \
1341 $(BLD)/term.$(O) : \
1345 $(SRC)/composite.h \
1348 $(SRC)/syssignal.h \
1352 $(NT_INC)/sys/file.h \
1353 $(NT_INC)/unistd.h \
1368 $(BLD)/terminal.$(O) : \
1379 $(BLD)/textprop.$(O) : \
1387 $(BLD)/tparam.$(O) : \
1393 $(BLD)/undo.$(O) : \
1401 $(BLD)/unexw32.$(O) : \
1407 $(BLD)/vm-limit.$(O) : \
1409 $(SRC)/mem-limits.h \
1413 $(BLD)/window.$(O) : \
1432 $(BLD)/xdisp.$(O) : \
1441 $(SRC)/region-cache.h \
1460 $(BLD)/xfaces.$(O) : \
1465 $(NT_INC)/sys/stat.h \
1480 $(BLD)/w32fns.$(O) : \
1505 $(BLD)/w32menu.$(O) : \
1522 $(BLD)/w32term.$(O) : \
1533 $(NT_INC)/sys/stat.h \
1553 $(BLD)/w32select.$(O) : \
1554 $(SRC)/w32select.c \
1555 $(SRC)/composite.h \
1564 $(BLD)/w32reg.$(O) : \
1571 $(BLD)/w32xfns.$(O) : \
1582 $(BLD)/w32font.$(O) : \
1596 $(BLD)/w32uniscribe.$(O) : \
1597 $(SRC)/w32uniscribe.c \
1598 $(SRC)/composite.h \
1610 # Each object file depends on stamp_BLD, because in parallel builds we must
1611 # make sure $(BLD) exists before starting compilations.
1613 $(OBJ0) $(OBJ1) $(OBJ2) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD