mirror of
https://github.com/p2r3/bareiron.git
synced 2025-10-01 23:25:09 +02:00
fix path handling in build.bat
This commit is contained in:
24
build.bat
24
build.bat
@@ -1,28 +1,32 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
if not exist "%~dp0src\registries.h" (
|
||||
|
||||
if not exist "include\registries.h" (
|
||||
echo Error: 'include/registries.h' is missing.
|
||||
echo Please follow the 'Compilation' section of the README to generate it.
|
||||
pause
|
||||
exit /b 1
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set "files="
|
||||
for /f "delims=" %%f in ('dir /b "%~dp0src\*.c" 2^>nul') do (
|
||||
set "files=!files! "%~dp0src%%f""
|
||||
for %%f in (src\*.c) do (
|
||||
set "files=!files! %%f"
|
||||
)
|
||||
|
||||
if "%files%"=="" (
|
||||
echo No C source files found in "%~dp0src".
|
||||
echo Add .c files to the src folder and try again.
|
||||
pause
|
||||
echo No C source files found in "src".
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
if exist "%~dp0bareiron.exe" del /q "%~dp0bareiron.exe"
|
||||
gcc %files% -o "%~dp0bareiron.exe"
|
||||
|
||||
if exist "bareiron.exe" del /q "bareiron.exe"
|
||||
|
||||
gcc src\*.c -O3 -Iinclude -o bareiron.exe
|
||||
if errorlevel 1 (
|
||||
echo Build failed.
|
||||
pause
|
||||
exit /b 1
|
||||
) else (
|
||||
echo Build succeeded: "%~dp0bareiron.exe"
|
||||
echo Build succeeded: "bareiron.exe"
|
||||
pause
|
||||
)
|
Reference in New Issue
Block a user