Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/build/jam_src/build.bat @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 13.2 KB
Line 
1@ECHO OFF
2
3REM ~ Copyright 2002-2005 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
10REM NOTE: The "setlocal & endlocal" construct is used to reset the errorlevel to 0.
11REM NOTE: The "set _error_=" construct is used to set the errorlevel to 1
12
13:Error_Print
14REM Output an error message and set the errorlevel to indicate failure.
15setlocal
16ECHO ###
17ECHO ### %1
18ECHO ###
19ECHO ### You can specify the toolset as the argument, i.e.:
20ECHO ###     .\build.bat msvc
21ECHO ###
22ECHO ### Toolsets supported by this script are: borland, como, gcc, gcc-nocygwin, intel-win32, metrowerks, mingw, msvc, vc7
23ECHO ###
24set _error_=
25endlocal
26goto :eof
27
28:Test_Path
29REM Tests for the given file(executable) presence in the directories in the PATH
30REM environment variable. Additionaly sets FOUND_PATH to the path of the
31REM found file.
32setlocal & endlocal
33setlocal
34set test=%~$PATH:1
35endlocal
36if not errorlevel 1 set FOUND_PATH=%~dp$PATH:1
37goto :eof
38
39:Test_Option
40REM Tests wether the given string is in the form of an option: "-*"
41setlocal & endlocal
42setlocal
43set test=%1
44if not "-" == "%test:~0,1%" set _error_=
45endlocal
46goto :eof
47
48:Guess_Toolset
49REM Try and guess the toolset to bootstrap the build with...
50REM Sets BOOST_JAM_TOOLSET to the first found toolset.
51REM May also set BOOST_JAM_TOOLSET_ROOT to the
52REM location of the found toolset.
53setlocal & endlocal
54if NOT "_%VS71COMNTOOLS%_" == "__" (
55    set BOOST_JAM_TOOLSET=vc7
56    set BOOST_JAM_TOOLSET_ROOT=%VS71COMNTOOLS%\..\..\VC7\
57    goto :eof)
58setlocal & endlocal
59if NOT "_%VCINSTALLDIR%_" == "__" (
60    set BOOST_JAM_TOOLSET=vc7
61    set BOOST_JAM_TOOLSET_ROOT=%VCINSTALLDIR%\VC7\
62    goto :eof)
63setlocal & endlocal
64if EXIST "%ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\bin\VCVARS32.BAT" (
65    set BOOST_JAM_TOOLSET=vc7
66    set BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\
67    goto :eof)
68setlocal & endlocal
69if EXIST "C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\bin\VCVARS32.BAT" (
70    set BOOST_JAM_TOOLSET=vc7
71    set BOOST_JAM_TOOLSET_ROOT=C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\
72    goto :eof)
73setlocal & endlocal
74if EXIST "%ProgramFiles%\Microsoft Visual Studio .NET\VC7\bin\VCVARS32.BAT" (
75    set BOOST_JAM_TOOLSET=vc7
76    set BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio .NET\VC7\
77    goto :eof)
78setlocal & endlocal
79if EXIST "C:\Program Files\Microsoft Visual Studio .NET\VC7\bin\VCVARS32.BAT" (
80    set BOOST_JAM_TOOLSET=vc7
81    set BOOST_JAM_TOOLSET_ROOT=C:\Program Files\Microsoft Visual Studio .NET\VC7\
82    goto :eof)
83setlocal & endlocal
84if NOT "_%MSVCDir%_" == "__" (
85    set BOOST_JAM_TOOLSET=msvc
86    set BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\
87    goto :eof)
88setlocal & endlocal
89if EXIST "%ProgramFiles%\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT" (
90    set BOOST_JAM_TOOLSET=msvc
91    set BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual Studio\VC98\
92    goto :eof)
93setlocal & endlocal
94if EXIST "C:\Program Files\Microsoft Visual Studio\VC98\bin\VCVARS32.BAT" (
95    set BOOST_JAM_TOOLSET=msvc
96    set BOOST_JAM_TOOLSET_ROOT=C:\Program Files\Microsoft Visual Studio\VC98\
97    goto :eof)
98setlocal & endlocal
99if EXIST "%ProgramFiles%\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" (
100    set BOOST_JAM_TOOLSET=msvc
101    set BOOST_JAM_TOOLSET_ROOT=%ProgramFiles%\Microsoft Visual C++\VC98\
102    goto :eof)
103setlocal & endlocal
104if EXIST "C:\Program Files\Microsoft Visual C++\VC98\bin\VCVARS32.BAT" (
105    set BOOST_JAM_TOOLSET=msvc
106    set BOOST_JAM_TOOLSET_ROOT=C:\Program Files\Microsoft Visual C++\VC98\
107    goto :eof)
108setlocal & endlocal
109call :Test_Path cl.exe
110if not errorlevel 1 (
111    set BOOST_JAM_TOOLSET=msvc
112    set BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\
113    goto :eof)
114setlocal & endlocal
115call :Test_Path vcvars32.bat
116if not errorlevel 1 (
117    set BOOST_JAM_TOOLSET=msvc
118    call "%FOUND_PATH%VCVARS32.BAT"
119    set BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\
120    goto :eof)
121setlocal & endlocal
122if EXIST "C:\Borland\BCC55\Bin\bcc32.exe" (
123    set BOOST_JAM_TOOLSET=borland
124    set BOOST_JAM_TOOLSET_ROOT=C:\Borland\BCC55\
125    goto :eof)
126setlocal & endlocal
127call :Test_Path bcc32.exe
128if not errorlevel 1 (
129    set BOOST_JAM_TOOLSET=borland
130    set BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\
131    goto :eof)
132setlocal & endlocal
133call :Test_Path icl.exe
134if not errorlevel 1 (
135    set BOOST_JAM_TOOLSET=intel-win32
136    set BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\
137    goto :eof)
138setlocal & endlocal
139if EXIST "C:\MinGW\bin\gcc.exe" (
140    set BOOST_JAM_TOOLSET=mingw
141    set BOOST_JAM_TOOLSET_ROOT=C:\MinGW\
142    goto :eof)
143setlocal & endlocal
144if NOT "_%CWFolder%_" == "__" (
145    set BOOST_JAM_TOOLSET=metrowerks
146    set BOOST_JAM_TOOLSET_ROOT=%CWFolder%\
147    goto :eof )
148setlocal & endlocal
149call :Test_Path mwcc.exe
150if not errorlevel 1 (
151    set BOOST_JAM_TOOLSET=metrowerks
152    set BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\..\
153    goto :eof)
154setlocal & endlocal
155call :Error_Print "Could not find a suitable toolset."
156goto :eof
157
158:Guess_Yacc
159REM Tries to find bison or yacc in common places so we can build the grammar.
160setlocal & endlocal
161call :Test_Path yacc.exe
162if not errorlevel 1 (
163    set YACC=yacc -d
164    goto :eof)
165setlocal & endlocal
166call :Test_Path bison.exe
167if not errorlevel 1 (
168    set YACC=bison -d --yacc
169    goto :eof)
170setlocal & endlocal
171if EXIST "C:\Program Files\GnuWin32\bin\bison.exe" (
172    set YACC="C:\Program Files\GnuWin32\bin\bison.exe" -d --yacc
173    goto :eof)
174setlocal & endlocal
175call :Error_Print "Could not find Yacc to build the Jam grammar."
176goto :eof
177
178:Start
179set BOOST_JAM_TOOLSET=
180
181REM If no arguments guess the toolset;
182REM or if first argument is an option guess the toolset;
183REM otherwise the argument is the toolset to use.
184if "_%1_" == "__" (
185    call :Guess_Toolset
186    if not errorlevel 1 goto Setup_Toolset
187) else (
188    call :Test_Option %1
189    if not errorlevel 1 (
190        call :Guess_Toolset
191        if not errorlevel 1 goto Setup_Toolset
192    ) else (
193        setlocal & endlocal
194        set BOOST_JAM_TOOLSET=%1
195        shift
196        goto Setup_Toolset
197    )
198)
199if errorlevel 1 goto Finish
200
201:Setup_Toolset
202REM Setup the toolset command and options. This bit of code
203REM needs to be flexible enough to handle both when
204REM the toolset was guessed at and found, or when the toolset
205REM was indicated in the command arguments.
206REM NOTE: The strange multiple "if ?? == _toolset_" tests are that way
207REM because in BAT variables are subsituted only once during a single
208REM command. A complete "if ... ( commands ) else ( commands )"
209REM is a single command, even though it's in multiple lines here.
210if "_%BOOST_JAM_TOOLSET%_" == "_metrowerks_" (
211    if NOT "_%CWFolder%_" == "__" (
212        set BOOST_JAM_TOOLSET_ROOT=%CWFolder%\) )
213if "_%BOOST_JAM_TOOLSET%_" == "_metrowerks_" (
214    if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
215        set PATH=%BOOST_JAM_TOOLSET_ROOT%Other Metrowerks Tools\Command Line Tools;%PATH%)
216    set BOOST_JAM_CC=mwcc -runtime ss -cwd include -DNT -ladvapi32.lib
217    set BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe
218    set BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe
219    set BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe
220    set _known_=1
221)
222if "_%BOOST_JAM_TOOLSET%_" == "_msvc_" (
223    if NOT "_%MSVCDir%_" == "__" (
224        set BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\) )
225if "_%BOOST_JAM_TOOLSET%_" == "_msvc_" (
226    if EXIST "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT" (
227        call "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT" ) )
228if "_%BOOST_JAM_TOOLSET%_" == "_msvc_" (
229    if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
230        set PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%)
231    set BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd -DNT -DYYDEBUG kernel32.lib advapi32.lib
232    set BOOST_JAM_OPT_JAM=/Febootstrap\jam0
233    set BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0
234    set BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0
235    set _known_=1
236)
237if "_%BOOST_JAM_TOOLSET%_" == "_vc7_" (
238    if NOT "_%MSVCDir%_" == "__" (
239        set BOOST_JAM_TOOLSET_ROOT=%MSVCDir%\) )
240if "_%BOOST_JAM_TOOLSET%_" == "_vc7_" (
241    if EXIST "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT" (
242        call "%BOOST_JAM_TOOLSET_ROOT%bin\VCVARS32.BAT" ) )
243if "_%BOOST_JAM_TOOLSET%_" == "_vc7_" (
244    if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
245        set PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%)
246    set BOOST_JAM_CC=cl /nologo /GZ /Zi /MLd -DNT -DYYDEBUG kernel32.lib advapi32.lib
247    set BOOST_JAM_OPT_JAM=/Febootstrap\jam0
248    set BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0
249    set BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0
250    set _known_=1
251)
252if "_%BOOST_JAM_TOOLSET%_" == "_borland_" (
253    if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
254        call :Test_Path bcc32.exe ) )
255if "_%BOOST_JAM_TOOLSET%_" == "_borland_" (
256    if "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (
257        if not errorlevel 1 (
258            set BOOST_JAM_TOOLSET_ROOT=%FOUND_PATH%..\) ) )
259if "_%BOOST_JAM_TOOLSET%_" == "_borland_" (
260    if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (set PATH=%BOOST_JAM_TOOLSET_ROOT%Bin;%PATH%)
261    set BOOST_JAM_CC=bcc32 -WC -w- -q "-I%BOOST_JAM_TOOLSET_ROOT%Include" "-L%BOOST_JAM_TOOLSET_ROOT%Lib" /DNT -nbootstrap
262    set BOOST_JAM_OPT_JAM=-ejam0
263    set BOOST_JAM_OPT_MKJAMBASE=-emkjambasejam0
264    set BOOST_JAM_OPT_YYACC=-eyyacc0
265    set _known_=1
266)
267if "_%BOOST_JAM_TOOLSET%_" == "_como_" (
268    set BOOST_JAM_CC=como -DNT
269    set BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe
270    set BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe
271    set BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe
272    set _known_=1
273)
274if "_%BOOST_JAM_TOOLSET%_" == "_gcc_" (
275    set BOOST_JAM_CC=gcc -DNT
276    set BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe
277    set BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe
278    set BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe
279    set _known_=1
280)
281if "_%BOOST_JAM_TOOLSET%_" == "_gcc-nocygwin_" (
282    set BOOST_JAM_CC=gcc -DNT -mno-cygwin
283    set BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe
284    set BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe
285    set BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe
286    set _known_=1
287)
288if "_%BOOST_JAM_TOOLSET%_" == "_intel-win32_" (
289    set BOOST_JAM_CC=icl -DNT /nologo
290    set BOOST_JAM_OPT_JAM=/Febootstrap\jam0
291    set BOOST_JAM_OPT_MKJAMBASE=/Febootstrap\mkjambase0
292    set BOOST_JAM_OPT_YYACC=/Febootstrap\yyacc0
293    set _known_=1
294)
295if "_%BOOST_JAM_TOOLSET%_" == "_mingw_" (
296    if not "_%BOOST_JAM_TOOLSET_ROOT%_" == "__" (set PATH=%BOOST_JAM_TOOLSET_ROOT%bin;%PATH%)
297    set BOOST_JAM_CC=gcc -DNT
298    set BOOST_JAM_OPT_JAM=-o bootstrap\jam0.exe
299    set BOOST_JAM_OPT_MKJAMBASE=-o bootstrap\mkjambase0.exe
300    set BOOST_JAM_OPT_YYACC=-o bootstrap\yyacc0.exe
301    set _known_=1
302)
303if "_%_known_%_" == "__" (
304    call :Error_Print "Unknown toolset: %BOOST_JAM_TOOLSET%"
305)
306if errorlevel 1 goto Finish
307
308echo ###
309echo ### Using '%BOOST_JAM_TOOLSET%' toolset.
310echo ###
311
312set YYACC_SOURCES=yyacc.c
313set MKJAMBASE_SOURCES=mkjambase.c
314set BJAM_SOURCES=
315set BJAM_SOURCES=%BJAM_SOURCES% command.c compile.c execnt.c execunix.c execvms.c expand.c
316set BJAM_SOURCES=%BJAM_SOURCES% filent.c fileos2.c fileunix.c filevms.c glob.c hash.c
317set BJAM_SOURCES=%BJAM_SOURCES% hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c
318set BJAM_SOURCES=%BJAM_SOURCES% newstr.c option.c parse.c pathunix.c pathvms.c regexp.c
319set BJAM_SOURCES=%BJAM_SOURCES% rules.c scan.c search.c subst.c timestamp.c variable.c modules.c
320set BJAM_SOURCES=%BJAM_SOURCES% strings.c filesys.c builtins.c pwd.c class.c w32_getreg.c native.c
321set BJAM_SOURCES=%BJAM_SOURCES% modules/set.c modules/path.c modules/regex.c
322set BJAM_SOURCES=%BJAM_SOURCES% modules/property-set.c modules/sequence.c modules/order.c
323
324set BJAM_UPDATE=
325if "_%1" == "_--update" (
326    set BJAM_UPDATE=update
327)
328if "_%2" == "_--update" (
329    set BJAM_UPDATE=update
330)
331if "_%3" == "_--update" (
332    set BJAM_UPDATE=update
333)
334if "_%4" == "_--update" (
335    set BJAM_UPDATE=update
336)
337if "_%BJAM_UPDATE%_" == "_update_" (
338    if not exist ".\bootstrap\jam0.exe" (
339        set BJAM_UPDATE=
340    )
341)
342
343
344@echo ON
345@if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Bootstrap
346rd /S /Q bootstrap
347md bootstrap
348@if not exist jamgram.y goto Bootstrap_GrammarPrep
349@if not exist jamgramtab.h goto Bootstrap_GrammarPrep
350@goto Skip_GrammarPrep
351:Bootstrap_GrammarPrep
352%BOOST_JAM_CC% %BOOST_JAM_OPT_YYACC% %YYACC_SOURCES%
353@if not exist ".\bootstrap\yyacc0.exe" goto Skip_GrammarPrep
354.\bootstrap\yyacc0 jamgram.y jamgramtab.h jamgram.yy
355:Skip_GrammarPrep
356@if not exist jamgram.c goto Bootstrap_GrammarBuild
357@if not exist jamgram.h goto Bootstrap_GrammarBuild
358@goto Skip_GrammarBuild
359:Bootstrap_GrammarBuild
360@echo OFF
361if "_%YACC%_" == "__" (
362    call :Guess_Yacc
363)
364if errorlevel 1 goto Finish
365@echo ON
366%YACC% jamgram.y
367@if errorlevel 1 goto Finish
368del /f jamgram.c
369rename y.tab.c jamgram.c
370del /f jamgram.h
371rename y.tab.h jamgram.h
372:Skip_GrammarBuild
373@echo ON
374@if exist jambase.c goto Skip_Jambase
375%BOOST_JAM_CC% %BOOST_JAM_OPT_MKJAMBASE% %MKJAMBASE_SOURCES%
376@if not exist ".\bootstrap\mkjambase0.exe" goto Skip_Jambase
377.\bootstrap\mkjambase0 jambase.c Jambase
378:Skip_Jambase
379%BOOST_JAM_CC% %BOOST_JAM_OPT_JAM% %BJAM_SOURCES%
380:Skip_Bootstrap
381@if not exist ".\bootstrap\jam0.exe" goto Skip_Jam
382@if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Clean
383.\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " clean
384:Skip_Clean
385.\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " %1 %2 %3 %4 %5 %6 %7 %8 %9
386:Skip_Jam
387
388:Finish
Note: See TracBrowser for help on using the repository browser.