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

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

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

copy ..\..\D2006Win\Rave70VCL100.bpl %NDWINSYS% >nul

REM ***************************************************
REM Compile Misc Units
REM ***************************************************
%NDC10%\bin\dcc32.exe ..\Win\RpTChart.pas -M -H -W -Q -JPHNE -N..\..\D2006Win -LE..\..\D2006Win -LN..\..\D2006Win -U..\..\D2006Win -DBCB -$D-,L- -V- %1 %2 %3
if errorlevel 1 goto enderror
%NDC10%\bin\dcc32.exe ..\Win\RvDLBDE.pas -M -H -W -Q -JPHNE -N..\..\D2006Win -LE..\..\D2006Win -LN..\..\D2006Win -U..\Win -I..\Win -DBCB -$D-,L- -V- %1 %2 %3
if errorlevel 1 goto enderror
%NDC10%\bin\dcc32.exe ..\Win\RvDLADO.pas -M -H -W -Q -JPHNE -N..\..\D2006Win -LE..\..\D2006Win -LN..\..\D2006Win -U..\Win -I..\Win -DBCB -$D-,L- -V- %1 %2 %3
if errorlevel 1 goto enderror
%NDC10%\bin\dcc32.exe ..\Win\RvDLDBX.pas -M -H -W -Q -JPHNE -N..\..\D2006Win -LE..\..\D2006Win -LN..\..\D2006Win -U..\Win -I..\Win -DBCB -$D-,L- -V- %1 %2 %3
if errorlevel 1 goto enderror
%NDC10%\bin\dcc32.exe ..\Win\RvDLInterbase.pas -M -H -W -Q -JPHNE -N..\..\D2006Win -LE..\..\D2006Win -LN..\..\D2006Win -U..\Win -I..\Win -$D-,L- -V- %1 %2 %3
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 ..\..\D2006Win >nul
copy ..\Win\*.hpp ..\..\D2006Win >nul
copy *.hpp ..\..\D2006Win >nul
copy ..\Win\RpForm*.dfm ..\..\D2006Win >nul
copy Rave70VCL.bpi ..\..\D2006Win >nul
copy Rave70VCL100.lsp ..\..\D2006Win >nul

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

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

REM ***************************************************
REM Clean-up
REM ***************************************************
del ..\..\D2006Win\dclRave.dcu
del ..\..\D2006Win\dclRave.dcp
del ..\..\D2006Win\Rave70VCL100.bpl
del ..\..\D2006Win\RPExeFrm.dcu
del ..\..\D2006Win\RaveReg.dcu

del ..\Win\*.obj
del ..\Win\*.hpp
del *.obj
del *.hpp
del Rave70VCL.lsp

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