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.

210 lines
6.3 KiB

  1. @if "%echo%" == "" echo off
  2. goto stbld_entry
  3. rem Author: [email protected]
  4. rem
  5. rem Revisions:
  6. rem 10/1/98 - created
  7. :show_usage
  8. echo Usage:
  9. echo stbld [stbld options] [build options]
  10. echo Where [stbld options] is one or more of...
  11. echo /dbg /debug /chk /check - build debug (eg. i386d\*.*)
  12. echo /rtl /retail /fre /free /rel /release - build retail (eg. i386r\*.*)
  13. echo /prf /profile /icap /icecap - build profile (eg. i386p\*.*)
  14. echo /? /hlp /help - show usage
  15. echo And where [build options] are passed to build.exe.
  16. echo .
  17. echo If the STBLD_OPTIONS environment variable is set, the
  18. echo contents of that variable are treated exactly as if they
  19. echo were passed on the command line to stbld.
  20. goto done
  21. rem Debugging options:
  22. rem set ECHO=<anything> to not do ECHO OFF
  23. rem /NOBLD suppresses build, and prints options
  24. rem ***************************************************************************
  25. rem Check to make sure that command extentions are enabled.
  26. :stbld_entry
  27. setlocal
  28. if cmdextversion 1 goto cmd_ext_ok
  29. goto no_cmd_ext
  30. :cmd_ext_ok
  31. rem ***************************************************************************
  32. rem ***************************************************************************
  33. rem If the STBLD_OPTIONS variable is set, we call ourselves recursively
  34. rem with the value as the first option.
  35. if "%stbld_options%" == "" goto not_recurse
  36. set stbld_tmp=%stbld_options%
  37. set stbld_options=
  38. call stbld %stbld_tmp% %1 %2 %3 %4 %5 %6 %7 %8 %9
  39. goto done
  40. :not_recurse
  41. rem ***************************************************************************
  42. rem ***************************************************************************
  43. rem Set the variables which track the state of parsing.
  44. rem
  45. rem STBLD_DBG=1 - debug
  46. rem STBLD_RTL=1 - retail
  47. rem STBLD_PRF=1 - profile
  48. rem STBLD_BLD=<opt> - options to BUILD.EXE
  49. rem STBLD_PARAM_DONE=1 - set to 1 when BUILD.EXE options found
  50. rem STBLD_DBG_NOBLD=1 - /NOBLD option
  51. set stbld_dbg=0
  52. set stbld_rtl=0
  53. set stbld_prf=0
  54. set stbld_bld=
  55. set stbld_param_done=0
  56. set stbld_dbg_nobld=0
  57. rem ***************************************************************************
  58. rem ***************************************************************************
  59. rem This is the parser. We loop through all of the params. If we havenremt
  60. rem yet seen a parameter we donremt recognize, then we check it against all
  61. rem of the ones we recognize, and set flags as appropriate. For any
  62. rem parameters we donremt recognize, we build up the STBLD_BLD variable.
  63. :parse
  64. if "%1" == "" goto done_parse
  65. if stbld_param_done == 1 goto bld_param
  66. if "%1" == "/?" goto show_usage
  67. if /i %1 == /hlp goto show_usage
  68. if /i %1 == /help goto show_usage
  69. set stbld_opt=stbld_tmp
  70. for %%i in (/dbg /debug /chk /check) do if /i %1 == %%i set stbld_opt=stbld_dbg
  71. for %%i in (/rtl /retail /fre /free /rel /release) do if /i %1 == %%i set stbld_opt=stbld_rtl
  72. for %%i in (/prf /profile /icap /icecap) do if /i %1 == %%i set stbld_opt=stbld_prf
  73. for %%i in (/nobld) do if %1 == %%i set stbld_opt=stbld_dbg_nobld
  74. set %stbld_opt%=1
  75. if %stbld_opt%==stbld_tmp set stbld_param_done=1
  76. if %stbld_param_done%==0 goto no_bld_param
  77. :bld_param
  78. set stbld_bld=%stbld_bld% %1
  79. :no_bld_param
  80. shift
  81. goto parse
  82. :done_parse
  83. rem ***************************************************************************
  84. rem ***************************************************************************
  85. rem This checks to see if /dbg, /rtl, or /prf was specified. If none of
  86. rem them were specified, then set the default - which is debug.
  87. if stbld_dbg == 1 goto not_default
  88. if stbld_rtl == 1 goto not_default
  89. if stbld_prf == 1 goto not_default
  90. set stbld_dbg=1
  91. :not_default
  92. rem ***************************************************************************
  93. rem ***************************************************************************
  94. rem This calls each of the blocks which actually invoke BUILD.EXE for
  95. rem debug, retail, and profile.
  96. :again
  97. if %stbld_dbg% == 1 goto do_dbg
  98. if %stbld_rtl% == 1 goto do_rtl
  99. if %stbld_prf% == 1 goto do_prf
  100. goto done
  101. rem ***************************************************************************
  102. rem ***************************************************************************
  103. rem These are the blocks for each of retail, debug, and profile. Each
  104. rem of them first clears the variable which controls whether they are
  105. rem called (so they donremt get called multiple times). They then set
  106. rem the appropriate environment variables, and then invoke BUILD.EXE.
  107. rem
  108. rem There is also debugging support - if /NOBLD was specified, then
  109. rem STBLD_DBG_NOBLD=1. In that case, instead of calling BUILD.EXE,
  110. rem each block calls a common block which prints the options which
  111. rem would have been used.
  112. :do_dbg
  113. set stbld_dbg=0
  114. setlocal
  115. set BUILD_ALT_DIR=d
  116. set NTDEBUG=ntsd
  117. set NTDEBUGTYPE=both
  118. set NTDBGFILES=1
  119. set MSC_OPTIMIZATION=/Odi
  120. set USE_ICECAP=
  121. set USE_PDB=1
  122. echo Building debug.
  123. if %stbld_dbg_nobld%==1 goto do_nobld
  124. goto do_bld
  125. :do_rtl
  126. set stbld_rtl=0
  127. setlocal
  128. set BUILD_ALT_DIR=r
  129. set NTDEBUG=ntsdnodbg
  130. set NTDEBUGTYPE=both
  131. set NTDBGFILES=1
  132. set MSC_OPTIMIZATION=
  133. set USE_ICECAP=
  134. set USE_PDB=1
  135. echo Building retail.
  136. if %stbld_dbg_nobld%==1 goto do_nobld
  137. goto do_bld
  138. :do_prf
  139. set stbld_prf=0
  140. setlocal
  141. set BUILD_ALT_DIR=p
  142. set NTDEBUG=ntsdnodbg
  143. set NTDEBUGTYPE=both
  144. set NTDBGFILES=1
  145. set MSC_OPTIMIZATION=
  146. set USE_ICECAP=1
  147. set USE_PDB=1
  148. echo Building profile.
  149. if %stbld_dbg_nobld%==1 goto do_nobld
  150. goto do_bld
  151. :do_bld
  152. build%stbld_bld%
  153. endlocal
  154. goto again
  155. :do_nobld
  156. echo BUILD_ALT_DIR=%build_alt_dir%
  157. echo NTDEBUG=%ntdebug%
  158. echo NTDEBUGTYPE=%ntdebugtype%
  159. echo NTDBGFILES=%ntdbgfiles%
  160. echo MSC_OPTIMIZATION=%msc_optimization%
  161. echo USE_ICECAP=%use_icecap%
  162. echo USE_PDB=%use_pdb%
  163. echo . BUILD%stbld_bld%
  164. echo .
  165. endlocal
  166. goto again
  167. rem ***************************************************************************
  168. rem ***************************************************************************
  169. rem This is only called in the unlikely event of the batch file being
  170. rem invoked when command extentions are not enabled.
  171. :no_cmd_ext
  172. echo This batch file requires command extensions, and command extensions
  173. echo appear to currently be disabled.
  174. goto done
  175. rem ***************************************************************************
  176. :done
  177. endlocal