@echo off

if not defined SINDEVBASE ( goto failedsindevbase )
if not defined SEVENZIPPATH ( goto failed7zpath )

:startbuild
call setenv.bat
call makeallDXE.bat %1 %2 %3 %4 %5 %6 %7 %8 %9

cd /D "%SINDEVBASE%"
del SIN_MSDOS_LATEST.7Z
rd /s /q release

md release
cd release
md base
md ctf
md 2015
cd ..

copy sin.exe release
copy ref_soft\ref_soft.dxe release
copy ref_gl\ref_gl.dxe release
copy dos\CWSDPMI.EXE release
copy readme.txt release
copy readme.fx release
copy status-djgpp.txt release
copy game\gamex86.dxe release\base
copy game\gamex86.dxe release\ctf
copy 2015\gamex86.dxe release\2015
xcopy dos\3rdparty\lib_dxe release /E

REM copy a default gl.dxe
copy dos\3rdparty\lib_dxe\opengl\fxmesa\gl.dxe release

"%SEVENZIPPATH%\7z.exe" a -mx9 -mmt "%SINDEVBASE%\SIN_MSDOS_LATEST.7Z" "%SINDEVBASE%\RELEASE\*"

cd /D "%SINDEVBASE%"
rd /s /q "%SINDEVBASE%\release"

goto end

:failedsindevbase
echo SINDEVBASE not defined!
pause
goto end

:failed7zpath
echo SEVENZIPPATH not defined!
pause
goto end

:end
