Gerbera/scripts/build.bat
2026-06-23 09:56:21 +09:00

43 lines
1 KiB
Batchfile

@echo off
setlocal
if not exist build mkdir build
where cl >nul 2>nul
if %errorlevel% equ 0 goto build_msvc
where gcc >nul 2>nul
if %errorlevel% equ 0 goto build_gcc
where clang >nul 2>nul
if %errorlevel% equ 0 goto build_clang
echo C compiler not found. Install Visual Studio Build Tools, GCC, or Clang.
exit /b 1
:build_msvc
pushd build
cl /nologo /std:c11 /O2 /W4 /I..\include ^
..\src\main.c ..\src\encrypt.c ..\src\decrypt.c ..\src\cipher.c ^
/Fe:gerbera.exe bcrypt.lib
set "result=%errorlevel%"
popd
if not %result% equ 0 exit /b %result%
goto success
:build_gcc
gcc -Iinclude -std=c11 -O2 -Wall -Wextra -Wpedantic ^
src\main.c src\encrypt.c src\decrypt.c src\cipher.c ^
-o build\gerbera.exe -lbcrypt
if not %errorlevel% equ 0 exit /b %errorlevel%
goto success
:build_clang
clang -Iinclude -std=c11 -O2 -Wall -Wextra -Wpedantic ^
src\main.c src\encrypt.c src\decrypt.c src\cipher.c ^
-o build\gerbera.exe -lbcrypt
if not %errorlevel% equ 0 exit /b %errorlevel%
:success
echo Build complete: build\gerbera.exe
exit /b 0