@echo off

setlocal

set LOG_FILE=%cd%\samirai-graph.log

rem set directory

set CURRENT_PATH=%cd%\
set SCRIPT_PATH=%~d0%~p0
set CONTRIB_PATH=%SCRIPT_PATH%

rem set absolute directory

cd /d %SCRIPT_PATH%
set SCRIPT_PATH=%cd%\
cd /d %CONTRIB_PATH%
set CONTRIB_PATH=%cd%\
cd /d %CURRENT_PATH%

goto check_arguments

rem build functions

:build_contrib
set errcode=0
cd /d "%SCRIPT_PATH%"
call vectorgraphics\build.bat build
call foxtrot\build\build.bat build
cd /d "%CURRENT_PATH%"
goto %RETURN_LABEL%

:rebuild_contrib
set errcode=0
cd /d "%SCRIPT_PATH%"
call vectorgraphics\build.bat rebuild
call foxtrot\build\build.bat rebuild
cd /d "%CURRENT_PATH%"
goto %RETURN_LABEL%

:clean_contrib
set errcode=0
cd /d "%SCRIPT_PATH%"
call vectorgraphics\build.bat clean
call foxtrot\build\build.bat clean
cd /d "%CURRENT_PATH%"
goto %RETURN_LABEL%

:check_arguments
if "%1" == "" goto print_usage
if "%1" == "build" goto do_build
if "%1" == "rebuild" goto do_rebuild
if "%1" == "clean" goto do_clean

:print_usage
echo Usage: %0 { build, rebuild, clean }
goto finised

:do_build
set RETURN_LABEL=finised
goto build_contrib

:do_rebuild
set RETURN_LABEL=finised
goto rebuild_contrib

:do_clean
set RETURN_LABEL=finised
goto clean_contrib

:finised

endlocal
