Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/tools/jam/src/build.bat @ 29

Last change on this file since 29 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

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