@echo off

set BIT=64
if "%1" == "32" set BIT=32

set BASH=C:\msys64\usr\bin\bash.exe
::msys2_shell.cmd
set VCVARSALL=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars%BIT%.bat

if not exist "%BASH%" (
	echo "ERROR Bash not found: %BASH%"
	goto :eof
)

if not exist "%VCVARSALL%" (
	echo "ERROR Vcvars64.bat not found: %VCVARSALL%"
	goto :eof
)

pushd .
call "%VCVARSALL%"
popd

echo on
"%BASH%" -c "export PATH=\"/usr/local/bin:/usr/bin:/bin:/opt/bin:$PATH\"; mkdir -p build%BIT% && cd build%BIT% && ../mk %*"
