@echo off
call :fixcmdbug %*
goto :eof

:fixcmdbug
if "%~1"=="info" goto info
if "%~1"=="params" goto params
if "%~1"=="paramloop" goto paramloop
if "%~1"=="defines" goto defines
if "%~1"=="prebuild" goto prebuild
if "%~1"=="postbuild" goto postbuild
if "%~1"=="prerelease" goto prerelease
if "%~1"=="postrelease" goto postrelease
if "%~1"=="help" goto help
goto :eof

:info
set project=innounp
set project_title=InnoUnp mod
set project_url=http://www.pepak.net/
set releasedir=%~dp0..\
set exedir=%~dp0..\Bin\
set srcdir=%~dp0
set ext=.exe
set params=
set extralib=
set commit=1
set observer=0
exit /b 0
goto :eof

:help
echo    standalone ...... Build the standalone innounp.exe
echo    observer ........ Build the innounp.so module for Observer
goto :eof

:params
goto :eof

:paramloop
if /i "%~2"=="observer" set observer=1
if /i "%~2"=="standalone" set observer=0
goto :eof

:defines
set defs=%defs% -dIS_ALLOWD7
goto :eof

:prebuild
call "prep.bat"
if "%observer%"=="1" (
  set project=innounp_observer
  set project_title=InnoUnp for Observer
  set ext=.dll
)
if "%observer%"=="1" (
  if exist "%exedir%\%project%%ext%" del "%exedir%\%project%%ext%"
  if exist "%exedir%\innounp.so" del "%exedir%\innounp.so"
)
goto :eof

:postbuild
if "%observer%"=="1" (
  if exist "%exedir%\%project%%ext%" (
    ren "%exedir%\%project%%ext%" "innounp.so"
  )
)
goto :eof

:prerelease
goto :eof

:postrelease
goto :eof
