- Merge the three build.cmd files into one and start cleaning up the .cmd files, unfinished.

svn path=/trunk/tools/RosBE-Windows/; revision=401
This commit is contained in:
Peter Ward 2007-10-20 01:31:21 +00:00
parent 1227a09208
commit 3bad21606c
5 changed files with 153 additions and 195 deletions

View File

@ -1,40 +0,0 @@
::
:: PROJECT: RosBE - ReactOS Build Environment for Windows
:: LICENSE: GPL - See COPYING in the top level directory
:: FILE: Root/Build-Multi.cmd
:: PURPOSE: Perform the build of ReactOS, but use the -j option with the appropriate
:: number for the number of CPUs in the system.
:: COPYRIGHT: Copyright 2007 Daniel Reimer <reimer.daniel@freenet.de>
:: Colin Finck <mail@colinfinck.de>
:: Peter Ward <dralnix@gmail.com>
::
::
@echo off
title Building...
::
:: Clear variables before use.
::
set CPUCOUNT=
::
:: Get the number of CPUs in the system so we know how many jobs to execute.
:: To modify the number used alter the options used with cpucount:
:: No Option - Number of CPUs.
:: -x1 - Number of CPUs, Plus 1.
:: -x2 - Number of CPUs, Doubled.
::
for /f "usebackq" %%i in (`cpucount -x1`) do set CPUCOUNT=%%i
::
:: Set the build command
::
set MAKE_COMMAND="%_MINGWMAKE%" -j %CPUCOUNT% %1
::
:: Execute the shared build commands
::
call "%ROSBEBASEDIR%\Build-Shared.cmd" %2 %3
title ReactOS Build Environment %_VER%

View File

@ -1,112 +0,0 @@
::
:: PROJECT: RosBE - ReactOS Build Environment for Windows
:: LICENSE: GPL - See COPYING in the top level directory
:: FILE: Root/Build-Shared.cmd
:: PURPOSE: Shared actions for "Build.cmd" and "Build-Multi.cmd".
:: COPYRIGHT: Copyright 2007 Daniel Reimer <reimer.daniel@freenet.de>
:: Colin Finck <mail@colinfinck.de>
:: Peter Ward <dralnix@gmail.com>
::
::
@echo off
::
:: Check the parameters.
::
if "%1" == "" (
goto :Build
) else (
echo Unknown parameter specified.
goto :EOF
:Build
::
:: Check if our log directory exists, if it doesn't, create it. Also check
:: if the default Path was editied by Config Tool. If so, update the
:: path.
::
if %logdiff% == 0 (
if not exist "RosBE-Logs\." (
if not exist "Makefile" (
echo Folder is empty. No Build can be performed without a Source Code.
goto :EOB
) else (
mkdir "RosBE-Logs"
set _ROSBELOGDIR=RosBE-Logs
)
) else (
set _ROSBELOGDIR=RosBE-Logs
)
)
if %logdiff% == 1 (
if not exist "%ROSBE_LOGPATH%\." (
echo LogFolder does not exist.
) else (
set _ROSBELOGDIR=%ROSBE_LOGPATH%
)
)
)
::
:: Check if config.template.rbuild is newer than config.rbuild, if it is then
:: abort the build and inform the user.
::
if exist "config.rbuild" (
test "config.template.rbuild" -nt "config.rbuild"
if not errorlevel 1 (
echo.
echo *** config.template.rbuild is newer than config.rbuild ***
echo *** aborting build. Please update your config.rbuild ***
echo *** by typeing "config update". ***
echo.
goto :EOB
)
)
if %ROSBE_STRIP% == 1 (
set ROS_LEAN_AND_MEAN=yes
)
if %ROSBE_USECCACHE% == 1 (
set ROS_LEAN_AND_MEAN=no
set HOST_CC=ccache gcc
set HOST_CPP=ccache g++
set TARGET_CC=ccache gcc
set TARGET_CPP=ccache g++
)
::
:: Get the current date and time for use in in our build log's file name.
::
call "%ROSBEBASEDIR%\TimeDate.cmd"
::
:: Now use mingw32-make to build ReactOS, passing along options, if any.
::
title Started: %TIMERAW%, Building...
if %ROSBE_SHOWTIME% == 1 (
if %ROSBE_WRITELOG% == 1 (
buildtime "%MAKE_COMMAND%" 2>&1 | tee "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
)
if %ROSBE_WRITELOG% == 0 (
buildtime "%MAKE_COMMAND%" 2>&1
)
)
if %ROSBE_SHOWTIME% == 0 (
if %ROSBE_WRITELOG% == 1 (
"%MAKE_COMMAND%" 2>&1 | tee "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
)
if %ROSBE_WRITELOG% == 0 (
"%MAKE_COMMAND%" 2>&1
)
)
::
:: Highlight the fact that building has ended.
::
flash
:EOB
title ReactOS Build Environment %_VER%

