@echo off
@rem postbuild.cmd should be called as follows in Delphi postbuild events:
@rem call ..\buildtools\postbuild.cmd $(OUTPUTDIR)$(OUTPUTNAME)
@rem optionally you can add NoTranslation (case sensitive!!!) to prevent assemble to be called

@echo * %0
@echo * Params: %*
@echo * running in %CD%

@rem needs one parameter: The basename of the executable file (without .exe)
set EXEFILEBASE=%~dpn1
if "%EXEFILEBASE%"=="" goto NeedPara
set TRANSLATIONPARAM=%2

set OUTPUTDIR=%~dp1

pushd %OUTPUTDIR%

if not exist %~dp0\AppendJclDebug.cmd goto NoDebug
  echo appending JclDebug information
  call %~dp0\AppendJclDebug.cmd %EXEFILEBASE%
  goto afterdebug
:NoDebug
echo no jcldebug information appended
:afterdebug

if "%2"=="NoTranslation" goto NoTrans
if not exist %~dp0\AppendTranslations.cmd goto NoTrans
  echo appending translations
  call %~dp0\AppendTranslations.cmd %EXEFILEBASE% %TRANSLATIONPARAM%
  goto aftertrans
:NoTrans
echo no translations appended
:aftertrans

popd

echo %0 exiting
goto :EOF

:NeedPara
echo needs the base filename of the executable as parameter
