@echo off
if exist setenv.bat call setenv.bat
computil SetupD11
if exist setenv.bat call setenv.bat
call clean.bat
if not exist ..\..\D2007Win\*.* md ..\..\D2007Win >nul

REM ***************************************************
REM Compile Runtime Package Rave75VCL
REM ***************************************************
copy ..\Win\RpForm*.dfm ..\..\D2007Win >nul
rem %NDD11%\bin\dcc32.exe Rave75VCL.dpk -B -H -W -Q -JPHNE -N..\..\D2007Win -LE..\..\D2007Win -LN..\..\D2007Win -U..\Win -I..\Win -DBCB -$D-,L- -V- %1 %2 %3
rem if errorlevel 1 goto enderror
rem %NDD11%\bin\dcc32.exe Rave75VCL.dpk -M -H -W -LE..\..\D2007Win -LN..\..\D2007Win -N..\..\D2007Win -U..\Win -I..\Win -DBCB -$D-,L- -V- %1 %2 %3
rem if errorlevel 1 goto enderror

%NDD11%\bin\dcc32.exe Rave75VCL.dpk -B -H -W -Q -JL -LE..\..\D2007Win -LN..\..\D2007Win -N..\..\D2007Win -U..\Win -I..\Win -DBCB -$D-,L- -V- %1 %2 %3
if errorlevel 1 goto enderror

copy ..\..\D2007Win\Rave75VCL110.bpl %NDWINSYS% >nul

REM ***************************************************
REM Compile Misc Units
REM ***************************************************
%NDD11%\bin\dcc32.exe ..\Win\RpTChart.pas -M -H -W -Q -JPHNE -N..\..\D2007Win -LE..\..\D2007Win -LN..\..\D2007Win -U..\..\D2007Win -DBCB -$D-,L- -V- %1 %2 %3
if errorlevel 1 goto enderror
%NDD11%\bin\dcc32.exe ..\Win\RvDLBDE.pas -M -H -W -Q -JPHNE -N..\..\D2007Win -LE..\..\D2007Win -LN..\..\D2007Win -U..\Win -I..\Win -DBCB -$D-,L- -V- %1 %2 %3
if errorlevel 1 goto enderror
%NDD11%\bin\dcc32.exe ..\Win\RvDLADO.pas -M -H -W -Q -JPHNE -N..\..\D2007Win -LE..\..\D2007Win -LN..\..\D2007Win -U..\Win -I..\Win -DBCB -$D-,L- -V- %1 %2 %3
if errorlevel 1 goto enderror
%NDD11%\bin\dcc32.exe ..\Win\RvDLDBX.pas -M -H -W -Q -JPHNE -N..\..\D2007Win -LE..\..\D2007Win -LN..\..\D2007Win -U..\Win -I..\Win -DBCB -$D-,L- -V- %1 %2 %3
if errorlevel 1 goto enderror
rem %NDD11%\bin\dcc32.exe ..\Win\RvDLInterbase.pas -M -H -W -Q -JPHNE -N..\..\D2007Win -LE..\..\D2007Win -LN..\..\D2007Win -U..\Win -I..\Win -$D-,L- -V- %1 %2 %3
rem if errorlevel 1 goto enderror

REM ***************************************************
REM Copy Files
REM ***************************************************
REM Fix Borland HPP Header Creation Bug
rem computil HppModify ..\Win\
computil HppModify .\
rem copy ..\Win\*.obj ..\..\D2007Win >nul
copy ..\Win\*.hpp ..\..\D2007Win >nul
copy *.hpp ..\..\D2007Win >nul
copy ..\Win\RpForm*.dfm ..\..\D2007Win >nul
copy Rave75VCL.bpi ..\..\D2007Win >nul
copy Rave75VCL110.lsp ..\..\D2007Win >nul

REM ***************************************************
REM Create .LIB file for VCL
REM ***************************************************
echo Creating Rave75VCL.LIB file, please wait...
rem if exist ..\..\D2007Win\Rave75VCL.lib del ..\..\D2007Win\Rave75VCL.lib >nul
copy Rave75VCL.lib ..\..\D2007Win
for %%9 in (..\Win\R*.obj) do %NDD11%\bin\tlib.exe ..\..\D2007Win\Rave75VCL.lib /P32 +%%9 >nul
del ..\..\D2007Win\Rave75VCL.bak >nul
rem %NDD11%\bin\tlib.exe ..\..\D2007Win\Rave75VCL.lib @..\..\D2007Win\Rave75VCL.lsp /P32

REM ***************************************************
REM Compile Design-time Package dclRave
REM ***************************************************
%NDD11%\bin\dcc32.exe dclRave.dpk -B -H -W -Q -N..\..\D2007Win -LE..\..\D2007Win -LN..\..\D2007Win -L..\..\D2007Win\Rave75VCL110.dcp -I..\Win -U..\..\D2007Win;..\Win -DBCB -$D-,L- -V- %1 %2 %3
if errorlevel 1 goto enderror

REM ***************************************************
REM Clean-up
REM ***************************************************
del ..\..\D2007Win\dclRave.dcu
del ..\..\D2007Win\dclRave.dcp
del ..\..\D2007Win\Rave75VCL110.bpl
del ..\..\D2007Win\RPExeFrm.dcu
del ..\..\D2007Win\RaveReg.dcu

del ..\Win\*.obj
del ..\Win\*.hpp
rem del *.obj >nul
del *.hpp
rem del Rave75VCL.lsp >nul

echo.
echo SUCCESS: D11 Packages Compiled
echo.
goto endok
:enderror
call clean
echo.
echo FAILURE: D11 Packages NOT Compiled
echo.

pause
:endok