ECHO off
echo.
echo -------------------------------------------------------------------
echo      winaping.exe build file
echo -------------------------------------------------------------------
echo.

set _include=%include%
set include=%include%;%emul_incl%

REM ----- 12/11/96 ----- changes for 4.2 -----

if (%build_opt%) == () goto ERROR2

set maknam=piaping
set target=winaping
set ext=exe
set my_path=%pi_root%\apps\winaping
set my_log=%pi_log_nt%\%target%.log
REM ----- per Deuce, send log to pi_log_nt

del %my_log%
cd  %my_path%

REM ----- check source -----
IF NOT EXIST %my_path%\%maknam%.mak  GOTO ERROR1

echo
echo ------ copy include files ---------
copy %pi_incl_32%\wincpic.h

echo ------ copy lib files ---------
copy %pi_lib_32%\wcpic32.lib

IF %pi_build% == debug    GOTO DBG
IF %pi_build% == release  GOTO REL

GOTO ERROR2

:DBG
   ECHO --- building %target%.%ext% (%pi_build% %build_opt%)... ---
   if (%build_opt%) == (clean) del windebug\*.obj
   echo nmake -f %maknam%.mak CFG="winaping - Win32 Debug"
   nmake -f %maknam%.mak CFG="winaping - Win32 Debug" > %my_log%
   copy windebug\%target%.%ext% %pi_dbg_32%
   del  windebug\%target%.pch
   show_ver windebug\%target%.%ext% >> %my_log%
   GOTO DONE

:REL
   ECHO building %target%.%ext% (%pi_build% %build_opt%) ...
   if (%build_opt%) == (clean) del winrel\*.obj
   IF NOT EXIST winrel\%target%.%ext% mkdir winrel
   echo nmake -f %maknam%.mak CFG="winaping - Win32 Release"
   nmake -f %maknam%.mak CFG="winaping - Win32 Release" > %my_log%
   copy winrel\%target%.%ext% %pi_rel_32%
   del  winrel\%target%.pch
   show_ver winrel\%target%.%ext% >> %my_log%
   GOTO DONE

:ERROR1
   ECHO winaping.bat: %maknam%.mak does not exist >> %my_log%
   ECHO winaping.bat: %maknam%.mak does not exist
   GOTO DONE

:ERROR2
   ECHO winaping.bat: Incorrect build_opt or pi_build passed >> %my_log%
   ECHO winaping.bat: Incorrect build_opt or pi_build passed
   GOTO DONE

:DONE
set include=%_include%
set _include=

echo.
echo ---- remove header and lib files -------
del wincpic.h
del wcpic32.lib
cd ..
:END
