@echo off
echo --- Compiling OS/2 Import library
cd \master\lib.os2\defs

echo   - Compiling MsgSeg32
..\..\bin.w32\vpc msgseg32.pas /O. /U..\..\units.os2 > %ErrorLog% 2>&1
if errorlevel 1 goto error

echo   - Implib'ing
..\..\bin.w32\implib ..\os2.lib @os2.rsp > %ErrorLog% 2>&1
if errorlevel 1 goto error
                   
echo   - Linking os2.lib and msgseg32                   
..\..\bin.w32\lib ..\os2.lib +msgseg32 > %ErrorLog% 2>&1
if errorlevel 1 goto error
                                     
echo   - Deleting temporary files                                     
del msgseg32.vpi 1>nul 2>&1
del msgseg32.obj 1>nul 2>&1
del ..\os2.bak 1>nul 2>&1

goto done

:error
echo !!! An error occurren in the build process !!!
echo !!! Processing file: %0
echo !!! Press ENTER to see details             !!!
pause                                              
type %errorlog% | more
pause

:Done

