Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

361 lines
9.4 KiB

  1. !IF 0
  2. Copyright (c) 1994-1996 Microsoft Corporation
  3. Module Name:
  4. amd64mk.inc
  5. Abstract:
  6. This module contains the x86 specific build controls. It is included
  7. by makefile.def.
  8. Revision History:
  9. !ENDIF
  10. DELAYLOAD_SUPPORTED=1
  11. !ifndef DELAYLOAD_VERSION
  12. DELAYLOAD_VERSION=0x0200
  13. !endif
  14. #
  15. # AMD64 option control
  16. #
  17. UMBASE=$(UMBASE:*=amd64)
  18. UMLIBS=$(UMLIBS:*=amd64)
  19. NTRES=$(NTRES:*=amd64)
  20. UMRES=$(UMRES:*=amd64)
  21. UMOBJS=$(UMOBJS:*=amd64)
  22. LINKLIBS=$(LINKLIBS:*=amd64)
  23. GDI_DRIVER_LIBS=$(GDI_DRIVER_LIBS:*=amd64)
  24. DLLBASE=$(DLLBASE:*=amd64)
  25. DLLDEF=$(DLLDEF:*=amd64)
  26. MACHINE_TARGETLIBS=$(MACHINE_TARGETLIBS:*=amd64)
  27. !ifdef USE_MSHTML_PDB_RULES
  28. MACHINE_TARGETLIBS=$(MACHINE_TARGETLIBS:????????=*)
  29. !endif
  30. TARGET=$(TARGET:*=amd64)
  31. DYNLINK_LIB=$(DYNLINK_LIB:*=amd64)
  32. TARGETEXEFILES=$(TARGETEXEFILES:*=amd64)
  33. TARGETLIBFILES=$(TARGETLIBFILES:*=amd64)
  34. TARGETOBJFILES=$(TARGETOBJFILES:*=amd64)
  35. UMOBJFILES=$(UMOBJFILES:*=amd64)
  36. UMEXEFILES=$(UMEXEFILES:*=amd64)
  37. HEADERFILE=$(HEADERFILE:*=amd64)
  38. HEADEROBJNAME=$(HEADEROBJNAME:*=amd64)
  39. HEADEROBJ=$(HEADEROBJ:*=amd64)
  40. PRECOMPILED=$(PRECOMPILED:*=amd64) /d1noWchar_t
  41. PRECOMPILED_CXX=$(PRECOMPILED_CXX:*=amd64) /d1noWchar_t
  42. PRECOMPILED_TARGET=$(PRECOMPILED_TARGET:*=amd64)
  43. MFC_STATIC_LIB=$(MFC_STATIC_LIB:*=amd64)
  44. CRT_LIB_PATH=$(CRT_LIB_PATH:*=amd64)
  45. SDK_LIB_PATH=$(SDK_LIB_PATH:*=amd64)
  46. DDK_LIB_PATH=$(DDK_LIB_PATH:*=amd64)
  47. IFSKIT_LIB_PATH=$(IFSKIT_LIB_PATH:*=amd64)
  48. HALKIT_LIB_PATH=$(HALKIT_LIB_PATH:*=amd64)
  49. PROCESSOR_LIB_PATH=$(PROCESSOR_LIB_PATH:*=amd64)
  50. ORDER=$(ORDER:*=amd64)
  51. OBJLIBFILES=$(OBJLIBFILES:*=amd64)
  52. MISCFILES=$(MISCFILES) $(AMD64_MISCFILES)
  53. SOURCES=$(SOURCES) $(AMD64_SOURCES)
  54. ADDITIONAL_ATL_LIBS = $(ADDITIONAL_ATL_LIBS) $(SDK_LIB_PATH)\atlamd64.lib
  55. !ifdef NTTARGETFILES
  56. NTTARGETFILES=$(NTTARGETFILES:*=amd64)
  57. !endif
  58. !ifdef NTTARGETFILE0
  59. NTTARGETFILE0=$(NTTARGETFILE0:*=amd64)
  60. !endif
  61. !ifdef NTTARGETFILE1
  62. NTTARGETFILE1=$(NTTARGETFILE1:*=amd64)
  63. !endif
  64. !ifdef PROJECT_LIB_PATH
  65. PROJECT_LIB_PATH=$(PROJECT_LIB_PATH:*=amd64)
  66. !endif
  67. ENTRY_SUFFIX=
  68. GDI_ENTRY_SUFFIX=
  69. DEFAULT_STACKRESERVE=0x40000
  70. DEFAULT_STACKCOMMIT=0x1000
  71. ADDITIONAL_ATL_LIBS = $(ADDITIONAL_ATL_LIBS)
  72. !IFDEF AMD64_WARNING_LEVEL
  73. MSC_WARNING_LEVEL=$(AMD64_WARNING_LEVEL)
  74. !ENDIF
  75. MSC_WARNING_LEVEL=$(MSC_WARNING_LEVEL) /Wp64 $(COMPILER_WX_SWITCH)
  76. !ifdef AMD64_PERFFLAGS
  77. PERFFLAGS = $(AMD64_PERFFLAGS)
  78. !endif
  79. # Set MSC_OPTIMIZATION.
  80. # Order of precedence:
  81. # Platform specific override
  82. # Environment variable
  83. # System Default
  84. !if defined(AMD64_OPTIMIZATION)
  85. MSC_OPTIMIZATION=$(AMD64_OPTIMIZATION)
  86. !elseif !defined(MSC_OPTIMIZATION)
  87. MSC_OPTIMIZATION=/Oxt
  88. !endif
  89. DBGFLAGS=$(DBGFLAGS) $(MSC_OPTIMIZATION)
  90. WIN32_LIBS=$(WIN32_LIBS) $(LIBRARY_PATH)\ntdll.lib
  91. !IFDEF AMD64_CPPFLAGS
  92. MSC_CPPFLAGS=$(AMD64_CPPFLAGS)
  93. !ENDIF
  94. !ifdef NO_STRING_POOLING
  95. STRING_POOLING =
  96. !else
  97. !ifdef NO_READONLY_STRINGS
  98. STRING_POOLING = /Gf
  99. !else
  100. STRING_POOLING = /GF
  101. !endif
  102. !endif
  103. !ifdef USE_NATIVE_EH
  104. EH_FLAGS=/GX
  105. !if "$(USE_NATIVE_EH)" == "ASYNC"
  106. EH_FLAGS=$(EH_FLAGS) /EHa
  107. !endif
  108. !else
  109. EH_FLAGS=/GX-
  110. !endif
  111. ! ifdef USE_RTTI
  112. RTTI_FLAGS=/GR
  113. ! else
  114. RTTI_FLAGS=/GR-
  115. ! endif
  116. !ifndef AMD64_CPU_OPTIMIZATION
  117. AMD64_CPU_OPTIMIZATION=
  118. !endif
  119. STDFLAGS= /c /Zel /Zp8 /Gy /Gi- $(CBSTRING) $(MSC_WARNING_LEVEL) $(MSC_CALL_TYPE) \
  120. $(ERATTA_FLAGS) $(AMD64_CPU_OPTIMIZATION) $(EH_FLAGS) \
  121. $(RTTI_FLAGS) $(STRING_POOLING)
  122. !if $(FREEBUILD)
  123. ASM_DBG_DEFINES=-DDBG=0
  124. !else
  125. AMD64_ADBGFLAGS=$(AMD64_ADBGFLAGS) /Zi
  126. !endif
  127. # @@BEGIN_DDKSPLIT
  128. !IFDEF NTBBT
  129. DBGFLAGS=$(DBGFLAGS) /Zi
  130. AMD64_ADBGFLAGS=$(AMD64_ADBGFLAGS) /Zi
  131. LINKER_FLAGS=$(LINKER_FLAGS) -debug:full -debugtype:cv,fixup,pdata
  132. !ENDIF
  133. # @@END_DDKSPLIT
  134. !ifndef USE_PDB_TO_COMPILE
  135. DBGFLAGS=$(DBGFLAGS:/Zi=-Z7)
  136. DBGFLAGS=$(DBGFLAGS:-Zi=-Z7)
  137. !else
  138. ! ifndef USE_MSHTML_PDB_RULES
  139. ! if "$(TARGETTYPE)" == "LIBRARY"
  140. DBGFLAGS=$(DBGFLAGS) /Fd$(TARGETPATH)\$(TARGET_DIRECTORY)\$(TARGETNAME).pdb
  141. ! else
  142. DBGFLAGS=$(DBGFLAGS) /Fd$(MAKEDIR)\$(_OBJ_DIR)\AMD64^\
  143. ! endif
  144. ! else
  145. ! ifndef TARGETPDB
  146. TARGETPDB=$(TARGETNAME)
  147. ! endif
  148. ! ifndef ROOT
  149. ROOT=$(MAKEDIR)
  150. ! endif
  151. DBGFLAGS=$(DBGFLAGS) /Fd$(ROOT)\$(_OBJ_DIR)\amd64\$(TARGETPDB).pdb
  152. ! endif
  153. !endif
  154. !ifndef NO_BROWSER_INFO
  155. ! ifdef BROWSER_INFO
  156. DBGFLAGS=$(DBGFLAGS) /FR$(MAKEDIR)\$(_OBJ_DIR)\amd64^\
  157. ! endif
  158. !endif
  159. #
  160. # amd64 option control
  161. #
  162. !IF "$(HALTYPE)" == ""
  163. HALDEF=
  164. !ELSE
  165. HALDEF=-D$(HALTYPE)=1
  166. !ENDIF
  167. STD_DEFINES=-D_WIN64 -D_AMD64_ -DAMD64 $(HALDEF) $(MSC_CALL_DEFINE) $(STD_DEFINES)
  168. #
  169. # This indicates that we are compiling for a siulated (i.e. slow)
  170. # environment.
  171. #
  172. # Remove this when we get a faster environment.
  173. #
  174. STD_DEFINES=$(STD_DEFINES) -D_AMD64_SIMULATOR_PERF_ -D_SKIP_IF_SIMULATOR_
  175. #
  176. # This indicates that we need to enable temp. workarounds for simulator
  177. # bugs
  178. #
  179. STD_DEFINES=$(STD_DEFINES) -D_AMD64_SIMULATOR_
  180. #
  181. # This is here to enable (and help us find later) workarounds for AMD64
  182. # tools such as MIDL. Workarounds must have a tool fix in the works.
  183. #
  184. STD_DEFINES=$(STD_DEFINES) -D_AMD64_WORKAROUND_
  185. MIDL_FLAGS=$(MIDL_FLAGS) -D_AMD64_WORKAROUND_
  186. CDEFINES=$(STD_DEFINES) $(TARGET_DBG_DEFINES) \
  187. $(LIBC_DEFINES) $(C_DEFINES) $(NET_C_DEFINES) $(MFC_DEFINES)
  188. CFLAGS=$(AMD64_FLAGS) $(NTAMD64FLAGS) $(STDFLAGS) $(DBGFLAGS) $(PERFFLAGS) $(USER_C_FLAGS)
  189. AMD64_ASMFLAGS=$(AMD64_ADBGFLAGS) $(STD_DEFINES) $(ASM_DBG_DEFINES)\
  190. $(TARGET_DBG_DEFINES) $(ASM_DEFINES)
  191. AMD64_CDEFINES=$(CDEFINES)
  192. AMD64_CFLAGS=$(CFLAGS)
  193. CC_NAME = cl -nologo
  194. C_COMPILER_NAME = $(CC_NAME)
  195. CXX_COMPILER_NAME = $(CC_NAME)
  196. C_PREPROCESSOR_NAME = $(CC_NAME)
  197. !ifndef AMD64_ASSEMBLER_NAME
  198. AMD64_ASSEMBLER_NAME = ml64
  199. !endif
  200. !if $(FREEBUILD)
  201. GLOBAL_C_FLAGS = -Iamd64\ -I. $(INCPATH1) $(CDEFINES) $(CFLAGS)
  202. !else
  203. GLOBAL_C_FLAGS = -Iamd64\ -I. $(INCPATH1) $(CDEFINES) $(CFLAGS) -d2home
  204. !endif
  205. NP_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(COMPILER_WARNINGS)
  206. C_COMPILER_FLAGS = $(NP_COMPILER_FLAGS) $(PRECOMPILED)
  207. CXX_COMPILER_FLAGS = $(NP_COMPILER_FLAGS) $(PRECOMPILED_CXX) $(MSC_CPPFLAGS) $(NTCPPFLAGS)
  208. C_PREPROCESSOR_FLAGS = $(GLOBAL_C_FLAGS) /d1noWchar_t -EP -Tc
  209. C_PREPROCESSOR = $(C_PREPROCESSOR_NAME) $(C_PREPROCESSOR_FLAGS)
  210. C_ASM_PREPROCESSOR = $(C_PREPROCESSOR_NAME) $(ASM_DEFINES) $(C_PREPROCESSOR_FLAGS)
  211. C_COMPILER = $(C_COMPILER_NAME) $(C_COMPILER_FLAGS)
  212. NP_C_COMPILER = $(C_COMPILER_NAME) $(NP_COMPILER_FLAGS)
  213. CXX_COMPILER = $(CXX_COMPILER_NAME) $(CXX_COMPILER_FLAGS)
  214. AMD64_ASSEMBLER=$(AMD64_ASSEMBLER_NAME) -c -Cx -nologo -Iamd64\ -I. $(INCPATH1) $(AMD64_ASMFLAGS)
  215. ECHO_MSG=$(C_COMPILER) $<
  216. ECHO_MSG_P=$(NP_C_COMPILER) $**
  217. ECHO_CXX_MSG=$(CXX_COMPILER) $<
  218. ECHO_PRECOMPILED_MSG1=$(C_COMPILER_NAME) $(C_COMPILER_FLAGS) /Yl$(TARGETNAME) /Yc$(?F) $(HEADERFILE) \
  219. $(HEADEROBJ) $(PRECOMPILED_FLAG) $(PRECOMPILED_SOURCEFILE)
  220. ECHO_PRECOMPILED_MSG2=$(C_COMPILER_NAME) $(C_COMPILER_FLAGS) /Yl$(TARGETNAME) /Yc$(?F) $(HEADERFILE) \
  221. $(HEADEROBJ) $(PRECOMPILED_FLAG)
  222. {}.c{}.asm:
  223. $(C_COMPILER_NAME) @<< /Fa $(MAKEDIR)\$(<F)
  224. $(C_COMPILER_FLAGS: =
  225. )
  226. $(C_COMPILER_FLAGS:##= )
  227. <<NOKEEP
  228. #
  229. # Here is a workaround for a masm code generation bug having to do with
  230. # broken interaction between the preprocessor and the code generator.
  231. #
  232. # The workaround is to generate a preprocessed file first, then assemble
  233. # that. When the assembler is fixed, delete the following !if-related
  234. # statements and the stuff in the !else block.
  235. #
  236. {..\amd64\}.asm{}.pp:
  237. $(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$@
  238. {amd64\}.asm{}.pp:
  239. $(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$@
  240. !if 1
  241. {..\amd64\}.asm{}.lst:
  242. $(AMD64_ASSEMBLER) /Fl$@ /Fo$(_OBJ_DIR)\amd64\$(@B).obj $(MAKEDIR)\$<
  243. {amd64\}.asm{}.lst:
  244. $(AMD64_ASSEMBLER) /Fl$@ /Fo$(MAKEDIR)\$(_OBJ_DIR)\amd64\$(@B).obj $(MAKEDIR)\$<
  245. {..\amd64\}.asm{$(_OBJ_DIR)\amd64\}.obj:
  246. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
  247. {amd64\}.asm{$(_OBJ_DIR)\amd64\}.obj:
  248. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
  249. {$(O)\}.asm{$(O)\}.obj:
  250. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
  251. !else
  252. {..\amd64\}.asm{}.lst:
  253. -$(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$(@R).pp
  254. $(AMD64_ASSEMBLER) /Fl$@ /Fo$(_OBJ_DIR)\amd64\$(@B).obj $(MAKEDIR)\$(@R).pp
  255. del $(MAKEDIR)\$(@R).pp
  256. {amd64\}.asm{}.lst:
  257. -$(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$(@R).pp
  258. $(AMD64_ASSEMBLER) /Fl$@ /Fo$(MAKEDIR)\$(_OBJ_DIR)\amd64\$(@B).obj $(MAKEDIR)\$(@R).pp
  259. del $(MAKEDIR)\$(@R).pp
  260. {..\amd64\}.asm{$(_OBJ_DIR)\amd64\}.obj:
  261. -$(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$(@R).pp
  262. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$(@R).pp
  263. del $(MAKEDIR)\$(@R).pp
  264. {amd64\}.asm{$(_OBJ_DIR)\amd64\}.obj:
  265. -$(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$(@R).pp
  266. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$(@R).pp
  267. del $(MAKEDIR)\$(@R).pp
  268. {$(O)\}.asm{$(O)\}.obj:
  269. -$(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$(@R).pp
  270. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$(@R).pp
  271. del $(MAKEDIR)\$(@R).pp
  272. !endif
  273. !IFDEF _NTAMD64LIBS
  274. _NTLIBS=$(_NTAMD64LIBS)
  275. !ENDIF
  276. COPYDST=$(AMD64COPYDST)
  277. LIB_COPY=ntamd64cp.cmd
  278. !IF "$(NTDEBUGTYPE)" == "windbg" || "$(NTDEBUGTYPE)" == "both"
  279. NTTEST_LINK_OPTIONS=-entry:KiSystemStartup
  280. !ELSE
  281. NTTEST_LINK_OPTIONS=-base:0x80100000 -entry:KiSystemStartup
  282. !ENDIF
  283. LINKER_FLAGS=$(LINKER_FLAGS) /opt:nowin98
  284. DRIVER_ALIGNMENT=0x0080
  285. KERNEL_ALIGNMENT=0x1000