wow
This commit is contained in:
parent
1a6bfc0925
commit
303192b198
9 changed files with 1154 additions and 34 deletions
|
|
@ -1,21 +1,28 @@
|
|||
@echo off
|
||||
rem 환경 변경이 이 스크립트 실행 안에만 머물도록 합니다.
|
||||
setlocal
|
||||
|
||||
rem Makefile과 POSIX 스크립트처럼 실행 파일을 build\에 둡니다.
|
||||
if not exist build mkdir build
|
||||
|
||||
rem Visual Studio 컴파일러가 있으면 우선 사용합니다.
|
||||
where cl >nul 2>nul
|
||||
if %errorlevel% equ 0 goto build_msvc
|
||||
|
||||
rem GCC가 설치되어 있고 PATH에서 보이면 다음 후보로 사용합니다.
|
||||
where gcc >nul 2>nul
|
||||
if %errorlevel% equ 0 goto build_gcc
|
||||
|
||||
rem 세 번째 지원 Windows 컴파일러로 Clang을 사용합니다.
|
||||
where clang >nul 2>nul
|
||||
if %errorlevel% equ 0 goto build_clang
|
||||
|
||||
rem 지원되는 컴파일러를 찾지 못했으므로 명확한 메시지를 출력하고 중단합니다.
|
||||
echo C compiler not found. Install Visual Studio Build Tools, GCC, or Clang.
|
||||
exit /b 1
|
||||
|
||||
:build_msvc
|
||||
rem MSVC는 build\ 안에 gerbera.exe를 쓰고 bcrypt.lib를 명시적으로 링크합니다.
|
||||
pushd build
|
||||
cl /nologo /std:c11 /O2 /W4 /I..\include ^
|
||||
..\src\main.c ..\src\encrypt.c ..\src\decrypt.c ..\src\cipher.c ^
|
||||
|
|
@ -26,6 +33,7 @@ if not %result% equ 0 exit /b %result%
|
|||
goto success
|
||||
|
||||
:build_gcc
|
||||
rem GCC는 POSIX 빌드와 같은 경고 옵션을 쓰고 bcrypt를 링크합니다.
|
||||
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
|
||||
|
|
@ -33,11 +41,13 @@ if not %errorlevel% equ 0 exit /b %errorlevel%
|
|||
goto success
|
||||
|
||||
:build_clang
|
||||
rem Clang은 이 작은 프로젝트에서 GCC 방식 명령줄을 그대로 따릅니다.
|
||||
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
|
||||
rem 모든 컴파일러 선택지가 공유하는 성공 경로입니다.
|
||||
echo Build complete: build\gerbera.exe
|
||||
exit /b 0
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 실패한 명령이나 정의되지 않은 변수에서 즉시 종료합니다.
|
||||
set -eu
|
||||
|
||||
# 호출자가 CC=...로 컴파일러를 고를 수 있고, 기본값은 cc입니다.
|
||||
compiler="${CC:-cc}"
|
||||
|
||||
# 컴파일 산출물은 소스 트리 밖의 build/에 둡니다.
|
||||
mkdir -p build
|
||||
|
||||
# 모든 C 번역 단위를 묶어 Gerbera 명령 하나를 빌드합니다.
|
||||
"$compiler" \
|
||||
-Iinclude \
|
||||
-std=c11 \
|
||||
|
|
@ -17,4 +23,5 @@ mkdir -p build
|
|||
src/cipher.c \
|
||||
-o build/gerbera
|
||||
|
||||
# 실행 파일이 어디에 만들어졌는지 알려 줍니다.
|
||||
echo "Build complete: build/gerbera"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue