Source code of Windows XP (NT5)
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.

351 lines
8.7 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. ADDITIONAL_ATL_LIBS = $(ADDITIONAL_ATL_LIBS) $(SDK_LIB_PATH)\atlamd64.lib
  54. !ifdef NTTARGETFILES
  55. NTTARGETFILES=$(NTTARGETFILES:*=amd64)
  56. !endif
  57. !ifdef NTTARGETFILE0
  58. NTTARGETFILE0=$(NTTARGETFILE0:*=amd64)
  59. !endif
  60. !ifdef NTTARGETFILE1
  61. NTTARGETFILE1=$(NTTARGETFILE1:*=amd64)
  62. !endif
  63. !ifdef PROJECT_LIB_PATH
  64. PROJECT_LIB_PATH=$(PROJECT_LIB_PATH:*=amd64)
  65. !endif
  66. ENTRY_SUFFIX=
  67. GDI_ENTRY_SUFFIX=
  68. DEFAULT_STACKRESERVE=0x40000
  69. DEFAULT_STACKCOMMIT=0x1000
  70. ADDITIONAL_ATL_LIBS = $(ADDITIONAL_ATL_LIBS)
  71. !IFDEF AMD64_WARNING_LEVEL
  72. MSC_WARNING_LEVEL=$(AMD64_WARNING_LEVEL)
  73. !ENDIF
  74. MSC_WARNING_LEVEL=$(MSC_WARNING_LEVEL) /Wp64 /WX
  75. !ifdef AMD64_PERFFLAGS
  76. PERFFLAGS = $(AMD64_PERFFLAGS)
  77. !endif
  78. # Set MSC_OPTIMIZATION.
  79. # Order of precedence:
  80. # Platform specific override
  81. # Environment variable
  82. # System Default
  83. !if defined(AMD64_OPTIMIZATION)
  84. MSC_OPTIMIZATION=$(AMD64_OPTIMIZATION)
  85. !elseif !defined(MSC_OPTIMIZATION)
  86. MSC_OPTIMIZATION=$(DEFAULT_MSC_OPT)
  87. !endif
  88. DBGFLAGS=$(DBGFLAGS) $(MSC_OPTIMIZATION)
  89. WIN32_LIBS=$(WIN32_LIBS) $(LIBRARY_PATH)\ntdll.lib
  90. !IFDEF AMD64_CPPFLAGS
  91. MSC_CPPFLAGS=$(AMD64_CPPFLAGS)
  92. !ENDIF
  93. !ifdef NO_STRING_POOLING
  94. STRING_POOLING =
  95. !else
  96. !ifdef NO_READONLY_STRINGS
  97. STRING_POOLING = /Gf
  98. !else
  99. STRING_POOLING = /GF
  100. !endif
  101. !endif
  102. !ifdef USE_NATIVE_EH
  103. EH_FLAGS=/GX
  104. !if "$(USE_NATIVE_EH)" == "ASYNC"
  105. EH_FLAGS=$(EH_FLAGS) /EHa
  106. !endif
  107. !else
  108. EH_FLAGS=/GX-
  109. !endif
  110. ! ifdef USE_RTTI
  111. RTTI_FLAGS=/GR
  112. ! else
  113. RTTI_FLAGS=/GR-
  114. ! endif
  115. !ifdef USE_INCREMENTAL_COMPILING
  116. C_INCREMENTAL_FLAG = /Gi
  117. USE_PDB_TO_COMPILE = 1
  118. !else
  119. C_INCREMENTAL_FLAG = /Gi-
  120. !undef USE_PDB_TO_COMPILE
  121. !endif
  122. !ifndef AMD64_CPU_OPTIMIZATION
  123. AMD64_CPU_OPTIMIZATION=
  124. !endif
  125. STDFLAGS= /c /Zel /Zp8 /Gy $(CBSTRING) $(MSC_WARNING_LEVEL) $(MSC_CALL_TYPE) \
  126. $(ERATTA_FLAGS) $(AMD64_CPU_OPTIMIZATION) $(C_INCREMENTAL_FLAG) $(EH_FLAGS) \
  127. $(RTTI_FLAGS) $(STRING_POOLING)
  128. !if $(FREEBUILD)
  129. ASM_DBG_DEFINES=-DDBG=0
  130. !else
  131. AMD64_ADBGFLAGS=$(AMD64_ADBGFLAGS) /Zi
  132. !endif
  133. # @@BEGIN_DDKSPLIT
  134. !IFDEF NTBBT
  135. DBGFLAGS=$(DBGFLAGS) /Zi
  136. AMD64_ADBGFLAGS=$(AMD64_ADBGFLAGS) /Zi
  137. LINKER_FLAGS=$(LINKER_FLAGS) -debug:full -debugtype:cv,fixup
  138. USE_PDB=1
  139. !ENDIF
  140. # @@END_DDKSPLIT
  141. !ifndef USE_PDB_TO_COMPILE
  142. DBGFLAGS=$(DBGFLAGS:/Zi=-Z7)
  143. DBGFLAGS=$(DBGFLAGS:-Zi=-Z7)
  144. !else
  145. ! ifndef USE_MSHTML_PDB_RULES
  146. ! if "$(TARGETTYPE)" == "LIBRARY"
  147. DBGFLAGS=$(DBGFLAGS) /Fd$(TARGETPATH)\$(TARGET_DIRECTORY)\$(TARGETNAME).pdb
  148. ! else
  149. DBGFLAGS=$(DBGFLAGS) /Fd$(MAKEDIR)\$(_OBJ_DIR)\AMD64^\
  150. ! endif
  151. ! else
  152. ! ifndef TARGETPDB
  153. TARGETPDB=$(TARGETNAME)
  154. ! endif
  155. ! ifndef ROOT
  156. ROOT=$(MAKEDIR)
  157. ! endif
  158. DBGFLAGS=$(DBGFLAGS) /Fd$(ROOT)\$(_OBJ_DIR)\amd64\$(TARGETPDB).pdb
  159. ! endif
  160. !endif
  161. !ifndef NO_BROWSER_INFO
  162. ! ifdef BROWSER_INFO
  163. DBGFLAGS=$(DBGFLAGS) /FR$(MAKEDIR)\$(_OBJ_DIR)\amd64^\
  164. ! endif
  165. !endif
  166. #
  167. # amd64 option control
  168. #
  169. !IF "$(HALTYPE)" == ""
  170. HALDEF=
  171. !ELSE
  172. HALDEF=-D$(HALTYPE)=1
  173. !ENDIF
  174. STD_DEFINES=-D_WIN64 -D_AMD64_ -DAMD64 $(HALDEF) $(MSC_CALL_DEFINE) $(STD_DEFINES)
  175. #
  176. # This indicates that we are compiling for a siulated (i.e. slow)
  177. # environment.
  178. #
  179. # Remove this when we get a faster environment.
  180. #
  181. STD_DEFINES=$(STD_DEFINES)
  182. CDEFINES=$(STD_DEFINES) $(TARGET_DBG_DEFINES) \
  183. $(LIBC_DEFINES) $(C_DEFINES) $(NET_C_DEFINES) $(MFC_DEFINES)
  184. CFLAGS=$(AMD64_FLAGS) $(NTAMD64FLAGS) $(STDFLAGS) $(DBGFLAGS) $(PERFFLAGS) $(USER_C_FLAGS)
  185. AMD64_ASMFLAGS=$(AMD64_ADBGFLAGS) $(STD_DEFINES) $(ASM_DBG_DEFINES)\
  186. $(TARGET_DBG_DEFINES) $(ASM_DEFINES)
  187. AMD64_CDEFINES=$(CDEFINES)
  188. AMD64_CFLAGS=$(CFLAGS)
  189. CC_NAME = cl -nologo
  190. C_COMPILER_NAME = $(CC_NAME)
  191. CXX_COMPILER_NAME = $(CC_NAME)
  192. C_PREPROCESSOR_NAME = $(CC_NAME)
  193. !ifndef AMD64_ASSEMBLER_NAME
  194. AMD64_ASSEMBLER_NAME = ml64
  195. !endif
  196. GLOBAL_C_FLAGS = -Iamd64\ -I. $(INCPATH1) $(CDEFINES) $(CFLAGS) -d2home
  197. NP_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(COMPILER_WARNINGS)
  198. C_COMPILER_FLAGS = $(NP_COMPILER_FLAGS) $(PRECOMPILED)
  199. CXX_COMPILER_FLAGS = $(NP_COMPILER_FLAGS) $(PRECOMPILED_CXX) $(MSC_CPPFLAGS) $(NTCPPFLAGS)
  200. C_PREPROCESSOR_FLAGS = $(GLOBAL_C_FLAGS) /d1noWchar_t -EP -Tc
  201. C_PREPROCESSOR = $(C_PREPROCESSOR_NAME) $(C_PREPROCESSOR_FLAGS)
  202. C_ASM_PREPROCESSOR = $(C_PREPROCESSOR_NAME) $(ASM_DEFINES) $(C_PREPROCESSOR_FLAGS)
  203. C_COMPILER = $(C_COMPILER_NAME) $(C_COMPILER_FLAGS)
  204. NP_C_COMPILER = $(C_COMPILER_NAME) $(NP_COMPILER_FLAGS)
  205. CXX_COMPILER = $(CXX_COMPILER_NAME) $(CXX_COMPILER_FLAGS)
  206. AMD64_ASSEMBLER=$(AMD64_ASSEMBLER_NAME) -c -coff -Cx -nologo -Iamd64\ -I. $(INCPATH1) $(AMD64_ASMFLAGS)
  207. ECHO_MSG=$(C_COMPILER) $<
  208. ECHO_MSG_P=$(NP_C_COMPILER) $**
  209. ECHO_CXX_MSG=$(CXX_COMPILER) $<
  210. ECHO_PRECOMPILED_MSG1=$(C_COMPILER_NAME) $(PRECOMPILED_FLAG) $(PRECOMPILED_SOURCEFILE) \
  211. $(C_COMPILER_FLAGS) /Yl$(TARGETNAME) /Yc$(?F) $(HEADERFILE) $(HEADEROBJ)
  212. ECHO_PRECOMPILED_MSG2=$(C_COMPILER_NAME) $(PRECOMPILED_FLAG) \
  213. $(C_COMPILER_FLAGS) /Yl$(TARGETNAME) /Yc$(?F) $(HEADERFILE) $(HEADEROBJ)
  214. {}.c{}.asm:
  215. $(C_COMPILER_NAME) @<< /Fa $(MAKEDIR)\$(<F)
  216. $(C_COMPILER_FLAGS: =
  217. )
  218. $(C_COMPILER_FLAGS:##= )
  219. <<NOKEEP
  220. #
  221. # Here is a workaround for a masm code generation bug having to do with
  222. # broken interaction between the preprocessor and the code generator.
  223. #
  224. # The workaround is to generate a preprocessed file first, then assemble
  225. # that. When the assembler is fixed, delete the following !if-related
  226. # statements and the stuff in the !else block.
  227. #
  228. {..\amd64\}.asm{}.pp:
  229. $(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$@
  230. {amd64\}.asm{}.pp:
  231. $(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$@
  232. !if 1
  233. {..\amd64\}.asm{}.lst:
  234. $(AMD64_ASSEMBLER) /Fl$@ /Fo$(_OBJ_DIR)\amd64\$(@B).obj $(MAKEDIR)\$<
  235. {amd64\}.asm{}.lst:
  236. $(AMD64_ASSEMBLER) /Fl$@ /Fo$(MAKEDIR)\$(_OBJ_DIR)\amd64\$(@B).obj $(MAKEDIR)\$<
  237. {..\amd64\}.asm{$(_OBJ_DIR)\amd64\}.obj:
  238. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
  239. {amd64\}.asm{$(_OBJ_DIR)\amd64\}.obj:
  240. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
  241. {$(O)\}.asm{$(O)\}.obj:
  242. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
  243. !else
  244. {..\amd64\}.asm{}.lst:
  245. -$(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$(@R).pp
  246. $(AMD64_ASSEMBLER) /Fl$@ /Fo$(_OBJ_DIR)\amd64\$(@B).obj $(MAKEDIR)\$(@R).pp
  247. del $(MAKEDIR)\$(@R).pp
  248. {amd64\}.asm{}.lst:
  249. -$(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$(@R).pp
  250. $(AMD64_ASSEMBLER) /Fl$@ /Fo$(MAKEDIR)\$(_OBJ_DIR)\amd64\$(@B).obj $(MAKEDIR)\$(@R).pp
  251. del $(MAKEDIR)\$(@R).pp
  252. {..\amd64\}.asm{$(_OBJ_DIR)\amd64\}.obj:
  253. -$(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$(@R).pp
  254. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$(@R).pp
  255. del $(MAKEDIR)\$(@R).pp
  256. {amd64\}.asm{$(_OBJ_DIR)\amd64\}.obj:
  257. -$(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$(@R).pp
  258. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$(@R).pp
  259. del $(MAKEDIR)\$(@R).pp
  260. {$(O)\}.asm{$(O)\}.obj:
  261. -$(AMD64_ASSEMBLER) -Zs /EP $(MAKEDIR)\$< > $(MAKEDIR)\$(@R).pp
  262. $(AMD64_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$(@R).pp
  263. del $(MAKEDIR)\$(@R).pp
  264. !endif
  265. !IFDEF _NTAMD64LIBS
  266. _NTLIBS=$(_NTAMD64LIBS)
  267. !ENDIF
  268. COPYDST=$(AMD64COPYDST)
  269. LIB_COPY=ntamd64cp.cmd
  270. !IF "$(NTDEBUGTYPE)" == "windbg" || "$(NTDEBUGTYPE)" == "both"
  271. NTTEST_LINK_OPTIONS=-entry:KiSystemStartup
  272. !ELSE
  273. NTTEST_LINK_OPTIONS=-base:0x80100000 -entry:KiSystemStartup
  274. !ENDIF
  275. LINKER_FLAGS=$(LINKER_FLAGS) /opt:nowin98
  276. DRIVER_ALIGNMENT=0x0080
  277. KERNEL_ALIGNMENT=0x1000