View File

@ -13,13 +13,135 @@
title Building...
::
:: Set the build command
:: Check if the user has used the options utility and
:: if so, load their options.
::
set MAKE_COMMAND="%_MINGWMAKE%" %1
if exist %ROSBEBASEDIR%\options.cmd (
call %ROSBEBASEDIR%\options.cmd
)
::
:: Execute the shared build commands
:: Check if config.template.rbuild is newer than config.rbuild, if it is then
:: abort the build and inform the user.
::
call "%ROSBEBASEDIR%\Build-Shared.cmd" %2 %3
if exist "config.rbuild" (
test "config.template.rbuild" -nt "config.rbuild"
if not errorlevel 1 (
echo.
echo *** config.template.rbuild is newer than config.rbuild ***
echo *** aborting build. Please update your config.rbuild ***
echo *** by typeing "config update". ***
echo.
goto :EOB
)
)
::
:: Clear variables before use.
::
set CPUCOUNT=
::
:: Get the number of CPUs in the system so we know how many jobs to execute.
:: To modify the number used alter the options used with cpucount:
:: No Option - Number of CPUs.
:: -x1 - Number of CPUs, Plus 1.
:: -x2 - Number of CPUs, Doubled.
::
for /f "usebackq" %%i in (`cpucount -x1`) do set CPUCOUNT=%%i
::
:: Check if strip or ccache are being used and set the appropriate options.
::
if defined ROSBE_STRIP (
if %ROSBE_STRIP% == 1 (
set ROS_LEAN_AND_MEAN=yes
) else (
set ROS_LEAN_AND_MEAN=no
)
)
if defined ROSBE_USECCACHE (
if %ROSBE_USECCACHE% == 1 (
set HOST_CC=ccache gcc
set HOST_CPP=ccache g++
set TARGET_CC=ccache gcc
set TARGET_CPP=ccache g++
) else (
set HOST_CC=gcc
set HOST_CPP=g++
set TARGET_CC=gcc
set TARGET_CPP=g++
)
)
::
:: Get the current date and time for use in in our build log's file name.
::
call "%ROSBEBASEDIR%\TimeDate.cmd"
::
:: Check if writing logs is enabled, if so check if our log directory
:: exists, if it doesn't, create it, finally if creating the
:: directory fails then fall back on the current directory.
::
if %ROSBE_WRITELOG% == 1 (
if not exist "_ROSBELOGDIR\." (
mkdir "%_ROSBELOGDIR%" 1> NUL 2> NUL
if errorlevel 1 (
echo *** Error - Writing logs requested, but log directory doesn't ***
echo *** exist and can't be created. Logs will be created in the ***
echo *** current directory as a fallback. ***
set _ROSBELOGDIR=%CD%
)
)
)
::
:: Check if we are using -j or not.
::
if "%1" == "multi" (
title Started: %TIMERAW%, Building...
goto :BUILDMULTI
) else (
title Started: %TIMERAW%, Building...
goto :BUILD
)
:BUILD
if %ROSBE_SHOWTIME% == 1 (
if %ROSBE_WRITELOG% == 1 (
buildtime "%_MINGWMAKE%" %* 2>&1 | tee "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
) else (
buildtime "%_MINGWMAKE%" %*
)
) else (
if %ROSBE_WRITELOG% == 1 (
"%_MINGWMAKE%" %* 2>&1 | tee "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
) else (
"%_MINGWMAKE%" %*
)
)
goto :EOB
:BUILDMULTI
if %ROSBE_SHOWTIME% == 1 (
if %ROSBE_WRITELOG% == 1 (
buildtime "%_MINGWMAKE%" -j %CPUCOUNT% %2 %3 %4 %5 %6 %7 %8 %9 2>&1 | tee "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
) else (
buildtime "%_MINGWMAKE%" -j %CPUCOUNT% %2 %3 %4 %5 %6 %7 %8 %9
)
) else (
if %ROSBE_WRITELOG% == 1 (
"%_MINGWMAKE%" -j %CPUCOUNT% %2 %3 %4 %5 %6 %7 %8 %9 2>&1 | tee "%_ROSBELOGDIR%\BuildLog-%_MINGWVERSION%-%DATENAME%-%TIMENAME%.txt"
) else (
"%_MINGWMAKE%" -j %CPUCOUNT% %2 %3 %4 %5 %6 %7 %8 %9
)
)
:EOB
::
:: Highlight the fact that building has ended.
::
flash
title ReactOS Build Environment %_VER%

