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.

411 lines
9.6 KiB

  1. !IF 0
  2. Copyright (c) 1994-1996 Microsoft Corporation
  3. Module Name:
  4. i386mk.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. # x86 option control
  16. #
  17. UMBASE=$(UMBASE:*=i386)
  18. UMLIBS=$(UMLIBS:*=i386)
  19. NTRES=$(NTRES:*=i386)
  20. UMRES=$(UMRES:*=i386)
  21. UMOBJS=$(UMOBJS:*=i386)
  22. LINKLIBS=$(LINKLIBS:*=i386)
  23. GDI_DRIVER_LIBS=$(GDI_DRIVER_LIBS:*=i386)
  24. DLLBASE=$(DLLBASE:*=i386)
  25. DLLDEF=$(DLLDEF:*=i386)
  26. MACHINE_TARGETLIBS=$(MACHINE_TARGETLIBS:*=i386)
  27. !ifdef USE_MSHTML_PDB_RULES
  28. MACHINE_TARGETLIBS=$(MACHINE_TARGETLIBS:????????=*)
  29. !endif
  30. TARGET=$(TARGET:*=i386)
  31. DYNLINK_LIB=$(DYNLINK_LIB:*=i386)
  32. TARGETEXEFILES=$(TARGETEXEFILES:*=i386)
  33. TARGETLIBFILES=$(TARGETLIBFILES:*=i386)
  34. TARGETOBJFILES=$(TARGETOBJFILES:*=i386)
  35. UMOBJFILES=$(UMOBJFILES:*=i386)
  36. UMEXEFILES=$(UMEXEFILES:*=i386)
  37. HEADERFILE=$(HEADERFILE:*=i386)
  38. HEADEROBJNAME=$(HEADEROBJNAME:*=i386)
  39. HEADEROBJ=$(HEADEROBJ:*=i386)
  40. PRECOMPILED=$(PRECOMPILED:*=i386)
  41. PRECOMPILED_CXX=$(PRECOMPILED_CXX:*=i386)
  42. PRECOMPILED_TARGET=$(PRECOMPILED_TARGET:*=i386)
  43. MFC_STATIC_LIB=$(MFC_STATIC_LIB:*=i386)
  44. CRT_LIB_PATH=$(CRT_LIB_PATH:*=i386)
  45. SDK_LIB_PATH=$(SDK_LIB_PATH:*=i386)
  46. DDK_LIB_PATH=$(DDK_LIB_PATH:*=i386)
  47. IFSKIT_LIB_PATH=$(IFSKIT_LIB_PATH:*=i386)
  48. HALKIT_LIB_PATH=$(HALKIT_LIB_PATH:*=i386)
  49. PROCESSOR_LIB_PATH=$(PROCESSOR_LIB_PATH:*=i386)
  50. ORDER=$(ORDER:*=i386)
  51. OBJLIBFILES=$(OBJLIBFILES:*=i386)
  52. MISCFILES=$(MISCFILES) $(I386_MISCFILES)
  53. !ifdef CHICAGO_PRODUCT
  54. USE_MAPSYM=1
  55. !endif
  56. # "$(TARGETTYPE)"=="DRIVER" ||
  57. # "$(TARGETTYPE)" == "HAL" ||
  58. # "$(TARGETTYPE)" == "EXPORT_DRIVER" ||
  59. !IF "$(TARGETTYPE)"=="GDI_DRIVER" || \
  60. "$(TARGETTYPE)"=="MINIPORT"
  61. #
  62. #Drivers don't link with link libs.
  63. #
  64. MACHINE_TARGETLIBS=$(SDK_LIB_PATH)\int64.lib $(MACHINE_TARGETLIBS)
  65. !ELSE
  66. !IF defined(USE_NTDLL) || defined (USE_NOLIBS)
  67. MACHINE_TARGETLIBS=$(SDK_LIB_PATH)\int64.lib $(MACHINE_TARGETLIBS)
  68. !ENDIF
  69. !ENDIF
  70. !ifdef NTTARGETFILES
  71. NTTARGETFILES=$(NTTARGETFILES:*=i386)
  72. !endif
  73. !ifdef NTTARGETFILE0
  74. NTTARGETFILE0=$(NTTARGETFILE0:*=i386)
  75. !endif
  76. !ifdef NTTARGETFILE1
  77. NTTARGETFILE1=$(NTTARGETFILE1:*=i386)
  78. !endif
  79. !ifdef PROJECT_LIB_PATH
  80. PROJECT_LIB_PATH=$(PROJECT_LIB_PATH:*=i386)
  81. !endif
  82. !IF "$(DLLENTRY)" != "-noentry"
  83. ! IF "$(DLLENTRY:@12=)" == "$(DLLENTRY)"
  84. DLLENTRY=$(DLLENTRY)@12
  85. ! ENDIF
  86. !ENDIF
  87. !IFDEF STD_CALL_ENTRY
  88. UMENTRY=$(UMENTRY)@4
  89. !ENDIF
  90. ENTRY_SUFFIX=@8
  91. GDI_ENTRY_SUFFIX=@12
  92. DEFAULT_STACKRESERVE=0x40000
  93. DEFAULT_STACKCOMMIT=0x1000
  94. ADDITIONAL_ATL_LIBS = $(ADDITIONAL_ATL_LIBS)
  95. !IFDEF 386_WARNING_LEVEL
  96. MSC_WARNING_LEVEL=$(386_WARNING_LEVEL)
  97. !ENDIF
  98. MSC_WARNING_LEVEL=$(MSC_WARNING_LEVEL) /WX
  99. !ifdef 386_PERFFLAGS
  100. PERFFLAGS = $(386_PERFFLAGS)
  101. !endif
  102. # Set MSC_OPTIMIZATION.
  103. # Order of precedence:
  104. # Platform specific override
  105. # Environment variable
  106. # System Default
  107. !if defined(386_OPTIMIZATION)
  108. MSC_OPTIMIZATION=$(386_OPTIMIZATION)
  109. !elseif !defined(MSC_OPTIMIZATION)
  110. MSC_OPTIMIZATION=$(DEFAULT_MSC_OPT)
  111. !endif
  112. LINK_TIME_CODE_GENERATION_MSC_OPTIMIZATION=
  113. !if defined(LINK_TIME_CODE_GENERATION) && !defined(FORCENATIVEOBJECT)
  114. # Some objects must be built native, so turn off GL for those
  115. LINK_TIME_CODE_GENERATION_MSC_OPTIMIZATION=/GL
  116. MSC_OPTIMIZATION=$(MSC_OPTIMIZATION) $(LINK_TIME_CODE_GENERATION_MSC_OPTIMIZATION)
  117. !endif
  118. DBGFLAGS=$(DBGFLAGS) $(MSC_OPTIMIZATION)
  119. !IFDEF 386_CPPFLAGS
  120. MSC_CPPFLAGS=$(386_CPPFLAGS)
  121. !ENDIF
  122. !ifdef NO_STRING_POOLING
  123. STRING_POOLING =
  124. !else
  125. !ifdef NO_READONLY_STRINGS
  126. STRING_POOLING = /Gf
  127. !else
  128. STRING_POOLING = /GF
  129. !endif
  130. !endif
  131. !ifdef USE_NATIVE_EH
  132. EH_FLAGS=/GX
  133. !if "$(USE_NATIVE_EH)" == "ASYNC"
  134. EH_FLAGS=$(EH_FLAGS) /EHa
  135. !endif
  136. !else
  137. EH_FLAGS=/GX-
  138. !endif
  139. !ifdef USE_RTTI
  140. RTTI_FLAGS=/GR
  141. !else
  142. RTTI_FLAGS=/GR-
  143. !endif
  144. !ifdef BUFFER_OVERFLOW_CHECKS
  145. BO_FLAGS=/GS
  146. BO_LIB=$(SDK_LIB_PATH)\BufferOverflow.lib
  147. !endif
  148. !ifdef USE_INCREMENTAL_COMPILING
  149. C_INCREMENTAL_FLAG = /Gi /Gm
  150. USE_PDB_TO_COMPILE = 1
  151. !else
  152. C_INCREMENTAL_FLAG = /Gi- /Gm-
  153. !undef USE_PDB_TO_COMPILE
  154. !endif
  155. !ifndef X86_CPU_OPTIMIZATION
  156. X86_CPU_OPTIMIZATION=/G6
  157. !endif
  158. !if defined(VC7_SYMBOLS) || ("$(TARGETTYPE)" == "GDI_DRIVER") || ("$(TARGETTYPE)" == "DRIVER") || ("$(TARGETTYPE)" == "EXPORT_DRIVER")
  159. !if [set _CL_=]
  160. !endif
  161. !if [set _LINK_=]
  162. !endif
  163. !if [set _ML_=]
  164. !endif
  165. !endif
  166. # Undocumented switch definitions
  167. # /QIfdiv- : Don't emit code to test for bad pentiums
  168. # /QIf : Emit FPO records for every function
  169. ERATTA_FLAGS=/QIfdiv- /QIf
  170. STDFLAGS= /c /Zel /Zp8 /Gy $(CBSTRING) $(MSC_WARNING_LEVEL) $(MSC_CALL_TYPE) \
  171. $(ERATTA_FLAGS) $(X86_CPU_OPTIMIZATION) $(C_INCREMENTAL_FLAG) $(EH_FLAGS) \
  172. $(RTTI_FLAGS) $(STRING_POOLING) $(BO_FLAGS)
  173. !IF "$(386_STDCALL)" == "0"
  174. MSC_CALL_TYPE=/Gd
  175. MSC_CALL_DEFINE=
  176. !ELSE
  177. ! IF "$(386_STDCALL)" == "2"
  178. MSC_CALL_TYPE=/Gr
  179. MSC_CALL_DEFINE=
  180. ! ELSE
  181. MSC_CALL_TYPE=/Gz
  182. MSC_CALL_DEFINE=-DSTD_CALL
  183. ! ENDIF
  184. !ENDIF
  185. !IF $(FREEBUILD)
  186. ASM_DBG_DEFINES=-DDBG=0
  187. ! IFDEF NTNOFPO
  188. !MESSAGE $(NTMAKEENV)\i386mk.inc(1) : Overriding FPO default with NTNOFPO
  189. TARGET_DBG_DEFINES= $(TARGET_DBG_DEFINES) -DFPO=0
  190. DBGFLAGS=$(DBGFLAGS) /Oy-
  191. ! ELSE
  192. TARGET_DBG_DEFINES= $(TARGET_DBG_DEFINES) -DFPO=1
  193. DBGFLAGS=$(DBGFLAGS) /Oy
  194. ! ENDIF
  195. !ELSE
  196. TARGET_DBG_DEFINES= $(TARGET_DBG_DEFINES) -DFPO=0
  197. DBGFLAGS=$(DBGFLAGS) /Oy-
  198. 386_ADBGFLAGS=$(386_ADBGFLAGS) /Zi
  199. !ENDIF
  200. # @@BEGIN_DDKSPLIT
  201. !IFDEF NTBBT
  202. DBGFLAGS=$(DBGFLAGS) /Zi
  203. 386_ADBGFLAGS=$(386_ADBGFLAGS) /Zi
  204. LINKER_FLAGS=$(LINKER_FLAGS) -debug:full -debugtype:cv,fixup
  205. USE_PDB=1
  206. !ENDIF
  207. # @@END_DDKSPLIT
  208. !ifndef USE_PDB_TO_COMPILE
  209. DBGFLAGS=$(DBGFLAGS:/Zi=-Z7)
  210. DBGFLAGS=$(DBGFLAGS:-Zi=-Z7)
  211. !else
  212. ! ifndef USE_MSHTML_PDB_RULES
  213. ! if "$(TARGETTYPE)" == "LIBRARY"
  214. DBGFLAGS=$(DBGFLAGS) /Fd$(TARGETPATH)\$(TARGET_DIRECTORY)\$(TARGETNAME).pdb
  215. ! else
  216. DBGFLAGS=$(DBGFLAGS) /Fd$(MAKEDIR)\$(_OBJ_DIR)\i386^\
  217. ! endif
  218. ! else
  219. ! ifndef TARGETPDB
  220. TARGETPDB=$(TARGETNAME)
  221. ! endif
  222. ! ifndef ROOT
  223. ROOT=$(MAKEDIR)
  224. ! endif
  225. DBGFLAGS=$(DBGFLAGS) /Fd$(ROOT)\$(_OBJ_DIR)\i386\$(TARGETPDB).pdb
  226. ! endif
  227. !endif
  228. !ifndef NO_BROWSER_INFO
  229. ! ifdef BROWSER_INFO
  230. DBGFLAGS=$(DBGFLAGS) /FR$(MAKEDIR)\$(_OBJ_DIR)\i386^\
  231. ! endif
  232. !endif
  233. #
  234. # 386 option control
  235. #
  236. !IF "$(HALTYPE)" == ""
  237. HALDEF=
  238. !ELSE
  239. HALDEF=-D$(HALTYPE)=1
  240. !ENDIF
  241. STD_DEFINES= -D_X86_=1 -Di386=1 $(HALDEF) $(MSC_CALL_DEFINE) $(STD_DEFINES)
  242. CDEFINES=$(STD_DEFINES) $(TARGET_DBG_DEFINES) \
  243. $(LIBC_DEFINES) $(C_DEFINES) $(NET_C_DEFINES) $(MFC_DEFINES)
  244. CFLAGS=$(386_FLAGS) $(NT386FLAGS) $(STDFLAGS) $(DBGFLAGS) $(PERFFLAGS) $(USER_C_FLAGS)
  245. !ifdef MANAGED_CXX
  246. CFLAGS=/clr $(CFLAGS)
  247. !endif
  248. 386_ASMFLAGS=$(386_ADBGFLAGS) $(STD_DEFINES) $(ASM_DBG_DEFINES)\
  249. $(TARGET_DBG_DEFINES) $(ASM_DEFINES)
  250. 386_CDEFINES=$(CDEFINES)
  251. 386_CFLAGS=$(CFLAGS)
  252. !if "$(SUBSTITUTE_386_CC)" != ""
  253. CC_NAME = $(SUBSTITUTE_386_CC) -nologo
  254. !else
  255. CC_NAME = cl -nologo
  256. !endif
  257. C_COMPILER_NAME = $(CC_NAME)
  258. CXX_COMPILER_NAME = $(CC_NAME)
  259. C_PREPROCESSOR_NAME = $(CC_NAME)
  260. CS_COMPILER_NAME = csc.exe -nologo
  261. VB_NET_COMPILER_NAME = vbc.exe -nologo
  262. !if "$(UNSAFE_CODE)" != ""
  263. UNSAFE_CODE=/unsafe
  264. !endif
  265. MANAGED_STD_FLAGS = /warnaserror+ $(UNSAFE_CODE) $(USER_CS_FLAGS) $(USER_VB_NET_FLAGS)
  266. !if defined(PERF_INSTRUMENTATION)
  267. MANAGED_STD_FLAGS=$(MANAGED_STD_FLAGS) /define:PROFILE
  268. !endif
  269. !ifndef 386_ASSEMBLER_NAME
  270. 386_ASSEMBLER_NAME = ml
  271. !endif
  272. GLOBAL_C_FLAGS = -Ii386\ -I. $(INCPATH1) $(CDEFINES) $(CFLAGS)
  273. NP_COMPILER_FLAGS = $(GLOBAL_C_FLAGS) $(COMPILER_WARNINGS)
  274. C_COMPILER_FLAGS = $(NP_COMPILER_FLAGS) $(PRECOMPILED)
  275. CXX_COMPILER_FLAGS = $(NP_COMPILER_FLAGS) $(PRECOMPILED_CXX) $(MSC_CPPFLAGS) $(NTCPPFLAGS)
  276. C_PREPROCESSOR_FLAGS = $(GLOBAL_C_FLAGS) -EP -Tc
  277. C_PREPROCESSOR = $(C_PREPROCESSOR_NAME) $(C_PREPROCESSOR_FLAGS)
  278. C_COMPILER = $(C_COMPILER_NAME) $(C_COMPILER_FLAGS)
  279. NP_C_COMPILER = $(C_COMPILER_NAME) $(NP_COMPILER_FLAGS)
  280. CXX_COMPILER = $(CXX_COMPILER_NAME) $(CXX_COMPILER_FLAGS)
  281. !if defined(NOMASMCOMPATIBILITY)
  282. 386_ASSEMBLER=$(386_ASSEMBLER_NAME) -c -coff -Cx -nologo -Ii386\ -I. $(INCPATH1) $(386_ASMFLAGS)
  283. !else
  284. 386_ASSEMBLER=$(386_ASSEMBLER_NAME) -c -coff -Cx -nologo -Ii386\ -I. $(INCPATH1) -Zm $(386_ASMFLAGS)
  285. !endif
  286. ECHO_MSG=$(C_COMPILER) $<
  287. ECHO_MSG_P=$(NP_C_COMPILER) $**
  288. ECHO_CXX_MSG=$(CXX_COMPILER) $<
  289. ECHO_PRECOMPILED_MSG1=$(C_COMPILER_NAME) $(PRECOMPILED_FLAG) $(PRECOMPILED_SOURCEFILE) \
  290. $(C_COMPILER_FLAGS) /Yl$(TARGETNAME) /Yc$(?F) $(HEADERFILE) $(HEADEROBJ)
  291. ECHO_PRECOMPILED_MSG2=$(C_COMPILER_NAME) $(PRECOMPILED_FLAG) \
  292. $(C_COMPILER_FLAGS) /Yl$(TARGETNAME) /Yc$(?F) $(HEADERFILE) $(HEADEROBJ)
  293. {}.c{}.asm:
  294. $(C_COMPILER_NAME) @<< /Fa $(MAKEDIR)\$(<F)
  295. $(C_COMPILER_FLAGS: =
  296. )
  297. $(C_COMPILER_FLAGS:##= )
  298. <<NOKEEP
  299. {..\i386\}.asm{}.lst:
  300. $(386_ASSEMBLER) /Fl$@ /Fo$(_OBJ_DIR)\i386\$(@B).obj $(MAKEDIR)\$<
  301. {i386\}.asm{}.lst:
  302. $(386_ASSEMBLER) /Fl$@ /Fo$(MAKEDIR)\$(_OBJ_DIR)\i386\$(@B).obj $(MAKEDIR)\$<
  303. {..\i386\}.asm{$(_OBJ_DIR)\i386\}.obj:
  304. $(386_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
  305. {$(_OBJ_DIR)\i386\}.asm{$(_OBJ_DIR)\i386\}.obj:
  306. $(386_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
  307. {i386\}.asm{$(_OBJ_DIR)\i386\}.obj:
  308. $(386_ASSEMBLER) -Fo$(MAKEDIR)\$@ $(MAKEDIR)\$<
  309. !IFDEF _NT386LIBS
  310. _NTLIBS=$(_NT386LIBS)
  311. !ENDIF
  312. COPYDST=$(386COPYDST)
  313. LIB_COPY=nti386cp.cmd
  314. !IF "$(NTDEBUGTYPE)" == "windbg" || "$(NTDEBUGTYPE)" == "both"
  315. NTTEST_LINK_OPTIONS=-entry:KiSystemStartup@4
  316. !ELSE
  317. NTTEST_LINK_OPTIONS=-base:0x80100000 -entry:KiSystemStartup@4
  318. !ENDIF
  319. !if defined(LINKER_WIN98OPT) || defined (CHICAGO_PRODUCT)
  320. LINKER_FLAGS=$(LINKER_FLAGS) /opt:win98
  321. !else
  322. LINKER_FLAGS=$(LINKER_FLAGS) /opt:nowin98
  323. !endif
  324. # SEH support for libs built with an older compiler
  325. # @@BEGIN_DDKSPLIT
  326. !if 0
  327. # @@END_DDKSPLIT
  328. !if defined(_NT_TARGET_VERSION)
  329. ! if $(_NT_TARGET_VERSION) < 0x501 && $(_NT_TOOLS_VERSION) >= 0x700
  330. TARGETLIBS=$(TARGETLIBS) $(DDK_LIB_PATH)\sehupd.lib
  331. ! endif
  332. !endif
  333. # @@BEGIN_DDKSPLIT
  334. !endif
  335. # @@END_DDKSPLIT