@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 **********
tasm.exe /i..\H\  %1

REM ***** If there was an error, skip the link and just quit ********
if errorlevel == 1 goto done
rem wlink file d:\foxlck\lib286\api_l,%1 lib proapi_l,clibl,mathl name a.plb
wlink FORMAT DOS NAME a.PLB OPTION MAP=%1.WAT OPTION STACK=2K FILE ..\lib286\API_L,%1 LIB PROAPI_L,CLIBL

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
