nmake.defs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. # -*- Makefile -*- definition file for building GNU Emacs on Windows NT.
  2. # Copyright (C) 2000-2012 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. MAKETYPE=nmake
  19. CURDIR = $(MAKEDIR:\=/)
  20. THISDIR = $(MAKEDIR)
  21. DIRNAME =
  22. ALL_DEPS = $**
  23. SUBSYSTEM_WINDOWS=-subsystem:windows
  24. SUBSYSTEM_CONSOLE=-subsystem:console
  25. # INSTALL_DIR is the directory into which emacs will be installed.
  26. #
  27. !ifndef INSTALL_DIR
  28. INSTALL_DIR = $(CURDIR)/..
  29. !endif
  30. # Ensure EMACSLOADPATH is defined in the environment.
  31. #
  32. !if [set EMACSLOADPATH=foo]
  33. !endif
  34. # Allow detection of builds with MSVC 5 or later, so we can
  35. # speed up compiles (see rule at end).
  36. #
  37. _NMAKE_VER_5=162
  38. _NMAKE_VER_4=0
  39. !IFNDEF _NMAKE_VER
  40. _NMAKE_VER=$(_NMAKE_VER_4)
  41. !ENDIF
  42. # Check that the INCLUDE and LIB environment variables are set.
  43. #
  44. !ifndef INCLUDE
  45. !error The INCLUDE environment variable needs to be set.
  46. !endif
  47. !ifndef LIB
  48. !error The LIB environment variable needs to be set.
  49. !endif
  50. # Determine the architecture we're running on.
  51. # Define ARCH for our purposes;
  52. # Define CPU for use by ntwin32.mak;
  53. # Define CONFIG_H to the appropriate config.h for the system;
  54. #
  55. !ifdef PROCESSOR_ARCHITECTURE
  56. # We're on Windows NT
  57. CPU = $(PROCESSOR_ARCHITECTURE)
  58. CONFIG_H = config.nt
  59. OS_TYPE = windowsnt
  60. ! if "$(PROCESSOR_ARCHITECTURE)" == "x86"
  61. ARCH = i386
  62. CPU = i386
  63. ! else
  64. ! if "$(PROCESSOR_ARCHITECTURE)" == "MIPS"
  65. ARCH = mips
  66. ! else
  67. ! if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
  68. ARCH = alpha
  69. ! else
  70. ! if "$(PROCESSOR_ARCHITECTURE)" == "PPC"
  71. ARCH = ppc
  72. ! else
  73. ! error Unknown architecture type "$(PROCESSOR_ARCHITECTURE)"
  74. ! endif
  75. ! endif
  76. ! endif
  77. ! endif
  78. !else
  79. # We're on Windows 95
  80. ARCH = i386
  81. CPU = i386
  82. CONFIG_H = config.nt
  83. OS_TYPE = windows95
  84. !endif
  85. AR = lib
  86. AR_OUT = -out:
  87. CC = cl
  88. CC_OUT = -Fo
  89. LINK = link
  90. LINK_OUT = -out:
  91. RC = rc
  92. RC_OUT = -Fo
  93. RC_INCLUDE = -i
  94. USE_CRT_DLL = 1
  95. !ifdef USE_CRT_DLL
  96. libc = msvcrt$(D).lib
  97. EMACS_EXTRA_C_FLAGS= -D_DLL -D_MT -DUSE_CRT_DLL=1
  98. !else
  99. libc = libcmt$(D).lib
  100. EMACS_EXTRA_C_FLAGS= -D_MT
  101. !endif
  102. baselibs =
  103. O = obj
  104. A = lib
  105. BASE_LIBS = $(libc) $(baselibs) oldnames.lib
  106. ADVAPI32 = advapi32.lib
  107. COMCTL32 = comctl32.lib
  108. COMDLG32 = comdlg32.lib
  109. GDI32 = gdi32.lib
  110. MPR = mpr.lib
  111. SHELL32 = shell32.lib
  112. USER32 = user32.lib
  113. WSOCK32 = wsock32.lib
  114. WINMM = winmm.lib
  115. WINSPOOL = winspool.lib
  116. OLE32 = ole32.lib
  117. UNISCRIBE = usp10.lib
  118. UUID = uuid.lib
  119. !ifdef NOOPT
  120. DEBUG_CFLAGS = -DEMACSDEBUG
  121. !else
  122. DEBUG_CFLAGS =
  123. !endif
  124. !ifdef ENABLECHECKS
  125. CHECKING_CFLAGS = -DENABLE_CHECKING -DXASSERTS
  126. !else
  127. CHECKING_CFLAGS =
  128. !endif
  129. MWINDOWS = -subsystem:windows -entry:mainCRTStartup
  130. CFLAGS = -I. $(ARCH_CFLAGS) \
  131. $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
  132. ESC_CFLAGS = -I. $(ARCH_CFLAGS) \
  133. $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)
  134. #SYS_LDFLAGS = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
  135. !ifdef NOOPT
  136. SYS_LDFLAGS = -nologo -manifest -dynamicbase:no -debug -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
  137. !else
  138. SYS_LDFLAGS = -nologo -manifest -dynamicbase:no -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj
  139. !endif
  140. # see comments in allocate_heap in w32heap.c before changing any of the
  141. # -stack, -heap, or -base settings.
  142. TEMACS_EXTRA_LINK = -stack:0x00800000 -heap:0x00100000 -base:0x01000000 -pdb:$(BLD)\temacs.pdb -machine:$(ARCH) $(SUBSYSTEM_CONSOLE) -entry:_start -map:$(BLD)\temacs.map $(EXTRA_LINK)
  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. !else
  188. !if "$(ARCH)" == "mips"
  189. ARCH_CFLAGS = -D_MIPS_=1 -c -W2 -Zi -Od -Gt0
  190. ARCH_LDFLAGS = $(SYS_LDFLAGS)
  191. !else
  192. !if "$(ARCH)" == "alpha"
  193. !if "$(BUILD_TYPE)" == "spd"
  194. ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -Od -D__stdcall= -D__cdecl=
  195. !else
  196. ARCH_CFLAGS = -D_ALPHA_=1 -c -Ze -Zi -W2 -O1 -D__stdcall= -D__cdecl=
  197. !endif
  198. ARCH_LDFLAGS = $(SYS_LDFLAGS)
  199. !else
  200. !if "$(ARCH)" == "ppc"
  201. # These flags are a guess...if they don't work, please send me mail.
  202. ARCH_CFLAGS = -D_PPC_=1 -c -Ze -Zi -W2 -Od
  203. ARCH_LDFLAGS = $(SYS_LDFLAGS)
  204. !else
  205. !ERROR Unknown architecture type "$(ARCH)".
  206. !endif
  207. !endif
  208. !endif
  209. !endif
  210. LINK_FLAGS = $(ARCH_LDFLAGS) $(DEBUG_LINK) $(USER_LDFLAGS)
  211. # From MSVC 5.0 onwards, it seem base relocation information is not included,
  212. # at least in release builds. We need to ensure the reloc info is included
  213. # in order to use the MSVC profiler.
  214. !IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
  215. EXTRA_LINK =
  216. !ELSE
  217. EXTRA_LINK = -profile
  218. !ENDIF
  219. #
  220. # If the compiler supports compiling multiple .c files to .o files at
  221. # one time, use this feature.
  222. #
  223. !IF ("$(_NMAKE_VER)" == "$(_NMAKE_VER_4)")
  224. .c{$(BLD)}.obj:
  225. $(CC) $(CFLAGS) -Fo$(BLD)\ $<
  226. !ELSE
  227. .c{$(BLD)}.obj::
  228. $(CC) $(CFLAGS) -Fo$(BLD)\ $<
  229. !ENDIF