View File

@ -18,49 +18,35 @@ color 0A
set _VER=0.X.X.X
set ROSBEBASEDIR=%~dp0
for /f "usebackq" %%i in (`"echo %ROSBEBASEDIR%|%ROSBEBASEDIR%Tools\sed s/.$//g"`) do @SET ROSBEBASEDIR=%%i
set _ROSSOURCEDIRBASE=%CD%
set _ROSSOURCEDIR=%CD%
set ROSBE_SHOWTIME=1
set ROSBE_WRITELOG=1
set ROSBE_USECCACHE=0
set ROSBE_STRIP=0
set ROSBE_MINGWPATH=%ROSBEBASEDIR%\4.1.3
set _LOGDIR=%CD%\RosBE-Logs
set _ROSBELOGDIR=%CD%\RosBE-Logs
::
:: Check if the user has used the options utility and
:: if so, load their options.
::
if exist %ROSBEBASEDIR%\options.cmd (
goto :PREV
) else (
set logdiff=0
goto :NEXT
call %ROSBEBASEDIR%\options.cmd
)
:PREV
call %ROSBEBASEDIR%\options.cmd
if %_LOGDIR% == %ROSBE_LOGPATH% (
set logdiff=0
) else (
set logdiff=1
)
:NEXT
title ReactOS Build Environment %_VER%
::
:: Make sure RosBE was initialized right.
::
if "%1" == "" (
cls
set HOST_CFLAGS=-I"%ROSBE_MINGWPATH%\include" -I"%ROSBE_MINGWPATH%\lib\gcc\mingw32\4.1.3\include"
set HOST_CPPFLAGS=-I"%ROSBE_MINGWPATH%\include" -I"%ROSBE_MINGWPATH%\include\c++\4.1.3" -I"%ROSBE_MINGWPATH%\include\c++\4.1.3\mingw32" -I"%ROSBE_MINGWPATH%\lib\gcc\mingw32\4.1.3\include"
call :RosBE4
goto :EndCommandParse
)
if "%1" == "oldmode" (
cls
set C_INCLUDE_PATH=%ROSBE_MINGWPATH%\include;%ROSBE_MINGWPATH%\lib\gcc\mingw32\4.1.3\include
set CPLUS_INCLUDE_PATH=%ROSBE_MINGWPATH%\include;%ROSBE_MINGWPATH%\include\c++\4.1.3;%ROSBE_MINGWPATH%\include\c++\4.1.3\mingw32;%ROSBE_MINGWPATH%\lib\gcc\mingw32\4.1.3\include
call :RosBE4
goto :EndCommandParse
) else (
)
if not "%1" == "" (
cls
echo Unknown parameter specified. Exiting.
goto :ExitRosBE
@ -93,25 +79,25 @@ echo For a list of all included commands, type: "help"
echo -------------------------------------------------
::
:: Load the macros that serve as our commands and set new Source
:: Directory / Default Source Directory.
:: Load the doskey macros that serve as our commands.
::
doskey /macrofile="%ROSBEBASEDIR%\RosBE.mac"
if "%scut%" == "Default" (
set _ROSSOURCEDIR=%_ROSSOURCEDIRBASE%
) else (
::
:: Set new source directory, if needed.
::
if not "%scut%" == "Default" (
call %ROSBEBASEDIR%\scut %scut%
)
::
:: Look if the Source Folder is empty. If so, ask for using "svn create".
::
dir /b "%_ROSSOURCEDIR%" 2>nul|findstr "." >nul
if errorlevel 1 (
echo No ReactOS Source detected. Please use "ssvn create" to download it.
goto :ExitRosBE
) else (
goto :ExitRosBE
)
goto :ExitRosBE
::
@ -125,6 +111,8 @@ goto :ExitRosBE
set PATH=%ROSBE_MINGWPATH%\bin;%ROSBE_MINGWPATH%\libexec\gcc\mingw32\4.1.3;%PATH%
set _MINGWMAKE=%ROSBE_MINGWPATH%\bin\mingw32-make.exe
set _MINGWVERSION=4.1.3
set HOST_CFLAGS=-I"%ROSBE_MINGWPATH%\include" -I"%ROSBE_MINGWPATH%\lib\gcc\mingw32\4.1.3\include"
set HOST_CPPFLAGS=-I"%ROSBE_MINGWPATH%\include" -I"%ROSBE_MINGWPATH%\include\c++\4.1.3" -I"%ROSBE_MINGWPATH%\include\c++\4.1.3\mingw32" -I"%ROSBE_MINGWPATH%\lib\gcc\mingw32\4.1.3\include"
set LIBRARY_PATH=%ROSBE_MINGWPATH%\lib;%ROSBE_MINGWPATH%\lib\gcc\mingw32\4.1.3
echo *******************************************************************************

View File

@ -1,9 +1,9 @@
BASEDIR = cd /d "%_ROSSOURCEDIR%"
CLEAN = "%ROSBEBASEDIR%\Clean.cmd" $*
SSVN = "%ROSBEBASEDIR%\sSVN.cmd" $*
CONFIG = "%ROSBEBASEDIR%\Config.cmd" $*
HELP = "%ROSBEBASEDIR%\Help.cmd" $*
MAKE = "%ROSBEBASEDIR%\Build.cmd" $*
MAKEX = "%ROSBEBASEDIR%\Build-Multi.cmd" $*
RADDR2LINE = "%ROSBEBASEDIR%\reladdr2line.cmd" $*
SCUT = "%ROSBEBASEDIR%\scut.cmd" $*
CLEAN = "%ROSBEBASEDIR%Clean.cmd" $*
CONFIG = "%ROSBEBASEDIR%Config.cmd" $*
HELP = "%ROSBEBASEDIR%Help.cmd" $*
MAKE = "%ROSBEBASEDIR%Build.cmd" $*
MAKEX = "%ROSBEBASEDIR%Build.cmd" multi $*
RADDR2LINE = "%ROSBEBASEDIR%reladdr2line.cmd" $*
SCUT = "%ROSBEBASEDIR%scut.cmd" $*
SSVN = "%ROSBEBASEDIR%sSVN.cmd" $*