Ticket #6143: build_bat.patch

File build_bat.patch, 35.4 KB (added by p.jackson@…, 11 years ago)
  • tools/build/v2/engine/build.bat

    diff --git a/tools/build/v2/engine/build.bat b/tools/build/v2/engine/build.bat
    a b  
    1 @ECHO OFF
    2 
    3 REM ~ Copyright 2002-2007 Rene Rivera.
    4 REM ~ Distributed under the Boost Software License, Version 1.0.
    5 REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
    6 
    7 setlocal
    8 goto Start
    9 
    10 
    11 :Set_Error
    12 color 00
    13 goto :eof
    14 
    15 
    16 :Clear_Error
    17 ver >nul
    18 goto :eof
    19 
    20 
    21 :Error_Print
    22 REM Output an error message and set the errorlevel to indicate failure.
    23 setlocal
    24 ECHO ###
    25 ECHO ### %1
    26 ECHO ###
    27 ECHO ### You can specify the toolset as the argument, i.e.:
    28 ECHO ###     .\build.bat msvc
    29 ECHO ###
    30 ECHO ### Toolsets supported by this script are: borland, como, gcc, gcc-nocygwin,
    31 ECHO ###     intel-win32, metrowerks, mingw, msvc, vc7, vc8, vc9, vc10
    32 ECHO ###
    33 call :Set_Error
    34 endlocal
    35 goto :eof
    36 
    37 
    38 :Test_Path
    39 REM Tests for the given file(executable) presence in the directories in the PATH
    40 REM environment variable. Additionaly sets FOUND_PATH to the path of the
    41 REM found file.
    42 call :Clear_Error
    43 setlocal
    44 set test=%~$PATH:1
    45 endlocal
    46 if not errorlevel 1 set FOUND_PATH=%~dp$PATH:1
    47 goto :eof
    48 
    49 
    50 :Test_Option
    51 REM Tests whether the given string is in the form of an option: "--*"
    52 call :Clear_Error
    53 setlocal
    54 set test=%1
    55 if not defined test (
    56     call :Set_Error
    57     goto Test_Option_End
    58 )
    59 set test=###%test%###
    60 set test=%test:"###=%
    61 set test=%test:###"=%
    62 set test=%test:###=%
    63 if not "-" == "%test:~1,1%" call :Set_Error
    64 :Test_Option_End
    65 endlocal
    66 goto :eof
    67 
    68 
    69 :Test_Empty
    70 REM Tests whether the given string is not empty
    71 call :Clear_Error
    72 setlocal
    73 set test=%1
    74 if not defined test (
    75     call :Clear_Error
    76     goto Test_Empty_End
    77 )
    78 set test=###%test%###
    79 set test=%test:"###=%
    80 set test=%test:###"=%
    81 set test=%test:###=%
    82 if not "" == "%test%" call :Set_Error
    83 :Test_Empty_End
    84 endlocal
    85 goto :eof
    86 
    87 
    88 :Call_If_Exists
    89 if EXIST %1 call %*
    90 goto :eof
    91 
    92 
    93 :Guess_Toolset
    94 REM Try and guess the toolset to bootstrap the build with...
    95 REM Sets BOOST_JAM_TOOLSET to the first found toolset.
    96 REM May also set BOOST_JAM_TOOLSET_ROOT to the
    97 REM location of the found toolset.
    98 
    99 call :Clear_Error
    100 call :Test_Empty %ProgramFiles%
    101 if not errorlevel 1 set ProgramFiles=C:\Program Files
    102 
    103 call :Clear_Error
    104 if NOT "_%VS100COMNTOOLS%_" == "__" (
    105     set "BOOST_JAM_TOOLSET=vc10"
    106     set "BOOST_JAM_TOOLSET_ROOT=%VS100COMNTOOLS%..\..\VC\"
    107     goto :eof)
    108 call :Clear_Error
    109 if EXIST "%ProgramFiles%\Microsoft Visual Studio 10.0\VC\VCVARSALL.BAT" (
    110     set "BOOST_JAM_TOOLSET=vc10"
    111     set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio 10.0\VC\"
    112     goto :eof)
    113 call :Clear_Error
    114 if NOT "_%VS90COMNTOOLS%_" == "__" (
    115     set "BOOST_JAM_TOOLSET=vc9"
    116     set "BOOST_JAM_TOOLSET_ROOT=%VS90COMNTOOLS%..\..\VC\"
    117     goto :eof)
    118 call :Clear_Error
    119 if EXIST "%ProgramFiles%\Microsoft Visual Studio 9.0\VC\VCVARSALL.BAT" (
    120     set "BOOST_JAM_TOOLSET=vc9"
    121     set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio 9.0\VC\"
    122     goto :eof)
    123 call :Clear_Error
    124 if NOT "_%VS80COMNTOOLS%_" == "__" (
    125     set "BOOST_JAM_TOOLSET=vc8"
    126     set "BOOST_JAM_TOOLSET_ROOT=%VS80COMNTOOLS%..\..\VC\"
    127     goto :eof)
    128 call :Clear_Error
    129 if EXIST "%ProgramFiles%\Microsoft Visual Studio 8\VC\VCVARSALL.BAT" (
    130     set "BOOST_JAM_TOOLSET=vc8"
    131     set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio 8\VC\"
    132     goto :eof)
    133 call :Clear_Error
    134 if NOT "_%VS71COMNTOOLS%_" == "__" (
    135     set "BOOST_JAM_TOOLSET=vc7"
    136     set "BOOST_JAM_TOOLSET_ROOT=%VS71COMNTOOLS%\..\..\VC7\"
    137     goto :eof)
    138 call :Clear_Error
    139 if NOT "_%VCINSTALLDIR%_" == "__" (
    140     REM %VCINSTALLDIR% is also set for VC9 (and probably VC8)
    141     set "BOOST_JAM_TOOLSET=vc7"
    142     set "BOOST_JAM_TOOLSET_ROOT=%VCINSTALLDIR%\VC7\"
    143     goto :eof)
    144 call :Clear_Error
    145 if EXIST "%ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\bin\VCVARS32.BAT" (
    146     set "BOOST_JAM_TOOLSET=vc7"
    147     set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\"
    148     goto :eof)
    149 call :Clear_Error
    150 if EXIST "%ProgramFiles%\Microsoft Visual Studio .NET\VC7\bin\VCVARS32.BAT" (
    151     set "BOOST_JAM_TOOLSET=vc7"
    152     set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio .NET\VC7\"
    153     goto :eof)
    154 call :Clear_Error
    155 if NOT "_%MSVCDir%_" == "__" (
    156     set "BOOST_JAM_TOOLSET=msvc"
    157     set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\"
    158     goto :eof)
    159 call :Clear_Error
    160 if EXIST "%ProgramFiles%\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT" (
    161     set "BOOST_JAM_TOOLSET=msvc"
    162     set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio\VC98\"
    163     goto :eof)
    164 call :Clear_Error
    165 if EXIST "%ProgramFiles%\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" (
    166     set "BOOST_JAM_TOOLSET=msvc"
    167     set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual C++\VC98\"
    168     goto :eof)
    169 call :Clear_Error
    170 call :Test_Path cl.exe
    171 if not errorlevel 1 (
    172     set "BOOST_JAM_TOOLSET=msvc"
    173     set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
    174     goto :eof)
    175 call :Clear_Error
    176 call :Test_Path vcvars32.bat
    177 if not errorlevel 1 (
    178     set "BOOST_JAM_TOOLSET=msvc"
    179     call "%FOUND_PATH%VCVARS32.BAT"
    180     set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\"
    181     goto :eof)
    182 call :Clear_Error
    183 if EXIST "C:\Borland\BCC55\Bin\bcc32.exe" (
    184     set "BOOST_JAM_TOOLSET=borland"
    185     set "BOOST_JAM_TOOLSET_ROOT=C:\Borland\BCC55\"
    186     goto :eof)
    187 call :Clear_Error
    188 call :Test_Path bcc32.exe
    189 if not errorlevel 1 (
    190     set "BOOST_JAM_TOOLSET=borland"
    191     set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
    192     goto :eof)
    193 call :Clear_Error
    194 call :Test_Path icl.exe
    195 if not errorlevel 1 (
    196     set "BOOST_JAM_TOOLSET=intel-win32"
    197     set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
    198     goto :eof)
    199 call :Clear_Error
    200 if EXIST "C:\MinGW\bin\gcc.exe" (
    201     set "BOOST_JAM_TOOLSET=mingw"
    202     set "BOOST_JAM_TOOLSET_ROOT=C:\MinGW\"
    203     goto :eof)
    204 call :Clear_Error
    205 if NOT "_%CWFolder%_" == "__" (
    206     set "BOOST_JAM_TOOLSET=metrowerks"
    207     set "BOOST_JAM_TOOLSET_ROOT=%CWFolder%\"
    208     goto :eof )
    209 call :Clear_Error
    210 call :Test_Path mwcc.exe
    211 if not errorlevel 1 (
    212     set "BOOST_JAM_TOOLSET=metrowerks"
    213     set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\..\"
    214     goto :eof)
    215 call :Clear_Error
    216 call :Error_Print "Could not find a suitable toolset."
    217 goto :eof
    218 
    219 
    220 :Guess_Yacc
    221 REM Tries to find bison or yacc in common places so we can build the grammar.
    222 call :Clear_Error
    223 call :Test_Path yacc.exe
    224 if not errorlevel 1 (
    225     set "YACC=yacc -d"
    226     goto :eof)
    227 call :Clear_Error
    228 call :Test_Path bison.exe
    229 if not errorlevel 1 (
    230     set "YACC=bison -d --yacc"
    231     goto :eof)
    232 call :Clear_Error
    233 if EXIST "C:\Program Files\GnuWin32\bin\bison.exe" (
    234     set "YACC=C:\Program Files\GnuWin32\bin\bison.exe" -d --yacc
    235     goto :eof)
    236 call :Clear_Error
    237 call :Error_Print "Could not find Yacc to build the Jam grammar."
    238 goto :eof
    239 
    240 
    241 :Start
    242 set BOOST_JAM_TOOLSET=
    243 set BOOST_JAM_ARGS=
    244 
    245 REM If no arguments guess the toolset;
    246 REM or if first argument is an option guess the toolset;
    247 REM otherwise the argument is the toolset to use.
    248 call :Clear_Error
    249 call :Test_Empty %1
    250 if not errorlevel 1 (
    251     call :Guess_Toolset
    252     if not errorlevel 1 ( goto Setup_Toolset ) else ( goto Finish )
    253 )
    254 
    255 call :Clear_Error
    256 call :Test_Option %1
    257 if not errorlevel 1 (
    258     call :Guess_Toolset
    259     if not errorlevel 1 ( goto Setup_Toolset ) else ( goto Finish )
    260 )
    261 
    262 call :Clear_Error
    263 set BOOST_JAM_TOOLSET=%1
    264 shift
    265 goto Setup_Toolset
    266 
    267 
    268 :Setup_Toolset
    269 REM Setup the toolset command and options. This bit of code
    270 REM needs to be flexible enough to handle both when
    271 REM the toolset was guessed at and found, or when the toolset
    272 REM was indicated in the command arguments.
    273 REM NOTE: The strange multiple "if ?? == _toolset_" tests are that way
    274 REM because in BAT variables are subsituted only once during a single
    275 REM command. A complete "if ... ( commands ) else ( commands )"
    276 REM is a single command, even though it's in multiple lines here.
    277 :Setup_Args
    278 call :Clear_Error
    279 call :Test_Empty %1
    280 if not errorlevel 1 goto Config_Toolset
    281 call :Clear_Error
    282 call :Test_Option %1
    283 if errorlevel 1 (
    284     set BOOST_JAM_ARGS=%BOOST_JAM_ARGS% %1
    285     shift
    286     goto Setup_Args
    287 )
    288 :Config_Toolset
    289 if NOT "_%BOOST_JAM_TOOLSET%_" == "_metrowerks_" goto Skip_METROWERKS
    290 if NOT "_%CWFolder%_" == "__" (
    291     set "BOOST_JAM_TOOLSET_ROOT=%CWFolder%\"
    292     )
    293 set "PATH=%BOOST_JAM_TOOLSET_ROOT%Other Metrowerks Tools\Command Line Tools;%PATH%"
    294 set "BOOST_JAM_CC=mwcc -runtime ss -cwd include -DNT -lkernel32.lib -ladvapi32.lib -luser32.lib"
    295 set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe"
    296 set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe"
    297 set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe"
    298 set "_known_=1"
    299 :Skip_METROWERKS
    300 if NOT "_%BOOST_JAM_TOOLSET%_" == "_msvc_" goto Skip_MSVC
    301 if NOT "_%MSVCDir%_" == "__" (
    302     set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\"
    303     )
    304 call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT"
    305 if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
    306     set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
    307     )
    308 set "BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG kernel32.lib advapi32.lib user32.lib"
    309 set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
    310 set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
    311 set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
    312 set "_known_=1"
    313 :Skip_MSVC
    314 if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc7_" goto Skip_VC7
    315 if NOT "_%VS71COMNTOOLS%_" == "__" (
    316     set "BOOST_JAM_TOOLSET_ROOT=%VS71COMNTOOLS%..\..\VC7\"
    317     )
    318 if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT"
    319 if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
    320     if "_%VCINSTALLDIR%_" == "__" (
    321         set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
    322         ) )
    323 set "BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG kernel32.lib advapi32.lib user32.lib"
    324 set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
    325 set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
    326 set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
    327 set "_known_=1"
    328 :Skip_VC7
    329 if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc8_" goto Skip_VC8
    330 if NOT "_%VS80COMNTOOLS%_" == "__" (
    331     set "BOOST_JAM_TOOLSET_ROOT=%VS80COMNTOOLS%..\..\VC\"
    332     )
    333 if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS%
    334 if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
    335     if "_%VCINSTALLDIR%_" == "__" (
    336         set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
    337         ) )
    338 set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib"
    339 set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
    340 set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
    341 set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
    342 set "_known_=1"
    343 :Skip_VC8
    344 if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc9_" goto Skip_VC9
    345 if NOT "_%VS90COMNTOOLS%_" == "__" (
    346     set "BOOST_JAM_TOOLSET_ROOT=%VS90COMNTOOLS%..\..\VC\"
    347     )
    348 if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS%
    349 if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
    350     if "_%VCINSTALLDIR%_" == "__" (
    351         set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
    352         ) )
    353 set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib"
    354 set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
    355 set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
    356 set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
    357 set "_known_=1"
    358 :Skip_VC9
    359 if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc10_" goto Skip_VC10
    360 if NOT "_%VS100COMNTOOLS%_" == "__" (
    361     set "BOOST_JAM_TOOLSET_ROOT=%VS100COMNTOOLS%..\..\VC\"
    362     )
    363 if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS%
    364 if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
    365     if "_%VCINSTALLDIR%_" == "__" (
    366         set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
    367         ) )
    368 set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib"
    369 set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
    370 set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
    371 set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
    372 set "_known_=1"
    373 :Skip_VC10
    374 if NOT "_%BOOST_JAM_TOOLSET%_" == "_borland_" goto Skip_BORLAND
    375 if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
    376     call :Test_Path bcc32.exe )
    377 if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
    378     if not errorlevel 1 (
    379         set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
    380         ) )
    381 if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
    382     set "PATH=%BOOST_JAM_TOOLSET_ROOT%Bin;%PATH%"
    383     )
    384 set "BOOST_JAM_CC=bcc32 -WC -w- -q -I%BOOST_JAM_TOOLSET_ROOT%Include -L%BOOST_JAM_TOOLSET_ROOT%Lib /DNT -nbootstrap"
    385 set "BOOST_JAM_OPT_JAM=-ejam0"
    386 set "BOOST_JAM_OPT_MKJAMBASE=-emkjambasejam0"
    387 set "BOOST_JAM_OPT_YYACC=-eyyacc0"
    388 set "_known_=1"
    389 :Skip_BORLAND
    390 if NOT "_%BOOST_JAM_TOOLSET%_" == "_como_" goto Skip_COMO
    391 set "BOOST_JAM_CC=como -DNT"
    392 set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe"
    393 set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe"
    394 set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe"
    395 set "_known_=1"
    396 :Skip_COMO
    397 if NOT "_%BOOST_JAM_TOOLSET%_" == "_gcc_" goto Skip_GCC
    398 set "BOOST_JAM_CC=gcc -DNT"
    399 set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe"
    400 set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe"
    401 set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe"
    402 set "_known_=1"
    403 :Skip_GCC
    404 if NOT "_%BOOST_JAM_TOOLSET%_" == "_gcc-nocygwin_" goto Skip_GCC_NOCYGWIN
    405 set "BOOST_JAM_CC=gcc -DNT -mno-cygwin"
    406 set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe"
    407 set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe"
    408 set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe"
    409 set "_known_=1"
    410 :Skip_GCC_NOCYGWIN
    411 if NOT "_%BOOST_JAM_TOOLSET%_" == "_intel-win32_" goto Skip_INTEL_WIN32
    412 set "BOOST_JAM_CC=icl -DNT /nologo kernel32.lib advapi32.lib user32.lib"
    413 set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
    414 set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
    415 set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
    416 set "_known_=1"
    417 :Skip_INTEL_WIN32
    418 if NOT "_%BOOST_JAM_TOOLSET%_" == "_mingw_" goto Skip_MINGW
    419 if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
    420     set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
    421     )
    422 set "BOOST_JAM_CC=gcc -DNT"
    423 set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe"
    424 set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe"
    425 set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe"
    426 set "_known_=1"
    427 :Skip_MINGW
    428 call :Clear_Error
    429 if "_%_known_%_" == "__" (
    430     call :Error_Print "Unknown toolset: %BOOST_JAM_TOOLSET%"
    431 )
    432 if errorlevel 1 goto Finish
    433 
    434 echo ###
    435 echo ### Using '%BOOST_JAM_TOOLSET%' toolset.
    436 echo ###
    437 
    438 set YYACC_SOURCES=yyacc.c
    439 set MKJAMBASE_SOURCES=mkjambase.c
    440 set BJAM_SOURCES=
    441 set BJAM_SOURCES=%BJAM_SOURCES% command.c compile.c debug.c execnt.c expand.c filent.c glob.c hash.c
    442 set BJAM_SOURCES=%BJAM_SOURCES% hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c
    443 set BJAM_SOURCES=%BJAM_SOURCES% newstr.c option.c output.c parse.c pathunix.c regexp.c
    444 set BJAM_SOURCES=%BJAM_SOURCES% rules.c scan.c search.c subst.c timestamp.c variable.c modules.c
    445 set BJAM_SOURCES=%BJAM_SOURCES% strings.c filesys.c builtins.c md5.c pwd.c class.c w32_getreg.c native.c
    446 set BJAM_SOURCES=%BJAM_SOURCES% modules/set.c modules/path.c modules/regex.c
    447 set BJAM_SOURCES=%BJAM_SOURCES% modules/property-set.c modules/sequence.c modules/order.c
    448 
    449 set BJAM_UPDATE=
    450 :Check_Update
    451 call :Test_Empty %1
    452 if not errorlevel 1 goto Check_Update_End
    453 call :Clear_Error
    454 setlocal
    455 set test=%1
    456 set test=###%test%###
    457 set test=%test:"###=%
    458 set test=%test:###"=%
    459 set test=%test:###=%
    460 if "%test%" == "--update" set BJAM_UPDATE=update
    461 endlocal
    462 shift
    463 if not "_%BJAM_UPDATE%_" == "_update_" goto Check_Update
    464 :Check_Update_End
    465 if "_%BJAM_UPDATE%_" == "_update_" (
    466     if not exist ".\bootstrap\jam0.exe" (
    467         set BJAM_UPDATE=
    468     )
    469 )
    470 
    471 @echo ON
    472 @if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Bootstrap
    473 if exist bootstrap rd /S /Q bootstrap
    474 md bootstrap
    475 @if not exist jamgram.y goto Bootstrap_GrammarPrep
    476 @if not exist jamgramtab.h goto Bootstrap_GrammarPrep
    477 @goto Skip_GrammarPrep
    478 :Bootstrap_GrammarPrep
    479 %BOOST_JAM_CC% %BOOST_JAM_OPT_YYACC% %YYACC_SOURCES%
    480 @if not exist ".\bootstrap\yyacc0.exe" goto Skip_GrammarPrep
    481 .\bootstrap\yyacc0 jamgram.y jamgramtab.h jamgram.yy
    482 :Skip_GrammarPrep
    483 @if not exist jamgram.c goto Bootstrap_GrammarBuild
    484 @if not exist jamgram.h goto Bootstrap_GrammarBuild
    485 @goto Skip_GrammarBuild
    486 :Bootstrap_GrammarBuild
    487 @echo OFF
    488 if "_%YACC%_" == "__" (
    489     call :Guess_Yacc
    490 )
    491 if errorlevel 1 goto Finish
    492 @echo ON
    493 %YACC% jamgram.y
    494 @if errorlevel 1 goto Finish
    495 del /f jamgram.c
    496 rename y.tab.c jamgram.c
    497 del /f jamgram.h
    498 rename y.tab.h jamgram.h
    499 :Skip_GrammarBuild
    500 @echo ON
    501 @if exist jambase.c goto Skip_Jambase
    502 %BOOST_JAM_CC% %BOOST_JAM_OPT_MKJAMBASE% %MKJAMBASE_SOURCES%
    503 @if not exist ".\bootstrap\mkjambase0.exe" goto Skip_Jambase
    504 .\bootstrap\mkjambase0 jambase.c Jambase
    505 :Skip_Jambase
    506 %BOOST_JAM_CC% %BOOST_JAM_OPT_JAM% %BJAM_SOURCES%
    507 :Skip_Bootstrap
    508 @if not exist ".\bootstrap\jam0.exe" goto Skip_Jam
    509 @if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Clean
    510 .\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " clean
    511 :Skip_Clean
    512 @set args=%*
    513 @echo OFF
    514 :Set_Args
    515 setlocal
    516 call :Test_Empty %args%
    517 if not errorlevel 1 goto Set_Args_End
    518 set test=###%args:~0,2%###
    519 set test=%test:"###=%
    520 set test=%test:###"=%
    521 set test=%test:###=%
    522 set test=%test:~0,1%
    523 if "-" == "%test%" goto Set_Args_End
    524 endlocal
    525 set args=%args:~1%
    526 goto Set_Args
    527 :Set_Args_End
    528 @echo ON
    529 .\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " %args%
    530 :Skip_Jam
    531 
    532 :Finish
     1@ECHO OFF
     2
     3REM ~ Copyright 2002-2007 Rene Rivera.
     4REM ~ Distributed under the Boost Software License, Version 1.0.
     5REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
     6
     7setlocal
     8goto Start
     9
     10
     11:Set_Error
     12color 00
     13goto :eof
     14
     15
     16:Clear_Error
     17ver >nul
     18goto :eof
     19
     20
     21:Error_Print
     22REM Output an error message and set the errorlevel to indicate failure.
     23setlocal
     24ECHO ###
     25ECHO ### %1
     26ECHO ###
     27ECHO ### You can specify the toolset as the argument, i.e.:
     28ECHO ###     .\build.bat msvc
     29ECHO ###
     30ECHO ### Toolsets supported by this script are: borland, como, gcc, gcc-nocygwin,
     31ECHO ###     intel-win32, metrowerks, mingw, msvc, vc7, vc8, vc9, vc10
     32ECHO ###
     33call :Set_Error
     34endlocal
     35goto :eof
     36
     37
     38:Test_Path
     39REM Tests for the given file(executable) presence in the directories in the PATH
     40REM environment variable. Additionaly sets FOUND_PATH to the path of the
     41REM found file.
     42call :Clear_Error
     43setlocal
     44set test=%~$PATH:1
     45endlocal
     46if not errorlevel 1 set FOUND_PATH=%~dp$PATH:1
     47goto :eof
     48
     49
     50:Test_Option
     51REM Tests whether the given string is in the form of an option: "--*"
     52call :Clear_Error
     53setlocal
     54set test=%1
     55if not defined test (
     56    call :Set_Error
     57    goto Test_Option_End
     58)
     59set test=###%test%###
     60set test=%test:"###=%
     61set test=%test:###"=%
     62set test=%test:###=%
     63if not "-" == "%test:~1,1%" call :Set_Error
     64:Test_Option_End
     65endlocal
     66goto :eof
     67
     68
     69:Test_Empty
     70REM Tests whether the given string is not empty
     71call :Clear_Error
     72setlocal
     73set test=%1
     74if not defined test (
     75    call :Clear_Error
     76    goto Test_Empty_End
     77)
     78set test=###%test%###
     79set test=%test:"###=%
     80set test=%test:###"=%
     81set test=%test:###=%
     82if not "" == "%test%" call :Set_Error
     83:Test_Empty_End
     84endlocal
     85goto :eof
     86
     87
     88:Call_If_Exists
     89if EXIST %1 call %*
     90goto :eof
     91
     92
     93:Guess_Toolset
     94REM Try and guess the toolset to bootstrap the build with...
     95REM Sets BOOST_JAM_TOOLSET to the first found toolset.
     96REM May also set BOOST_JAM_TOOLSET_ROOT to the
     97REM location of the found toolset.
     98
     99call :Clear_Error
     100call :Test_Empty %ProgramFiles%
     101if not errorlevel 1 set ProgramFiles=C:\Program Files
     102
     103call :Clear_Error
     104if NOT "_%VS100COMNTOOLS%_" == "__" (
     105    set "BOOST_JAM_TOOLSET=vc10"
     106    set "BOOST_JAM_TOOLSET_ROOT=%VS100COMNTOOLS%..\..\VC\"
     107    goto :eof)
     108call :Clear_Error
     109if EXIST "%ProgramFiles%\Microsoft Visual Studio 10.0\VC\VCVARSALL.BAT" (
     110    set "BOOST_JAM_TOOLSET=vc10"
     111    set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio 10.0\VC\"
     112    goto :eof)
     113call :Clear_Error
     114if NOT "_%VS90COMNTOOLS%_" == "__" (
     115    set "BOOST_JAM_TOOLSET=vc9"
     116    set "BOOST_JAM_TOOLSET_ROOT=%VS90COMNTOOLS%..\..\VC\"
     117    goto :eof)
     118call :Clear_Error
     119if EXIST "%ProgramFiles%\Microsoft Visual Studio 9.0\VC\VCVARSALL.BAT" (
     120    set "BOOST_JAM_TOOLSET=vc9"
     121    set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio 9.0\VC\"
     122    goto :eof)
     123call :Clear_Error
     124if NOT "_%VS80COMNTOOLS%_" == "__" (
     125    set "BOOST_JAM_TOOLSET=vc8"
     126    set "BOOST_JAM_TOOLSET_ROOT=%VS80COMNTOOLS%..\..\VC\"
     127    goto :eof)
     128call :Clear_Error
     129if EXIST "%ProgramFiles%\Microsoft Visual Studio 8\VC\VCVARSALL.BAT" (
     130    set "BOOST_JAM_TOOLSET=vc8"
     131    set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio 8\VC\"
     132    goto :eof)
     133call :Clear_Error
     134if NOT "_%VS71COMNTOOLS%_" == "__" (
     135    set "BOOST_JAM_TOOLSET=vc7"
     136    set "BOOST_JAM_TOOLSET_ROOT=%VS71COMNTOOLS%\..\..\VC7\"
     137    goto :eof)
     138call :Clear_Error
     139if NOT "_%VCINSTALLDIR%_" == "__" (
     140    REM %VCINSTALLDIR% is also set for VC9 (and probably VC8)
     141    set "BOOST_JAM_TOOLSET=vc7"
     142    set "BOOST_JAM_TOOLSET_ROOT=%VCINSTALLDIR%\VC7\"
     143    goto :eof)
     144call :Clear_Error
     145if EXIST "%ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\bin\VCVARS32.BAT" (
     146    set "BOOST_JAM_TOOLSET=vc7"
     147    set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\"
     148    goto :eof)
     149call :Clear_Error
     150if EXIST "%ProgramFiles%\Microsoft Visual Studio .NET\VC7\bin\VCVARS32.BAT" (
     151    set "BOOST_JAM_TOOLSET=vc7"
     152    set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio .NET\VC7\"
     153    goto :eof)
     154call :Clear_Error
     155if NOT "_%MSVCDir%_" == "__" (
     156    set "BOOST_JAM_TOOLSET=msvc"
     157    set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\"
     158    goto :eof)
     159call :Clear_Error
     160if EXIST "%ProgramFiles%\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT" (
     161    set "BOOST_JAM_TOOLSET=msvc"
     162    set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio\VC98\"
     163    goto :eof)
     164call :Clear_Error
     165if EXIST "%ProgramFiles%\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" (
     166    set "BOOST_JAM_TOOLSET=msvc"
     167    set "BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual C++\VC98\"
     168    goto :eof)
     169call :Clear_Error
     170call :Test_Path cl.exe
     171if not errorlevel 1 (
     172    set "BOOST_JAM_TOOLSET=msvc"
     173    set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
     174    goto :eof)
     175call :Clear_Error
     176call :Test_Path vcvars32.bat
     177if not errorlevel 1 (
     178    set "BOOST_JAM_TOOLSET=msvc"
     179    call "%FOUND_PATH%VCVARS32.BAT"
     180    set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\"
     181    goto :eof)
     182call :Clear_Error
     183if EXIST "C:\Borland\BCC55\Bin\bcc32.exe" (
     184    set "BOOST_JAM_TOOLSET=borland"
     185    set "BOOST_JAM_TOOLSET_ROOT=C:\Borland\BCC55\"
     186    goto :eof)
     187call :Clear_Error
     188call :Test_Path bcc32.exe
     189if not errorlevel 1 (
     190    set "BOOST_JAM_TOOLSET=borland"
     191    set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
     192    goto :eof)
     193call :Clear_Error
     194call :Test_Path icl.exe
     195if not errorlevel 1 (
     196    set "BOOST_JAM_TOOLSET=intel-win32"
     197    set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
     198    goto :eof)
     199call :Clear_Error
     200if EXIST "C:\MinGW\bin\gcc.exe" (
     201    set "BOOST_JAM_TOOLSET=mingw"
     202    set "BOOST_JAM_TOOLSET_ROOT=C:\MinGW\"
     203    goto :eof)
     204call :Clear_Error
     205if NOT "_%CWFolder%_" == "__" (
     206    set "BOOST_JAM_TOOLSET=metrowerks"
     207    set "BOOST_JAM_TOOLSET_ROOT=%CWFolder%\"
     208    goto :eof )
     209call :Clear_Error
     210call :Test_Path mwcc.exe
     211if not errorlevel 1 (
     212    set "BOOST_JAM_TOOLSET=metrowerks"
     213    set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\..\"
     214    goto :eof)
     215call :Clear_Error
     216call :Error_Print "Could not find a suitable toolset."
     217goto :eof
     218
     219
     220:Guess_Yacc
     221REM Tries to find bison or yacc in common places so we can build the grammar.
     222call :Clear_Error
     223call :Test_Path yacc.exe
     224if not errorlevel 1 (
     225    set "YACC=yacc -d"
     226    goto :eof)
     227call :Clear_Error
     228call :Test_Path bison.exe
     229if not errorlevel 1 (
     230    set "YACC=bison -d --yacc"
     231    goto :eof)
     232call :Clear_Error
     233if EXIST "C:\Program Files\GnuWin32\bin\bison.exe" (
     234    set "YACC=C:\Program Files\GnuWin32\bin\bison.exe" -d --yacc
     235    goto :eof)
     236call :Clear_Error
     237call :Error_Print "Could not find Yacc to build the Jam grammar."
     238goto :eof
     239
     240
     241:Start
     242set BOOST_JAM_TOOLSET=
     243set BOOST_JAM_ARGS=
     244
     245REM If no arguments guess the toolset;
     246REM or if first argument is an option guess the toolset;
     247REM otherwise the argument is the toolset to use.
     248call :Clear_Error
     249call :Test_Empty %1
     250if not errorlevel 1 (
     251    call :Guess_Toolset
     252    if not errorlevel 1 ( goto Setup_Toolset ) else ( goto Finish )
     253)
     254
     255call :Clear_Error
     256call :Test_Option %1
     257if not errorlevel 1 (
     258    call :Guess_Toolset
     259    if not errorlevel 1 ( goto Setup_Toolset ) else ( goto Finish )
     260)
     261
     262call :Clear_Error
     263set BOOST_JAM_TOOLSET=%1
     264shift
     265goto Setup_Toolset
     266
     267
     268:Setup_Toolset
     269REM Setup the toolset command and options. This bit of code
     270REM needs to be flexible enough to handle both when
     271REM the toolset was guessed at and found, or when the toolset
     272REM was indicated in the command arguments.
     273REM NOTE: The strange multiple "if ?? == _toolset_" tests are that way
     274REM because in BAT variables are subsituted only once during a single
     275REM command. A complete "if ... ( commands ) else ( commands )"
     276REM is a single command, even though it's in multiple lines here.
     277:Setup_Args
     278call :Clear_Error
     279call :Test_Empty %1
     280if not errorlevel 1 goto Config_Toolset
     281call :Clear_Error
     282call :Test_Option %1
     283if errorlevel 1 (
     284    set BOOST_JAM_ARGS=%BOOST_JAM_ARGS% %1
     285    shift
     286    goto Setup_Args
     287)
     288:Config_Toolset
     289if NOT "_%BOOST_JAM_TOOLSET%_" == "_metrowerks_" goto Skip_METROWERKS
     290if NOT "_%CWFolder%_" == "__" (
     291    set "BOOST_JAM_TOOLSET_ROOT=%CWFolder%\"
     292    )
     293set "PATH=%BOOST_JAM_TOOLSET_ROOT%Other Metrowerks Tools\Command Line Tools;%PATH%"
     294set "BOOST_JAM_CC=mwcc -runtime ss -cwd include -DNT -lkernel32.lib -ladvapi32.lib -luser32.lib"
     295set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe"
     296set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe"
     297set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe"
     298set "_known_=1"
     299:Skip_METROWERKS
     300if NOT "_%BOOST_JAM_TOOLSET%_" == "_msvc_" goto Skip_MSVC
     301if NOT "_%MSVCDir%_" == "__" (
     302    set "BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\"
     303    )
     304call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT"
     305if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
     306    set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
     307    )
     308set "BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG kernel32.lib advapi32.lib user32.lib"
     309set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
     310set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
     311set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
     312set "_known_=1"
     313:Skip_MSVC
     314if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc7_" goto Skip_VC7
     315if NOT "_%VS71COMNTOOLS%_" == "__" (
     316    set "BOOST_JAM_TOOLSET_ROOT=%VS71COMNTOOLS%..\..\VC7\"
     317    )
     318if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT"
     319if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
     320    if "_%VCINSTALLDIR%_" == "__" (
     321        set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
     322        ) )
     323set "BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG kernel32.lib advapi32.lib user32.lib"
     324set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
     325set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
     326set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
     327set "_known_=1"
     328:Skip_VC7
     329if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc8_" goto Skip_VC8
     330if NOT "_%VS80COMNTOOLS%_" == "__" (
     331    set "BOOST_JAM_TOOLSET_ROOT=%VS80COMNTOOLS%..\..\VC\"
     332    )
     333if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS%
     334if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
     335    if "_%VCINSTALLDIR%_" == "__" (
     336        set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
     337        ) )
     338set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib"
     339set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
     340set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
     341set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
     342set "_known_=1"
     343:Skip_VC8
     344if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc9_" goto Skip_VC9
     345if NOT "_%VS90COMNTOOLS%_" == "__" (
     346    set "BOOST_JAM_TOOLSET_ROOT=%VS90COMNTOOLS%..\..\VC\"
     347    )
     348if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS%
     349if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
     350    if "_%VCINSTALLDIR%_" == "__" (
     351        set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
     352        ) )
     353set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib"
     354set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
     355set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
     356set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
     357set "_known_=1"
     358:Skip_VC9
     359if NOT "_%BOOST_JAM_TOOLSET%_" == "_vc10_" goto Skip_VC10
     360if NOT "_%VS100COMNTOOLS%_" == "__" (
     361    set "BOOST_JAM_TOOLSET_ROOT=%VS100COMNTOOLS%..\..\VC\"
     362    )
     363if "_%VCINSTALLDIR%_" == "__" call :Call_If_Exists "%BOOST_JAM_TOOLSET_ROOT%VCVARSALL.BAT" %BOOST_JAM_ARGS%
     364if NOT "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
     365    if "_%VCINSTALLDIR%_" == "__" (
     366        set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
     367        ) )
     368set "BOOST_JAM_CC=cl /nologo /RTC1 /Zi /MTd /Fobootstrap/ /Fdbootstrap/ -DNT -DYYDEBUG -wd4996 kernel32.lib advapi32.lib user32.lib"
     369set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
     370set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
     371set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
     372set "_known_=1"
     373:Skip_VC10
     374if NOT "_%BOOST_JAM_TOOLSET%_" == "_borland_" goto Skip_BORLAND
     375if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
     376    call :Test_Path bcc32.exe )
     377if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
     378    if not errorlevel 1 (
     379        set "BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\"
     380        ) )
     381if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
     382    set "PATH=%BOOST_JAM_TOOLSET_ROOT%Bin;%PATH%"
     383    )
     384set "BOOST_JAM_CC=bcc32 -WC -w- -q -I%BOOST_JAM_TOOLSET_ROOT%Include -L%BOOST_JAM_TOOLSET_ROOT%Lib /DNT -nbootstrap"
     385set "BOOST_JAM_OPT_JAM=-ejam0"
     386set "BOOST_JAM_OPT_MKJAMBASE=-emkjambasejam0"
     387set "BOOST_JAM_OPT_YYACC=-eyyacc0"
     388set "_known_=1"
     389:Skip_BORLAND
     390if NOT "_%BOOST_JAM_TOOLSET%_" == "_como_" goto Skip_COMO
     391set "BOOST_JAM_CC=como -DNT"
     392set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe"
     393set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe"
     394set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe"
     395set "_known_=1"
     396:Skip_COMO
     397if NOT "_%BOOST_JAM_TOOLSET%_" == "_gcc_" goto Skip_GCC
     398set "BOOST_JAM_CC=gcc -DNT"
     399set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe"
     400set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe"
     401set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe"
     402set "_known_=1"
     403:Skip_GCC
     404if NOT "_%BOOST_JAM_TOOLSET%_" == "_gcc-nocygwin_" goto Skip_GCC_NOCYGWIN
     405set "BOOST_JAM_CC=gcc -DNT -mno-cygwin"
     406set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe"
     407set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe"
     408set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe"
     409set "_known_=1"
     410:Skip_GCC_NOCYGWIN
     411if NOT "_%BOOST_JAM_TOOLSET%_" == "_intel-win32_" goto Skip_INTEL_WIN32
     412set "BOOST_JAM_CC=icl -DNT /nologo kernel32.lib advapi32.lib user32.lib"
     413set "BOOST_JAM_OPT_JAM=/Febootstrap\jam0"
     414set "BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0"
     415set "BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0"
     416set "_known_=1"
     417:Skip_INTEL_WIN32
     418if NOT "_%BOOST_JAM_TOOLSET%_" == "_mingw_" goto Skip_MINGW
     419if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
     420    set "PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%"
     421    )
     422set "BOOST_JAM_CC=gcc -DNT"
     423set "BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe"
     424set "BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe"
     425set "BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe"
     426set "_known_=1"
     427:Skip_MINGW
     428call :Clear_Error
     429if "_%_known_%_" == "__" (
     430    call :Error_Print "Unknown toolset: %BOOST_JAM_TOOLSET%"
     431)
     432if errorlevel 1 goto Finish
     433
     434echo ###
     435echo ### Using '%BOOST_JAM_TOOLSET%' toolset.
     436echo ###
     437
     438set YYACC_SOURCES=yyacc.c
     439set MKJAMBASE_SOURCES=mkjambase.c
     440set BJAM_SOURCES=
     441set BJAM_SOURCES=%BJAM_SOURCES% command.c compile.c debug.c execnt.c expand.c filent.c glob.c hash.c
     442set BJAM_SOURCES=%BJAM_SOURCES% hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c
     443set BJAM_SOURCES=%BJAM_SOURCES% newstr.c option.c output.c parse.c pathunix.c regexp.c
     444set BJAM_SOURCES=%BJAM_SOURCES% rules.c scan.c search.c subst.c timestamp.c variable.c modules.c
     445set BJAM_SOURCES=%BJAM_SOURCES% strings.c filesys.c builtins.c md5.c pwd.c class.c w32_getreg.c native.c
     446set BJAM_SOURCES=%BJAM_SOURCES% modules/set.c modules/path.c modules/regex.c
     447set BJAM_SOURCES=%BJAM_SOURCES% modules/property-set.c modules/sequence.c modules/order.c
     448
     449set BJAM_UPDATE=
     450:Check_Update
     451call :Test_Empty %1
     452if not errorlevel 1 goto Check_Update_End
     453call :Clear_Error
     454setlocal
     455set test=%1
     456set test=###%test%###
     457set test=%test:"###=%
     458set test=%test:###"=%
     459set test=%test:###=%
     460if "%test%" == "--update" set BJAM_UPDATE=update
     461endlocal
     462shift
     463if not "_%BJAM_UPDATE%_" == "_update_" goto Check_Update
     464:Check_Update_End
     465if "_%BJAM_UPDATE%_" == "_update_" (
     466    if not exist ".\bootstrap\jam0.exe" (
     467        set BJAM_UPDATE=
     468    )
     469)
     470
     471@echo ON
     472@if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Bootstrap
     473if exist bootstrap rd /S /Q bootstrap
     474md bootstrap
     475@if not exist jamgram.y goto Bootstrap_GrammarPrep
     476@if not exist jamgramtab.h goto Bootstrap_GrammarPrep
     477@goto Skip_GrammarPrep
     478:Bootstrap_GrammarPrep
     479%BOOST_JAM_CC% %BOOST_JAM_OPT_YYACC% %YYACC_SOURCES%
     480@if not exist ".\bootstrap\yyacc0.exe" goto Skip_GrammarPrep
     481.\bootstrap\yyacc0 jamgram.y jamgramtab.h jamgram.yy
     482:Skip_GrammarPrep
     483@if not exist jamgram.c goto Bootstrap_GrammarBuild
     484@if not exist jamgram.h goto Bootstrap_GrammarBuild
     485@goto Skip_GrammarBuild
     486:Bootstrap_GrammarBuild
     487@echo OFF
     488if "_%YACC%_" == "__" (
     489    call :Guess_Yacc
     490)
     491if errorlevel 1 goto Finish
     492@echo ON
     493%YACC% jamgram.y
     494@if errorlevel 1 goto Finish
     495del /f jamgram.c
     496rename y.tab.c jamgram.c
     497del /f jamgram.h
     498rename y.tab.h jamgram.h
     499:Skip_GrammarBuild
     500@echo ON
     501@if exist jambase.c goto Skip_Jambase
     502%BOOST_JAM_CC% %BOOST_JAM_OPT_MKJAMBASE% %MKJAMBASE_SOURCES%
     503@if not exist ".\bootstrap\mkjambase0.exe" goto Skip_Jambase
     504.\bootstrap\mkjambase0 jambase.c Jambase
     505:Skip_Jambase
     506%BOOST_JAM_CC% %BOOST_JAM_OPT_JAM% %BJAM_SOURCES%
     507:Skip_Bootstrap
     508@if not exist ".\bootstrap\jam0.exe" goto Skip_Jam
     509@if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Clean
     510.\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " clean
     511:Skip_Clean
     512@set args=%*
     513@echo OFF
     514:Set_Args
     515setlocal
     516call :Test_Empty %args%
     517if not errorlevel 1 goto Set_Args_End
     518set test=###%args:~0,2%###
     519set test=%test:"###=%
     520set test=%test:###"=%
     521set test=%test:###=%
     522set test=%test:~0,1%
     523if "-" == "%test%" goto Set_Args_End
     524endlocal
     525set args=%args:~1%
     526goto Set_Args
     527:Set_Args_End
     528@echo ON
     529.\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " %args%
     530:Skip_Jam
     531
     532:Finish