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
28 # HAVE_CONFIG_H is required by some generic gnu sources stuck into
29 # the emacs source tree.
31 LOCAL_FLAGS = -Demacs=1 -DHAVE_CONFIG_H -I../lib -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 TLIB2 = $(BLD)/temacs2.$(A)
40 TOBJ = $(BLD)/firstfile.$(O)
41 TRES = $(BLD)/emacs.res
42 TLASTLIB = $(BLD)/lastfile.$(A)
43 GNULIB = ../lib/$(BLD)/libgnu.$(A)
45 DOC = $(OBJDIR)/etc/DOC-X
47 FULL_LINK_FLAGS = $(LINK_FLAGS) $(TEMACS_EXTRA_LINK)
50 # Split up the objects into two sets so that we don't run out of
51 # command line space when we link them into a library.
53 # Put emacs.$(O) in a separate lib, since we need to have firstfile.$(O)
54 # as the "main" object file when linking.
56 OBJ0 = $(BLD)/emacs.$(O)
58 OBJ1 = $(BLD)/alloc.$(O) \
61 $(BLD)/bytecode.$(O) \
63 $(BLD)/callproc.$(O) \
64 $(BLD)/casefiddle.$(O) \
74 $(BLD)/filelock.$(O) \
78 $(BLD)/keyboard.$(O) \
86 $(BLD)/w32inevt.$(O) \
88 $(BLD)/w32console.$(O) \
97 OBJ2 = $(BLD)/sysdep.$(O) \
101 $(BLD)/unexw32.$(O) \
104 $(BLD)/casetab.$(O) \
105 $(BLD)/floatfns.$(O) \
107 $(BLD)/gmalloc.$(O) \
109 $(BLD)/intervals.$(O) \
110 $(BLD)/composite.$(O) \
112 $(BLD)/textprop.$(O) \
113 $(BLD)/vm-limit.$(O) \
114 $(BLD)/region-cache.$(O) \
116 $(BLD)/charset.$(O) \
117 $(BLD)/character.$(O) \
118 $(BLD)/chartab.$(O) \
120 $(BLD)/category.$(O) \
123 $(BLD)/fontset.$(O) \
126 $(BLD)/terminal.$(O) \
128 $(BLD)/w32term.$(O) \
129 $(BLD)/w32xfns.$(O) \
132 $(BLD)/w32select.$(O) \
133 $(BLD)/w32menu.$(O) \
135 $(BLD)/w32font.$(O) \
136 $(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" -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) $(TLIB2) $(TLASTLIB) $(TOBJ) $(TRES) \
178 ../nt/$(BLD)/addsection.exe $(GNULIB)
179 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
180 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 21
182 # These omit firstfile.${O}, but there's no documentation in there
184 buildobj.h: $(SRC)/makefile.w32-in
185 $(MAKE) $(MFLAGS) make-buildobj-$(SHELLTYPE)
187 # Cannot have blanks between the backslash and the redirection
188 # characters, because CMD's `echo' will put them in buildobj.h.
190 echo #define BUILDOBJ ^"\> buildobj.h
191 echo $(OBJ0) \>> buildobj.h
192 echo $(OBJ1) \>> buildobj.h
193 echo $(OBJ2) \>> buildobj.h
197 # The above line is here to countermand the single quote
198 # on the last "echo" command above, wrt font-lock.
200 echo '#define BUILDOBJ $(DQUOTE)\' > buildobj.h
201 echo $(OBJ0) '\' >> buildobj.h
202 echo $(OBJ1) '\' >> buildobj.h
203 echo $(OBJ2) '\' >> buildobj.h
204 echo '$(DQUOTE)' >> buildobj.h
206 GLOBAL_SOURCES = dosfns.c msdos.c \
207 xterm.c xfns.c xmenu.c xselect.c xrdb.c xsmfns.c fringe.c image.c \
208 fontset.c menu.c dbusbind.c \
209 w32.c w32console.c w32fns.c w32heap.c w32inevt.c \
210 w32menu.c w32proc.c w32reg.c w32select.c w32term.c w32xfns.c \
211 font.c w32font.c w32uniscribe.c \
212 dispnew.c frame.c scroll.c xdisp.c window.c bidi.c \
213 charset.c coding.c category.c ccl.c character.c chartab.c \
214 cm.c term.c terminal.c xfaces.c \
215 emacs.c keyboard.c macros.c keymap.c sysdep.c \
216 buffer.c filelock.c insdel.c marker.c \
217 minibuf.c fileio.c dired.c \
218 cmds.c casetab.c casefiddle.c indent.c search.c regex.c undo.c \
219 alloc.c data.c doc.c editfns.c callint.c \
220 eval.c floatfns.c fns.c print.c lread.c \
221 syntax.c bytecode.c \
222 process.c callproc.c unexw32.c \
223 region-cache.c sound.c atimer.c \
224 doprnt.c intervals.c textprop.c composite.c \
226 SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
227 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o
228 obj = $(GLOBAL_SOURCES:.c=.o)
233 gl-stamp: ../lib-src/$(BLD)/make-docfile.exe $(GLOBAL_SOURCES)
235 "../lib-src/$(BLD)/make-docfile" -d . -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp
236 cmd /c "fc /b gl-tmp globals.h >nul 2>&1 || $(CP) gl-tmp globals.h"
240 bootstrap: bootstrap-emacs
243 # Build a temacs with a sufficiently large PURESIZE to load the
244 # Lisp files from loadup.el in source form.
246 # WARNING: Do NOT split the part inside $(ARGQUOTE)s into multiple lines as
247 # this can break with GNU Make 3.81 and later if sh.exe is used.
248 bootstrap-temacs-CMD:
249 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(ESC_CFLAGS) -DPURESIZE=5000000$(ARGQUOTE)
252 $(MAKE) $(MFLAGS) $(XMFLAGS) temacs CFLAGS=$(ARGQUOTE)$(CFLAGS) -DPURESIZE=5000000$(ARGQUOTE)
255 $(MAKE) $(MFLAGS) bootstrap-temacs-$(SHELLTYPE)
258 # Dump an Emacs executable named bootstrap-emacs containing the
259 # files from loadup.el in source form.
261 bootstrap-emacs: bootstrap-temacs
262 "$(THISDIR)/$(BLD)/temacs.exe" -batch -l loadup bootstrap
264 $(CP) $(EMACS) ../bin
267 # Force recompile of files that depend on PURESIZE
270 - $(DEL) $(BLD)/alloc.$(O)
271 - $(DEL) $(BLD)/data.$(O)
272 - $(DEL) $(BLD)/intervals.$(O)
273 - $(DEL) $(BLD)/keyboard.$(O)
274 - $(DEL) $(BLD)/keymap.$(O)
277 # The resource file. NT 3.10 requires the use of cvtres; even though
278 # it is not necessary on later versions, it is still ok to use it.
280 $(TRES): ../nt/emacs.rc stamp_BLD
281 $(RC) $(RC_INCLUDE)../nt $(RC_OUT)$@ ../nt/emacs.rc
284 # Build the library. Split up the build into two phases...otherwise we
285 # run out of command line space.
289 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
292 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
295 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
298 # Place lastfile.$(O) in its own library so that it can be loaded after
299 # the source libraries but before any system libraries. Doing so defines
300 # the end of Emacs' data section portably across compilers and systems.
302 $(TLASTLIB): $(BLD)/lastfile.$(O)
304 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
307 # Assuming INSTALL_DIR is defined, build and install emacs in it.
310 - mkdir "$(INSTALL_DIR)/bin"
311 $(CP) $(EMACS) $(INSTALL_DIR)/bin
316 # We used to delete *~, s/*~, m/*~ here, but that might inadvertently
317 # remove precious files if it happens to match their short 8+3 aliases.
319 - $(DEL) "s/*.h~" "m/*.h~"
320 - $(DEL) $(COMPILER_TEMP_FILES)
321 - $(DEL_TREE) $(OBJDIR)
322 - $(DEL) stamp_BLD gl-stamp globals.h
326 - $(DEL) config.h epaths.h Makefile
328 maintainer-clean: distclean
333 - $(DEL_TREE) obj-spd
337 ## Arrange to make a tags table TAGS-LISP for ../lisp,
338 ## plus TAGS for the C files, which includes ../lisp/TAGS by reference.
340 ## This works only with GNU Make.
342 TAGS: $(OBJ0) $(OBJ1) $(OBJ2) $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h
343 $(MAKE) $(MFLAGS) TAGS-$(MAKETYPE)
345 TAGS-LISP: $(OBJ0) $(OBJ1) $(OBJ2)
346 $(MAKE) $(MFLAGS) TAGS-LISP-$(MAKETYPE)
349 ../lib-src/$(BLD)/etags.exe --include=TAGS-LISP --include=../nt/TAGS \
350 --regex=@../nt/emacs-src.tags \
351 $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0))
352 ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
353 $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1))
354 ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
355 $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2)) \
356 $(CURDIR)/*.h $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h
359 echo This target is not supported with NMake
364 $(MAKE) $(MFLAGS) -C ../lisp TAGS-LISP DEST=../src
367 echo This target is not supported with NMake
371 $(MAKE) $(MFLAGS) nt-TAGS-$(MAKETYPE)
374 $(MAKE) $(MFLAGS) -C ../nt TAGS
377 echo This target is not supported with NMake
380 full-tags: TAGS TAGS-LISP ../nt/TAGS
386 GNU_LIB = $(EMACS_ROOT)/lib
387 NT_INC = $(EMACS_ROOT)/nt/inc
389 SYSTIME_H = $(SRC)/systime.h \
391 ATIMER_H = $(SRC)/atimer.h \
393 BLOCKINPUT_H = $(SRC)/blockinput.h \
395 CAREADLINKAT_H = $(GNU_LIB)/careadlinkat.h \
397 CHARACTER_H = $(SRC)/character.h \
399 CHARSET_H = $(SRC)/charset.h \
401 CODING_H = $(SRC)/coding.h \
403 MS_W32_H = $(SRC)/s/ms-w32.h \
405 CONFIG_H = $(SRC)/config.h \
406 $(SRC)/m/intel386.h \
408 DIR_H = $(NT_INC)/sys/dir.h \
410 W32GUI_H = $(SRC)/w32gui.h \
412 DISPEXTERN_H = $(SRC)/dispextern.h \
414 FILEMODE_H = $(GNU_LIB)/filemode.h \
416 FONT_H = $(SRC)/font.h \
418 FRAME_H = $(SRC)/frame.h \
420 FTOASTR_H = $(GNU_LIB)/ftoastr.h \
421 $(GNU_LIB)/intprops.h
422 GRP_H = $(NT_INC)/grp.h \
424 INTERVALS_H = $(SRC)/intervals.h \
427 INTTYPES_H = $(NT_INC)/inttypes.h \
429 KEYBOARD_H = $(SRC)/keyboard.h \
432 LANGINFO_H = $(NT_INC)/langinfo.h \
434 LISP_H = $(SRC)/lisp.h \
436 $(GNU_LIB)/intprops.h \
438 MD5_H = $(GNU_LIB)/md5.h \
440 MENU_H = $(SRC)/menu.h \
442 PROCESS_H = $(SRC)/process.h \
445 SHA1_H = $(GNU_LIB)/sha1.h \
447 SHA256_H = $(GNU_LIB)/sha256.h \
449 U64_H = $(GNU_LIB)/u64.h \
451 SHA512_H = $(GNU_LIB)/sha512.h \
453 SOCKET_H = $(NT_INC)/sys/socket.h \
455 SYSTTY_H = $(SRC)/systty.h \
456 $(NT_INC)/sys/ioctl.h \
458 TERMHOOKS_H = $(SRC)/termhooks.h \
460 W32TERM_H = $(SRC)/w32term.h \
462 WINDOW_H = $(SRC)/window.h \
465 $(BLD)/alloc.$(O) : \
472 $(GNU_LIB)/verify.h \
484 $(BLD)/atimer.$(O) : \
487 $(NT_INC)/sys/time.h \
503 $(BLD)/buffer.$(O) : \
509 $(SRC)/region-cache.h \
510 $(NT_INC)/sys/param.h \
511 $(NT_INC)/sys/stat.h \
513 $(GNU_LIB)/verify.h \
523 $(BLD)/bytecode.$(O) : \
532 $(BLD)/callint.$(O) : \
543 $(BLD)/callproc.$(O) : \
552 $(NT_INC)/sys/file.h \
564 $(BLD)/casefiddle.$(O) : \
565 $(SRC)/casefiddle.c \
575 $(BLD)/casetab.$(O) : \
582 $(BLD)/category.$(O) : \
601 $(BLD)/character.$(O) : \
606 $(GNU_LIB)/intprops.h \
612 $(BLD)/charset.$(O) : \
623 $(BLD)/chartab.$(O) : \
645 $(BLD)/coding.$(O) : \
659 $(BLD)/composite.$(O) : \
678 $(GNU_LIB)/intprops.h \
687 $(BLD)/dired.$(O) : \
693 $(NT_INC)/sys/stat.h \
706 $(BLD)/dispnew.$(O) : \
736 $(NT_INC)/sys/file.h \
743 $(BLD)/doprnt.$(O) : \
750 $(BLD)/editfns.$(O) : \
755 $(GNU_LIB)/intprops.h \
756 $(GNU_LIB)/strftime.h \
757 $(GNU_LIB)/verify.h \
768 $(BLD)/emacs.$(O) : \
778 $(NT_INC)/sys/file.h \
801 $(BLD)/fileio.$(O) : \
806 $(NT_INC)/sys/stat.h \
819 $(BLD)/filelock.$(O) : \
823 $(NT_INC)/sys/file.h \
824 $(NT_INC)/sys/stat.h \
832 $(BLD)/firstfile.$(O) : \
836 $(BLD)/floatfns.$(O) : \
848 $(GNU_LIB)/intprops.h \
879 $(BLD)/fontset.$(O) : \
898 $(BLD)/frame.$(O) : \
916 $(BLD)/fringe.$(O) : \
927 $(BLD)/gmalloc.$(O) : \
929 $(SRC)/getpagesize.h \
933 $(BLD)/gnutls.$(O) : \
940 $(BLD)/image.$(O) : \
958 $(BLD)/indent.$(O) : \
965 $(SRC)/region-cache.h \
977 $(BLD)/insdel.$(O) : \
980 $(SRC)/region-cache.h \
981 $(GNU_LIB)/intprops.h \
989 $(BLD)/intervals.$(O) : \
994 $(GNU_LIB)/intprops.h \
1000 $(BLD)/keyboard.$(O) : \
1009 $(SRC)/syssignal.h \
1012 $(NT_INC)/sys/ioctl.h \
1013 $(NT_INC)/unistd.h \
1029 $(BLD)/keymap.$(O) : \
1046 $(BLD)/lastfile.$(O) : \
1050 $(BLD)/lread.$(O) : \
1055 $(NT_INC)/sys/file.h \
1056 $(NT_INC)/sys/stat.h \
1057 $(NT_INC)/unistd.h \
1069 $(BLD)/macros.$(O) : \
1079 $(BLD)/marker.$(O) : \
1086 $(BLD)/menu.$(O) : \
1100 $(BLD)/minibuf.$(O) : \
1121 $(NT_INC)/sys/file.h \
1122 $(NT_INC)/sys/time.h \
1123 $(GNU_LIB)/allocator.h \
1134 $(BLD)/w32heap.$(O) : \
1140 $(BLD)/w32inevt.$(O) : \
1152 $(BLD)/w32proc.$(O) : \
1154 $(SRC)/syssignal.h \
1158 $(NT_INC)/nl_types.h \
1159 $(NT_INC)/sys/file.h \
1169 $(BLD)/w32console.$(O) : \
1170 $(SRC)/w32console.c \
1182 $(BLD)/print.$(O) : \
1201 $(BLD)/process.$(O) : \
1205 $(SRC)/composite.h \
1207 $(SRC)/sysselect.h \
1208 $(SRC)/syssignal.h \
1211 $(NT_INC)/arpa/inet.h \
1213 $(NT_INC)/netinet/in.h \
1214 $(NT_INC)/sys/file.h \
1215 $(NT_INC)/sys/ioctl.h \
1216 $(NT_INC)/sys/stat.h \
1217 $(NT_INC)/unistd.h \
1234 $(BLD)/ralloc.$(O) : \
1236 $(SRC)/getpagesize.h \
1237 $(NT_INC)/unistd.h \
1242 $(BLD)/regex.$(O) : \
1248 $(NT_INC)/unistd.h \
1253 $(BLD)/region-cache.$(O) : \
1254 $(SRC)/region-cache.c \
1256 $(SRC)/region-cache.h \
1260 $(BLD)/scroll.$(O) : \
1271 $(BLD)/search.$(O) : \
1277 $(SRC)/region-cache.h \
1286 $(BLD)/sound.$(O) : \
1288 $(SRC)/syssignal.h \
1289 $(NT_INC)/unistd.h \
1295 $(BLD)/syntax.$(O) : \
1308 $(BLD)/sysdep.$(O) : \
1311 $(SRC)/sysselect.h \
1312 $(SRC)/syssignal.h \
1318 $(NT_INC)/sys/file.h \
1319 $(NT_INC)/sys/stat.h \
1320 $(NT_INC)/unistd.h \
1321 $(GNU_LIB)/allocator.h \
1322 $(GNU_LIB)/ignore-value.h \
1338 $(BLD)/term.$(O) : \
1342 $(SRC)/composite.h \
1345 $(SRC)/syssignal.h \
1349 $(NT_INC)/sys/file.h \
1350 $(NT_INC)/unistd.h \
1365 $(BLD)/terminal.$(O) : \
1376 $(BLD)/textprop.$(O) : \
1384 $(BLD)/tparam.$(O) : \
1390 $(BLD)/undo.$(O) : \
1398 $(BLD)/unexw32.$(O) : \
1404 $(BLD)/vm-limit.$(O) : \
1406 $(SRC)/mem-limits.h \
1410 $(BLD)/window.$(O) : \
1429 $(BLD)/xdisp.$(O) : \
1438 $(SRC)/region-cache.h \
1457 $(BLD)/xfaces.$(O) : \
1462 $(NT_INC)/sys/stat.h \
1477 $(BLD)/w32fns.$(O) : \
1502 $(BLD)/w32menu.$(O) : \
1519 $(BLD)/w32term.$(O) : \
1530 $(NT_INC)/sys/stat.h \
1550 $(BLD)/w32select.$(O) : \
1551 $(SRC)/w32select.c \
1552 $(SRC)/composite.h \
1561 $(BLD)/w32reg.$(O) : \
1568 $(BLD)/w32xfns.$(O) : \
1579 $(BLD)/w32font.$(O) : \
1593 $(BLD)/w32uniscribe.$(O) : \
1594 $(SRC)/w32uniscribe.c \
1595 $(SRC)/composite.h \
1607 # Each object file depends on stamp_BLD, because in parallel builds we must
1608 # make sure $(BLD) exists before starting compilations.
1610 $(OBJ0) $(OBJ1) $(OBJ2) $(BLD)/lastfile.$(O) $(BLD)/firstfile.$(O): stamp_BLD