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)
22 REM Output an error message and set the errorlevel to indicate failure.
27 ECHO ### You can specify the toolset as the argument
, i.e.
:
28 ECHO ### .
\build.bat msvc
30 ECHO ### Toolsets supported by this script are
: borland
, como
, gcc
,
31 ECHO ### gcc
-nocygwin
, intel
-win32
, metrowerks
, mingw
, msvc
, vc7
, vc8
,
32 ECHO ### vc9
, vc10
, vc11
, vc12
, vc14
, vc141
34 ECHO ###
If you have Visual Studio
2017 installed you will need either update
35 ECHO ### the Visual Studio
2017 installer or
run from VS
2017 Command Prompt
36 ECHO ### as we where unable to detect your toolset installation.
44 REM Tests whether the given string is in the form of an option: "--*"
56 if not "-" == "%test:~1,1%" call :Set_Error
63 REM Tests whether the given string is not empty
75 if not "" == "%test%" call :Set_Error
82 REM Try and guess the toolset to bootstrap the build with...
83 REM Sets BOOST_JAM_TOOLSET to the first found toolset.
84 REM May also set BOOST_JAM_TOOLSET_ROOT to the
85 REM location of the found toolset.
88 call :Test_Empty "%ProgramFiles%"
89 if not errorlevel 1 set "ProgramFiles=C:\Program Files"
91 REM Visual studio is by default installed to %ProgramFiles% on 32-bit machines and
92 REM %ProgramFiles(x86)% on 64-bit machines. Making a common variable for both.
94 call :Test_Empty "%ProgramFiles(x86)%"
96 set "VS_ProgramFiles=%ProgramFiles(x86)%"
98 set "VS_ProgramFiles=%ProgramFiles%"
101 call guess_toolset.bat
103 call :Error_Print "Could not find a suitable toolset."
108 call guess_toolset.bat yacc
110 call :Error_Print "Could not find Yacc to build the Jam grammar.")
115 set BOOST_JAM_TOOLSET
=
118 REM If no arguments guess the toolset;
119 REM or if first argument is an option guess the toolset;
120 REM otherwise the argument is the toolset to use.
123 if not errorlevel 1 (
125 if not errorlevel 1 ( goto Setup_Toolset
) else ( goto Finish
)
130 if not errorlevel 1 (
132 if not errorlevel 1 ( goto Setup_Toolset
) else ( goto Finish
)
136 set BOOST_JAM_TOOLSET
=%1
142 REM Setup the toolset command and options. This bit of code
143 REM needs to be flexible enough to handle both when
144 REM the toolset was guessed at and found, or when the toolset
145 REM was indicated in the command arguments.
146 REM NOTE: The strange multiple "if ?? == _toolset_" tests are that way
147 REM because in BAT variables are subsituted only once during a single
148 REM command. A complete "if ... else ..."
149 REM is a single command, even though it's in multiple lines here.
153 if not errorlevel 1 goto Config_Toolset
157 set BOOST_JAM_ARGS
=%BOOST_JAM_ARGS% %1
162 call config_toolset.bat
163 if "_%_known_%_" == "__" (
164 call :Error_Print "Unknown toolset: %BOOST_JAM_TOOLSET%"
166 if errorlevel 1 goto Finish
169 echo ### Using
'%BOOST_JAM_TOOLSET%' toolset.
172 set YYACC_SOURCES
=yyacc.c
173 set MKJAMBASE_SOURCES
=mkjambase.c
175 set BJAM_SOURCES
=%BJAM_SOURCES% command.c compile.c constants.c
debug.c
176 set BJAM_SOURCES
=%BJAM_SOURCES% execcmd.c execnt.c filent.c frames.c function.c
177 set BJAM_SOURCES
=%BJAM_SOURCES% glob.c hash.c hdrmacro.c headers.c jam.c
178 set BJAM_SOURCES
=%BJAM_SOURCES% jambase.c jamgram.c lists.c make.c make1.c
179 set BJAM_SOURCES
=%BJAM_SOURCES% object.c option.c output.c parse.c pathnt.c
180 set BJAM_SOURCES
=%BJAM_SOURCES% pathsys.c regexp.c rules.c scan.c search.c
181 set BJAM_SOURCES
=%BJAM_SOURCES% subst.c timestamp.c variable.c modules.c
182 set BJAM_SOURCES
=%BJAM_SOURCES% strings.c filesys.c builtins.c md5.c class.c
183 set BJAM_SOURCES
=%BJAM_SOURCES% cwd.c w32_getreg.c native.c modules
/set.c
184 set BJAM_SOURCES
=%BJAM_SOURCES% modules
/path.c modules
/regex.c
185 set BJAM_SOURCES
=%BJAM_SOURCES% modules
/property
-set.c modules
/sequence.c
186 set BJAM_SOURCES
=%BJAM_SOURCES% modules
/order.c
191 if not errorlevel 1 goto Check_Update_End
195 set test
=###
%test%###
196 set test
=%test
:"###=%
197 set test=%test:###"=%
199 if "%test%" == "--update" goto Found_Update
200 endlocal & set BOOST_JAM_TOOLSET
=%BOOST_JAM_TOOLSET%
202 if not "_%BJAM_UPDATE%_" == "_update_" goto Check_Update
204 endlocal & set BOOST_JAM_TOOLSET
=%BOOST_JAM_TOOLSET%
205 set BJAM_UPDATE
=update
207 if "_%BJAM_UPDATE%_" == "_update_" (
208 if not exist ".\bootstrap\jam0.exe" (
214 @
if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Bootstrap
215 if exist bootstrap
rd /S
/Q bootstrap
217 @
if not exist jamgram.y
goto Bootstrap_GrammarPrep
218 @
if not exist jamgramtab.h
goto Bootstrap_GrammarPrep
219 @
goto Skip_GrammarPrep
220 :Bootstrap_GrammarPrep
221 %BOOST_JAM_CC% %BOOST_JAM_OPT_YYACC% %YYACC_SOURCES%
222 @
if not exist ".\bootstrap\yyacc0.exe" goto Skip_GrammarPrep
223 .
\bootstrap\yyacc0 jamgram.y jamgramtab.h jamgram.yy
225 @
if not exist jamgram.c
goto Bootstrap_GrammarBuild
226 @
if not exist jamgram.h
goto Bootstrap_GrammarBuild
227 @
goto Skip_GrammarBuild
228 :Bootstrap_GrammarBuild
230 if "_%YACC%_" == "__" (
233 if errorlevel 1 goto Finish
236 @
if errorlevel 1 goto Finish
238 rename y.tab.c jamgram.c
240 rename y.tab.h jamgram.h
243 @
if exist jambase.c
goto Skip_Jambase
244 %BOOST_JAM_CC% %BOOST_JAM_OPT_MKJAMBASE% %MKJAMBASE_SOURCES%
245 @
if not exist ".\bootstrap\mkjambase0.exe" goto Skip_Jambase
246 .
\bootstrap\mkjambase0 jambase.c Jambase
248 %BOOST_JAM_CC% %BOOST_JAM_OPT_JAM% %BJAM_SOURCES%
250 @
if not exist ".\bootstrap\jam0.exe" goto Skip_Jam
255 call :Test_Empty %args%
256 if not errorlevel 1 goto Set_Args_End
257 set test
=###
%args
:~
0,2%###
258 set test
=%test
:"###=%
259 set test=%test:###"=%
261 set test1
=%test
:~
0,1%
262 set test2
=%test
:~
1,1%
263 REM We can't just search for dash because it might be a part of
264 REM toolset name, like in `intel-win32'.
265 if "-" == "%test1%" goto Set_Args_End
266 if "-" == "%test2%" if not " " == "%test1" if not """" == "%test1" goto Set_Args_bite_Two
267 goto Set_Args_Bite_One
276 @
if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Clean
277 .
\bootstrap\jam0
-f build.jam
--toolset
=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " %args% clean
279 .
\bootstrap\jam0
-f build.jam
--toolset
=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " %args%