@echo off

rem ******************************************************************
rem * This is a wrapper for buildall.cmd
rem * It's used to make the inbuild distribution of the driver
rem * The NTD*** environment vars are set per MS for inbuild drivers
rem ******************************************************************

if "%1"=="" goto Usage
if NOT "%2"=="" goto Usage

if "%DDKBUILDENV%"==""          goto ExitNotBuildWindow
if "%DDKBUILDENV%"=="checked"   goto BuildChecked
if "%DDKBUILDENV%"=="chk"       goto BuildChecked
if "%DDKBUILDENV%"=="free"      goto BuildFree
if "%DDKBUILDENV%"=="fre"       goto BuildFree
goto ExitNotBuildWindow

:BuildChecked
echo Generating checked build for In Build Project
set USE_PDB=1
set NTDEBUG=ntsd
set NTDBGFILES=
set NTDEBUGTYPE=windbg
set BINPLACE_FLAGS=
goto BuildIt

:BuildFree
echo Generating retail build for In Build Project
set USE_PDB=1
set NTDEBUG=ntsdnodbg
set NTDBGFILES=
set NTDEBUGTYPE=windbg
set BINPLACE_FLAGS=
goto BuildIt

:BuildIt
call buildall.cmd %1
if ERRORLEVEL 1 goto MakeReleaseError
goto Done

:MakeReleaseError
echo *****************************
echo *!     Buildall Error      !*
echo *****************************
goto QuietExit

:ExitNotBuildWindow
echo *****************************
echo *! Corrupted build window  !*
echo *****************************
goto QuietExit

:Usage
echo Usage:
echo   inbuildall ^</c rebuild all^>
goto QuietExit

:Done
echo *************************************************************
echo * Use CopyRelease with InBuild.lst to copy the distribution *
echo *************************************************************

:QuietExit
