]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/build.bat
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / tools / build / src / engine / build.bat
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,
31 ECHO ### gcc-nocygwin, intel-win32, metrowerks, mingw,
32 ECHO ### vc11, vc12, vc14, vc141, vc142
33 ECHO ###
34 ECHO ### If you have Visual Studio 2017 installed you will need to 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.
37 ECHO ###
38 call :Set_Error
39 endlocal
40 goto :eof
41
42
43 :Test_Option
44 REM Tests whether the given string is in the form of an option: "--*"
45 call :Clear_Error
46 setlocal
47 set test=%1
48 if not defined test (
49 call :Set_Error
50 goto Test_Option_End
51 )
52 set test=###%test%###
53 set test=%test:"###=%
54 set test=%test:###"=%
55 set test=%test:###=%
56 if not "-" == "%test:~1,1%" call :Set_Error
57 :Test_Option_End
58 endlocal
59 goto :eof
60
61
62 :Test_Empty
63 REM Tests whether the given string is not empty
64 call :Clear_Error
65 setlocal
66 set test=%1
67 if not defined test (
68 call :Clear_Error
69 goto Test_Empty_End
70 )
71 set test=###%test%###
72 set test=%test:"###=%
73 set test=%test:###"=%
74 set test=%test:###=%
75 if not "" == "%test%" call :Set_Error
76 :Test_Empty_End
77 endlocal
78 goto :eof
79
80
81 :Guess_Toolset
82 set local
83 REM Try and guess the toolset to bootstrap the build with...
84 REM Sets B2_TOOLSET to the first found toolset.
85 REM May also set B2_TOOLSET_ROOT to the
86 REM location of the found toolset.
87
88 call :Clear_Error
89 call :Test_Empty "%ProgramFiles%"
90 if not errorlevel 1 set "ProgramFiles=C:\Program Files"
91
92 REM Visual Studio is by default installed to %ProgramFiles% on 32-bit machines and
93 REM %ProgramFiles(x86)% on 64-bit machines. Making a common variable for both.
94 call :Clear_Error
95 call :Test_Empty "%ProgramFiles(x86)%"
96 if errorlevel 1 (
97 set "VS_ProgramFiles=%ProgramFiles(x86)%"
98 ) else (
99 set "VS_ProgramFiles=%ProgramFiles%"
100 )
101
102 call guess_toolset.bat
103 if errorlevel 1 (
104 call :Error_Print "Could not find a suitable toolset.")
105 goto :eof
106
107 endlocal
108 goto :eof
109
110
111 :Start
112 set B2_TOOLSET=
113 set B2_BUILD_ARGS=
114
115 REM If no arguments guess the toolset;
116 REM or if first argument is an option guess the toolset;
117 REM otherwise the argument is the toolset to use.
118 call :Clear_Error
119 call :Test_Empty %1
120 if not errorlevel 1 (
121 call :Guess_Toolset
122 if not errorlevel 1 ( goto Setup_Toolset ) else ( goto Finish )
123 )
124
125 call :Clear_Error
126 call :Test_Option %1
127 if not errorlevel 1 (
128 call :Guess_Toolset
129 if not errorlevel 1 ( goto Setup_Toolset ) else ( goto Finish )
130 )
131
132 call :Clear_Error
133 set B2_TOOLSET=%1
134 shift
135 goto Setup_Toolset
136
137
138 :Setup_Toolset
139 REM Setup the toolset command and options. This bit of code
140 REM needs to be flexible enough to handle both when
141 REM the toolset was guessed at and found, or when the toolset
142 REM was indicated in the command arguments.
143 REM NOTE: The strange multiple "if ?? == _toolset_" tests are that way
144 REM because in BAT variables are subsituted only once during a single
145 REM command. A complete "if ... else ..."
146 REM is a single command, even though it's in multiple lines here.
147 :Setup_Args
148 call :Clear_Error
149 call :Test_Empty %1
150 if not errorlevel 1 goto Config_Toolset
151 call :Clear_Error
152 call :Test_Option %1
153 if errorlevel 1 (
154 set B2_BUILD_ARGS=%B2_BUILD_ARGS% %1
155 shift
156 goto Setup_Args
157 )
158 :Config_Toolset
159 call config_toolset.bat
160 if "_%_known_%_" == "__" (
161 call :Error_Print "Unknown toolset: %B2_TOOLSET%"
162 )
163 if errorlevel 1 goto Finish
164
165 echo ###
166 echo ### Using '%B2_TOOLSET%' toolset.
167 echo ###
168
169 set B2_SOURCES=
170 set B2_SOURCES=%B2_SOURCES% builtins.cpp class.cpp
171 set B2_SOURCES=%B2_SOURCES% command.cpp compile.cpp constants.cpp cwd.cpp
172 set B2_SOURCES=%B2_SOURCES% debug.cpp debugger.cpp
173 set B2_SOURCES=%B2_SOURCES% execcmd.cpp execnt.cpp filent.cpp filesys.cpp frames.cpp function.cpp
174 set B2_SOURCES=%B2_SOURCES% glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam.cpp
175 set B2_SOURCES=%B2_SOURCES% jambase.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp
176 set B2_SOURCES=%B2_SOURCES% native.cpp object.cpp option.cpp output.cpp parse.cpp pathnt.cpp
177 set B2_SOURCES=%B2_SOURCES% pathsys.cpp regexp.cpp rules.cpp scan.cpp search.cpp strings.cpp
178 set B2_SOURCES=%B2_SOURCES% subst.cpp sysinfo.cpp timestamp.cpp variable.cpp w32_getreg.cpp
179 set B2_SOURCES=%B2_SOURCES% modules/order.cpp
180 set B2_SOURCES=%B2_SOURCES% modules/path.cpp
181 set B2_SOURCES=%B2_SOURCES% modules/property-set.cpp
182 set B2_SOURCES=%B2_SOURCES% modules/regex.cpp
183 set B2_SOURCES=%B2_SOURCES% modules/sequence.cpp
184 set B2_SOURCES=%B2_SOURCES% modules/set.cpp
185
186 set B2_CXXFLAGS=%B2_CXXFLAGS% -DNDEBUG
187
188 @echo ON
189 %B2_CXX% %CXXFLAGS% %B2_CXXFLAGS% %B2_SOURCES% %B2_CXX_LINK%
190 dir *.exe
191 copy /b .\b2.exe .\bjam.exe
192
193 :Finish
194 @exit /b %ERRORLEVEL%