@echo off
rem ***** This batch file will compile and link
rem ***** a C source file.  Do not provide the extension (.C)
rem ***** of the file on the argument.
rem ***** This batch file also assumes you to be in a
rem ***** directory across from the LIB286 directory and you
rem ***** have the following environment variable set.
rem ***** This can be put in your autoexec.bat file.

rem ***** SET LIB=\FOXLCK\LIB286

if x%include% == x goto noinclude
if x%LIB%==x goto nolib

rem ***** Compile the source file **********
wcc /oalsf /s /ml /zu /fpc %1

REM ***** If there was an error, skip the link and just quit ********
if errorlevel == 1 goto done
wlink file ..\LIB286\api_l,%1 lib proapi_l,clibl,mathl name a.plb

if errorlevel == 1 goto done
if exist %1.plb del %1.plb
rename a.plb %1.plb
goto done

:nolib
echo
echo You must have the environment variable LIB set.
echo
echo Please enter the following line at the DOS prompt or
echo place it in your autoexec.bat file and reboot. Where
echo \{LCK directory} is the path to your Library Construction
echo Kit directory.
echo
echo SET LIB=\{LCK directory}\LIB286
echo
echo
goto moreinfo
:noinclude
echo
echo You must have the environment variable INCLUDE set.
echo
echo Please enter the following line at the DOS prompt or
echo place it in your autoexec.bat file and reboot. Where
echo \{LCK directory} is the path to your Library Construction
echo Kit directory.
echo
echo SET INCLUDE=\{LCK directory}\H
echo
echo
:moreinfo
echo For more information on the WATCOM Environment variables,
echo please see pages 6 and 7 of the WATCOM C Optimizing
echo Compiler and Tools User's Guide.
echo
echo
echo
:done
