nmake.defs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. # -*- Makefile -*- definition file for building GNU Emacs on Windows NT.
  2. # Copyright (C) 2000-2015 Free Software Foundation, Inc.
  3. # This file is part of GNU Emacs.
  4. # GNU Emacs is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. # GNU Emacs is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  14. # Ensure 'all' is the default target
  15. all:
  16. THE_SHELL = $(COMSPEC)
  17. SHELLTYPE=CMD
  18. SWITCHCHAR=/
  19. MAKETYPE=nmake
  20. CURDIR = $(MAKEDIR:\=/)
  21. THISDIR = $(MAKEDIR)
  22. DIRNAME =
  23. ALL_DEPS = $**
  24. SUBSYSTEM_WINDOWS=-subsystem:windows
  25. SUBSYSTEM_CONSOLE=-subsystem:console
  26. # INSTALL_DIR is the directory into which emacs will be installed.
  27. #
  28. !ifndef INSTALL_DIR
  29. INSTALL_DIR = $(CURDIR)/..
  30. !endif
  31. # Ensure EMACSLOADPATH is defined in the environment.
  32. #
  33. !if [set EMACSLOADPATH=foo]
  34. !endif
  35. # Allow detection of builds with MSVC 5 or later, so we can
  36. # speed up compiles (see rule at end).
  37. #
  38. _NMAKE_VER_5=162
  39. _NMAKE_VER_4=0
  40. !IFNDEF _NMAKE_VER
  41. _NMAKE_VER=$(_NMAKE_VER_4)
  42. !ENDIF
  43. # Check that the INCLUDE and LIB environment variables are set.
  44. #
  45. !ifndef INCLUDE
  46. !error The INCLUDE environment variable needs to be set.
  47. !endif
  48. !ifndef LIB
  49. !error The LIB environment variable needs to be set.
  50. !endif
  51. # Determine the architecture we're running on.
  52. # Define ARCH for our purposes;
  53. # Define CPU for use by ntwin32.mak;
  54. # Define CONFIG_H to the appropriate config.h for the system;
  55. #
  56. !ifdef PROCESSOR_ARCHITECTURE
  57. # We're on Windows NT
  58. CPU = $(PROCESSOR_ARCHITECTURE)
  59. CONFIG_H = config.nt
  60. OS_TYPE = windowsnt
  61. ! if "$(PROCESSOR_ARCHITECTURE)" == "x86"
  62. ARCH = i386
  63. CPU = i386
  64. ! else
  65. ! if "$(PROCESSOR_ARCHITECTURE)" == "MIPS"
  66. ARCH = mips
  67. ! else
  68. ! if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
  69. ARCH = alpha
  70. ! else
  71. ! if "$(PROCESSOR_ARCHITECTURE)" == "PPC"
  72. ARCH = ppc
  73. ! else
  74. ! if "$(PROCESSOR_ARCHITECTURE)" == "AMD64"
  75. ARCH = AMD64
  76. ! else
  77. ! error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)"
  78. ! endif
  79. ! endif
  80. ! endif
  81. ! endif
  82. ! endif
  83. !else
  84. # We're on Windows 95
  85. ARCH = i386
  86. CPU = i386
  87. CONFIG_H = config.nt
  88. OS_TYPE = windows95
  89. !endif
  90. AR = lib
  91. AR_OUT = -out:
  92. CC = cl
  93. CC_OUT = -Fo
  94. LINK = link
  95. LINK_OUT = -out:
  96. RC = rc $(ARCH_RCFLAGS)
  97. RC_OUT = -Fo
  98. RC_INCLUDE = -i
  99. USE_CRT_DLL = 1
  100. !if $(USE_CRT_DLL)
  101. libc = msvcrt$(D).lib
  102. EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1
  103. !else
  104. libc = libcmt$(D).lib
  105. EMACS_EXTRA_C_FLAGS= -D_MT
  106. !endif
  107. baselibs =
  108. O = obj
  109. A = lib
  110. BASE_LIBS = $(libc) $(baselibs) oldnames.lib
  111. ADVAPI32 = advapi32.lib
  112. COMCTL32 = comctl32.lib
  113. COMDLG32 = comdlg32.lib
  114. GDI32 = gdi32.lib
  115. MPR = mpr.lib
  116. SHELL32 = shell32.lib
  117. USER32 = user32.lib
  118. WSOCK32 = wsock32.lib
  119. WINMM = winmm.lib
  120. WINSPOOL = winspool.lib
  121. OLE32 = ole32.lib
  122. UNISCRIBE = usp10.lib
  123. UUID = uuid.lib
  124. !ifdef NOOPT
  125. DEBUG_CFLAGS = -DEMACSDEBUG
  126. !else
  127. DEBUG_CFLAGS =
  128. !endif
  129. MWINDOWS = -subsystem:windows -entry:mainCRTStartup
  130. CFLAGS = -I. $(ARCH_CFLAGS) -D_CRT_SECURE_NO_WARNINGS \
  131. $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
  132. ESC_CFLAGS = -I. $(ARCH_CFLAGS) -D_CRT_SECURE_NO_WARNINGS \
  133. $(DEBUG_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)
  134. #SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
  135. SYS_LDFLAGS = -nologo -manifest -dynamicbase:no -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
  136. # see comments in allocate_heap in w32heap.c before changing any of the
  137. # -stack, -heap, or -base settings.
  138. !if "$(ARCH)" == "i386"
  139. TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x01000000 -pdb:$(BLD)\temacs.pdb -machine:x86 $(SUBSYSTEM_CONSOLE) -entry:_start -map:$(BLD)\temacs.map $(EXTRA_LINK)
  140. !elseif "$(ARCH)" == "AMD64"
  141. TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x400000000 -pdb:$(BLD)\temacs.pdb -machine:x64 $(SUBSYSTEM_CONSOLE) -entry:_start -map:$(BLD)\temacs.map $(EXTRA_LINK)
  142. !endif
  143. !ifdef NOOPT
  144. OBJDIR = obj
  145. !else
  146. OBJDIR = obj-spd
  147. !endif
  148. $(OBJDIR):; -mkdir $(OBJDIR)
  149. BLD = $(OBJDIR)/$(ARCH)
  150. stamp_BLD: $(OBJDIR)
  151. -mkdir "$(BLD)"
  152. echo $(BLD) > $@
  153. COMPILER_TEMP_FILES = *.pdb
  154. CP = cp -f
  155. CP_DIR = cp -rf
  156. IFNOTSAMEDIR = if not exist ..\$(DIRNAME)_same-dir.tst
  157. ENDIF =
  158. FOREACH = for %%f in (
  159. FORVAR = %%f
  160. FORDO = ) do
  161. ENDFOR =
  162. ARGQUOTE = "
  163. # "
  164. DQUOTE = \"
  165. DEL = rm
  166. DEL_TREE = rm -r
  167. !ifdef NODEBUG
  168. DEBUG_FLAG =
  169. DEBUG_LINK =
  170. D =
  171. !else
  172. DEBUG_FLAG = -Zi
  173. DEBUG_LINK = -debug
  174. D = d
  175. !endif
  176. # gcc-specific pragma (ignore for MSVC)
  177. PRAGMA_SYSTEM_HEADER =
  178. !if "$(ARCH)" == "i386"
  179. !ifdef NOOPT
  180. #ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Od -G3d -Zp8 $(DEBUG_FLAG)
  181. ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Od -Gd $(DEBUG_FLAG)
  182. !else
  183. #ARCH_CFLAGS = -nologo -c -Zel -W2 -H63 -Oxsb2 -Oy- -G6dF -Zp8 $(DEBUG_FLAG)
  184. ARCH_CFLAGS = -nologo -D_X86_=1 -c -Zl -Zp8 -W2 -Oi -Ot -Oy- -Ob2 -GF -Gy -Gd $(DEBUG_FLAG)
  185. !endif
  186. ARCH_LDFLAGS = $(SYS_LDFLAGS)
  187. EMACS_HEAPSIZE = 27
  188. EMACS_PURESIZE = 5000000
  189. EMACS_MANIFEST = emacs-x86.manifest
  190. !else
  191. !if "$(ARCH)" == "mips"
  192. ARCH_CFLAGS = -D_MIPS_=1 -c -W2 -Zi -Od -Gt0
  193. ARCH_LDFLAGS = $(SYS_LDFLAGS)
  194. EMACS_HEAPSIZE = 27
  195. EMACS_PURESIZE = 5000000
  196. EMACS_MANIFEST = emacs-mips.manifest
  197. !else
  198. !if "$(ARCH)" == "alpha"
  199. !if "$(BUILD_TYPE)" == "spd"
  200. ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -Od -D__stdcall= -D__cdecl=
  201. !else
  202. ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -O1 -D__stdcall= -D__cdecl=
  203. !endif
  204. ARCH_LDFLAGS = $(SYS_LDFLAGS)
  205. EMACS_HEAPSIZE = 27
  206. EMACS_PURESIZE = 5000000
  207. EMACS_MANIFEST = emacs-alpha.manifest
  208. !else
  209. !if "$(ARCH)" == "ppc"
  210. # These flags are a guess...if they don't work, please send me mail.
  211. ARCH_LDFLAGS = $(SYS_LDFLAGS)
  212. EMACS_HEAPSIZE = 27
  213. EMACS_PURESIZE = 5000000
  214. EMACS_MANIFEST = emacs-ppc.manifest
  215. !else
  216. !if "$(ARCH)" == "AMD64"
  217. !ifdef NOOPT
  218. ARCH_CFLAGS = -nologo -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -c -Zl -Zp8 -W2 -Od -Gd -Wp64 $(DEBUG_FLAG)
  219. !else
  220. ARCH_CFLAGS = -nologo -D_AMD64_=1 -DWIN64 -D_WIN64 -DWIN32 -D_WIN32 -c -Zl -Zp8 -W2 -O2x -GF -Gy -Gd $(DEBUG_FLAG)
  221. !endif
  222. ARCH_LDFLAGS = $(SYS_LDFLAGS) -machine:x64
  223. ARCH_RCFLAGS = -DWIN64
  224. EMACS_HEAPSIZE = 42
  225. EMACS_PURESIZE = 10000000
  226. EMACS_MANIFEST = emacs-x64.manifest
  227. !else
  228. !ERROR Unknown architecture type "$(ARCH)".
  229. !endif
  230. !endif
  231. !endif
  232. !endif
  233. !endif
  234. LINK_FLAGS = $(ARCH_LDFLAGS) $(DEBUG_LINK) $(USER_LDFLAGS)
  235. # From MSVC 5.0 onwards, it seem base relocation information is not included,
  236. # at least in release builds. We need to ensure the reloc info is included
  237. # in order to use the MSVC profiler.
  238. !IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
  239. EXTRA_LINK =
  240. !ELSE
  241. EXTRA_LINK = -profile
  242. !ENDIF
  243. #
  244. # If the compiler supports compiling multiple .c files to .o files at
  245. # one time, use this feature.
  246. #
  247. !IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
  248. .c{$(BLD)}.obj:
  249. $(CC) $(CFLAGS) -Fo$(BLD)\ $<
  250. !ELSE
  251. .c{$(BLD)}.obj::
  252. $(CC) $(CFLAGS) -Fo$(BLD)\ $<
  253. !ENDIF