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.

313 lines
7.2 KiB

  1. @if "%_echo%"=="" echo off
  2. setlocal
  3. @rem
  4. @rem Build different targets based on arguments passed in
  5. @rem
  6. @rem
  7. @rem Parse command line arguments
  8. @rem
  9. @rem
  10. @rem Please name all local variables to handle arguments "_ArgWhatever".
  11. @rem
  12. set _ArgBuildOpt=
  13. set _ArgFree=false
  14. set _ArgDebug=false
  15. set _ArgProfile=false
  16. set _ArgMeter=false
  17. set _ArgNoOpt=false
  18. set _ArgWin64=false
  19. set _ArgAmd64=false
  20. set _ArgTargetSet=false
  21. set _ArgDumpEnv=false
  22. :NextArg
  23. if "%1" == "help" goto Usage
  24. if "%1" == "-?" goto Usage
  25. if "%1" == "/?" goto Usage
  26. if "%1" == "-help" goto Usage
  27. if "%1" == "/help?" goto Usage
  28. if /I "%1" == "retail" set _ArgFree=true&goto ArgOK
  29. if /I "%1" == "debug" set _ArgFree=false&goto ArgOk
  30. if /I "%1" == "profile" set _ArgProfile=true&goto ArgOk
  31. if /I "%1" == "meter" set _ArgMeter=true&goto ArgOk
  32. if /I "%1" == "no_opt" set _ArgNoOpt=true&goto ArgOK
  33. if /I "%1" == "Win64" set _ArgWin64=true&goto ArgOK
  34. if /I "%1" == "Amd64" set _ArgAmd64=true&goto ArgOK
  35. if /I "%1" == "dumpenv" set _ArgDumpEnv=true&goto ArgOK
  36. if NOT "%1" == "" set _ArgBuildOpt=%_ArgBuildOpt% %1
  37. if "%1" == "" goto :GetStarted
  38. :ArgOK
  39. shift
  40. goto :NextArg
  41. :GetStarted
  42. @rem
  43. @rem Process options
  44. @rem
  45. set USE_ICECAP=
  46. set USE_ICECAP4=
  47. set BSCMAKE_PATH=
  48. @rem Free build
  49. if "%_ArgFree%"=="false" goto NoFree
  50. if "%_ArgTargetSet%"=="true" goto usagerestore
  51. set NTDEBUG=ntsdnodbg
  52. set NTDEBUGTYPE=windbg
  53. if "%BUILD_PRODUCT%" == "IE" (
  54. set _BuildType=retail
  55. ) else (
  56. set _BuildType=fre
  57. )
  58. set BUILD_ALT_DIR=
  59. set _ArgTargetSet=true
  60. :NoFree
  61. @rem Profile build
  62. if "%_ArgProfile%"=="false" goto NoProfile
  63. if "%_ArgTargetSet%"=="true" goto usagerestore
  64. set NTDEBUG=ntsdnodbg
  65. set NTDEBUGTYPE=windbg
  66. set _BuildType=profile
  67. if "%USE_ICECAP4_ICEPICK%" == "" goto no_icecap4_icepick
  68. @rem Set us up so that we can use icepick on our build. We don't
  69. @rem want to use the icecap4 stuff that makefile.def has because
  70. @rem /fastcap sucks, but we do want to link with icecap.lib
  71. set USING_ICECAP4_ICEPICK=1
  72. goto icecap_vars_set
  73. :no_icecap4_icepick
  74. set USE_ICECAP=1
  75. :icecap_vars_set
  76. set BUILD_ALT_DIR=p
  77. set _ArgTargetSet=true
  78. :NoProfile
  79. @rem Meter build
  80. if "%_ArgMeter%"=="false" goto NoMeter
  81. if "%_ArgTargetSet%"=="true" goto usagerestore
  82. set NTDEBUG=ntsdnodbg
  83. set NTDEBUGTYPE=windbg
  84. set _BuildType=meter
  85. set C_DEFINES=%C_DEFINES% -DPERFMETER
  86. set BUILD_ALT_DIR=m
  87. set _ArgTargetSet=true
  88. :NoMeter
  89. @rem do this last so we can make it the default
  90. if "%_ArgTargetSet%"=="false" goto DoDebug
  91. if "%_ArgDebug%"=="false" goto NoDebug
  92. if "%_ArgTargetSet%"=="true" goto usagerestore
  93. :DoDebug
  94. set NTDEBUG=ntsd
  95. set NTDEBUGTYPE=windbg
  96. if "%BUILD_PRODUCT%" == "IE" (
  97. set _BuildType=debug
  98. ) else (
  99. set _BuildType=chk
  100. )
  101. set BUILD_ALT_DIR=d
  102. set _ArgTargetSet=true
  103. :NoDebug
  104. set _BuildOpt=full opt
  105. set MSC_OPTIMIZATION=
  106. if "%_ArgNoOpt%" == "true" set MSC_OPTIMIZATION=/Odi&& set _BuildOpt=no opt
  107. @rem
  108. @rem Take care of processor arch
  109. @rem
  110. set x86=
  111. set ia64=
  112. set amd64=
  113. set HOST_TOOLS=
  114. set _BuildArch=
  115. set 386=
  116. set BASE_OS_PATH=%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem
  117. @rem
  118. @rem check for Win64 cross building and define ToolPathWin64 tools\win64\<architecture>
  119. @rem
  120. if "%_ArgWin64%" == "false" goto NativeOnly
  121. set HOST_TOOLS="PATH=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%;%RazzleToolPath%;%BASE_OS_PATH%"
  122. set RazzleToolPath_Win64=%RazzleToolPath%\win64\%PROCESSOR_ARCHITECTURE%;
  123. if NOT "%_BuildArch%" == "" goto _BuildArchSet
  124. @rem
  125. @rem NOTE: _BuildArch is used by ntenv.cmd to set BUILD_DEFAULT_TARGET and the <architecture>
  126. @rem environment variable - set the Win64 values here
  127. @rem
  128. if NOT "%PROCESSOR_ARCHITECTURE%" == "x86" goto NativeOnly
  129. if "%_ArgAmd64%" == "false" set _BuildArch=ia64&& goto _BuildArchSet
  130. set RazzleToolPath_Win64=%RazzleToolPath%\win64\%PROCESSOR_ARCHITECTURE%\amd64;
  131. set _BuildArch=amd64
  132. goto _BuildArchSet
  133. :NativeOnly
  134. set _BuildArch=%PROCESSOR_ARCHITECTURE%
  135. set RazzleToolPath_Win64=
  136. if "%PROCESSOR_ARCHITECTURE%" == "x86" set 386=1
  137. :_BuildArchSet
  138. if "%PROCESSOR_ARCHITECTURE%" == "x86" set BSCMAKE_PATH=%USER_BSCMAKE_PATH%
  139. set BUILD_DEFAULT_TARGETS=-%_BuildArch%
  140. set %_BuildArch%=1
  141. set RazzleToolPath_Perl=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%\perl\bin;
  142. set PERL5LIB=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%\perl\site\lib;%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%\perl\lib
  143. set RazzleToolPath_Native=%RazzleToolPath%\%PROCESSOR_ARCHITECTURE%;
  144. @rem
  145. @rem Build up the path
  146. @rem
  147. set BUILD_PATH=%RazzleToolPath_Win64%%RazzleToolPath_Native%%RazzleToolPath_Perl%%RazzleToolPath%;%BSCMAKE_PATH%;%BASE_OS_PATH%
  148. set PATH=%BUILD_PATH%
  149. set RazzleToolPath_Win64=
  150. set RazzleToolPath_Perl=
  151. set RazzleToolPath_Native=
  152. set BASE_OS_PATH=
  153. set BSCMAKE_PATH=
  154. @rem
  155. @rem Setup default build parameters.
  156. @rem
  157. @rem BUGBUG: users original BUILD_DEFAULT_TARGETS not respected
  158. @rem
  159. set NTBBT=1
  160. set NO_MAPSYM=
  161. set BUILD_DEFAULT_TARGETS=-%_BuildArch%
  162. :BuildDefaultTargetSet
  163. if "%_BuildArch%" == "x86" goto UseX86BuildDefault
  164. set BUILD_DEFAULT=daytona ~win95 ~w95cpp ~w95c ~w5api ~chicago -e -E -w -nmake -i
  165. set NO_MAPSYM=1
  166. goto BuildDefaultSet
  167. :UseX86BuildDefault
  168. set BUILD_DEFAULT=daytona -e -E -w -nmake -i
  169. :BuildDefaultSet
  170. @rem
  171. @rem Take care of bin place and post build
  172. @rem
  173. if "%_NTTREE%" == "" goto NoBinplace
  174. for %%i in (%_NTTREE%) do set BinariesDir=%%~dpni
  175. set _NTx86TREE=
  176. set _NTia64TREE=
  177. set _NTAmd64TREE=
  178. if "%BUILD_PRODUCT%" == "IE" (
  179. set _NTTREE=%BinariesDir%\%_BuildType%
  180. ) else (
  181. set _NTTREE=%BinariesDir%.%_BuildArch%%_BuildType%
  182. )
  183. if "%BUILD_PRODUCT%" == "IE" (
  184. set _NT%_BuildArch%TREE=%BinariesDir%\%_BuildType%
  185. ) else (
  186. set _NT%_BuildArch%TREE=%BinariesDir%.%_BuildArch%%_BuildType%
  187. )
  188. set NTDBGFILES=1
  189. set NTDBGFILES_PRIVATE=1
  190. set BINPLACE_FLAGS=-xa
  191. if "%__MTSCRIPT_ENV_ID%"=="" (
  192. set BINPLACE_LOG=%BinariesDir%.%_BuildArch%%_BuildType%\build_logs\binplace.log
  193. ) else (
  194. set BINPLACE_LOG=%BinariesDir%.%_BuildArch%%_BuildType%\build_logs\binplace_%COMPUTERNAME%.log
  195. )
  196. if "%BUILD_PRODUCT%" == "IE" (
  197. set _BuildBins=binaries in: %BinariesDir%\%_BuildType%
  198. ) else (
  199. set _BuildBins=binaries in: %BinariesDir%.%_BuildArch%%_BuildType%
  200. )
  201. set BinariesDir=
  202. :NoBinplace
  203. @rem
  204. @rem Define %_NTPostBld% path
  205. @rem
  206. @rem BUGBUG: don't honor _NTPOSTBLD razzle argument
  207. set _NTPOSTBLD=%_NTTREE%
  208. set _PostBuildBins=
  209. @rem
  210. @rem Set logs directory
  211. @rem BUGBUG: don't honor razzle argument
  212. @rem
  213. set LOGS=%_NTPOSTBLD%\Build_Logs
  214. @rem
  215. @rem Show a working title on the window
  216. @rem
  217. set _ArgBuildTitle=Building: %_BuildArch%/%_BuildType%%_KernelType%/%_BuildOpt%/%_BuildBins%%_PostBuildBins%
  218. title %_ArgBuildTitle%
  219. if "%_ArgDumpEnv%"=="true" (
  220. set
  221. goto restore
  222. )
  223. @rem Do the build
  224. echo.
  225. echo %_ArgBuildTitle%
  226. echo Calling "build %_ArgBuildOpt%"
  227. echo.
  228. call build %_ArgBuildOpt%
  229. :restore
  230. title %_BuildWTitle%
  231. :Cleanup
  232. goto :eof
  233. :usage
  234. call :usagesub
  235. goto Cleanup
  236. :usagerestore
  237. call :usagesub
  238. goto restore
  239. :usagesub
  240. echo.
  241. echo Usage: buildx ^<arguments^>
  242. echo.
  243. echo where ^<arguments^> can be one or more of:
  244. echo Major Options (only one can be used):
  245. echo retail - Build free build (obj)
  246. echo debug - Build checked build (objd)
  247. echo profile - Build profile build (objp)
  248. echo meter - Build meter build (objm)
  249. echo Modifiers:
  250. echo no_opt - Turn off compiler optimizations
  251. echo Win64 - Build for 64 bit
  252. echo AMD64 - Build AMD64
  253. echo.
  254. echo All unknown options are passed on to build.exe.
  255. goto :eof