SDK/Tools/build.bat

36 lines
743 B
Batchfile
Raw Normal View History

2020-05-22 00:15:03 +02:00
@echo off
set Source=%1
2020-06-28 21:07:46 +02:00
if #%Source%#==## (
2020-05-22 00:15:03 +02:00
echo Usage: %~n0 [source-file]
goto exit
)
2020-05-23 15:55:40 +02:00
set Bin=%~dp0..\Bin
set DCU=%~dp0..\Bin\DCU
set Options=-$C- -$I- -$T+
2020-05-22 00:15:03 +02:00
set Target=%Bin%\%~n1
2020-05-23 15:55:40 +02:00
set Units=%~dp0..\RTL;%~dp0..\Lib
2020-05-22 00:15:03 +02:00
if not exist "%Bin%" mkdir "%Bin%"
if not exist "%DCU%" mkdir "%DCU%"
2020-05-22 00:15:03 +02:00
if exist "%Source%.cfg" del "%Source%.cfg"
if not exist "%~dp0..\RTL\SysInit.dcu" call "%~dp0..\build-RTL.bat"
if errorlevel 1 goto exit
if not exist "%Bin%\convert.bat" (
2020-06-28 21:07:46 +02:00
echo @call "%%~dp0..\Tools\convert.bat" %%* >"%Bin%\convert.bat"
if errorlevel 1 goto exit
)
2020-06-28 21:07:46 +02:00
dcc32 %Source%.dpr -e"%Bin%" -n"%DCU%" -u"%Units%" %Options%
2020-05-22 00:15:03 +02:00
if errorlevel 1 goto exit
call "%~dp0convert.bat" "%Target%.exe"
2020-05-22 00:15:03 +02:00
if errorlevel 1 goto exit
del "%Target%.exe"
:exit