@echo off
REM --------------------------------------------------------------------
REM This nifty batch script will compile one tool which is specified
REM on the commandline
REM
REM for example if we want to build ttpack we will call this tool:
REM buildone.bat ttpack
REM
REM if upx is found in the path it will pack the executables otherwise
REM they stay in their original form
REM
REM at the end of the batch script the final executable is moved into
REM the calctools bin directory
REM
REM $Id: buildone.bat,v 1.4 2001/07/31 22:57:46 Thomas Nussbaumer Exp $
REM --------------------------------------------------------------------
echo compiling %1 ...
lcc -O %1.c
@IF ERRORLEVEL 1 goto failed

echo linking %1 ...
lcclnk %1.obj
@IF ERRORLEVEL 1 goto failed
del %1.obj

start /min /wait upx -9 %1.exe > nul
@IF ERRORLEVEL 1 goto skipped
goto notskipped

:skipped
echo compression skipped

:notskipped
echo moving executable ...
copy %1.exe ..\..\bin > nul
del %1.exe
goto end

:failed
pause
goto end

:end