メモ。Sphinxのmake.batを参考にDelphi用で使ってるmake.batをいろいろ改良した。
@echo off rem Delphi Installation Path set DELPHI=C:\Program Files\CodeGear\RAD Studio\6.0 set PROJECT_NAME=Example rem custom environment if exist "buildenv.bat" call buildenv if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^<target^>` where ^<target^> is one of echo. debug to build with DEBUG symbol echo. release to build no symbol echo. test to build test project and run tests echo. runtest to run tests echo. guitest to build gui test tool and run tests goto end ) if "%1" == "debug" ( echo.== Debug Build == if exist "%PROJECT_NAME%.exe" ( echo.Deleting old file... del %PROJECT_NAME%.exe ) echo.Starting build... dcc32 -N0"" -B -D"DEBUG" %PROJECT_NAME%.dpr goto end ) if "%1" == "release" ( echo == Release Build == if exist "%PROJECT_NAME%.exe" ( echo.Deleting old file... del %PROJECT_NAME%.exe ) echo.Starting build... dcc32 -$D- -B %PROJECT_NAME%.dpr goto end ) if "%1" == "test" ( echo == Run Test == echo building tests... set PATH=%PATH%;%CD% cd %CD%\Tests if exist "%PROJECT_NAME%Test.exe" ( echo.Deleting old file... del %PROJECT_NAME%Test.exe ) echo.Starting build... dcc32 -B -D"CONSOLE_TESTRUNNER;DEBUG;TEST" -U"%DELPHI%\source\dUnit\src;" %PROJECT_NAME%Test.dpr echo; if exist %PROJECT_NAME%Test.exe goto runtest echo build failure! cd .. goto end ) if "%1" == "runtest" ( :runtest echo running tests... %PROJECT_NAME%Test.exe cd .. goto end ) if "%1" == "guitest" ( echo == Run GUI Test == echo building tests... set PATH=%PATH%;%CD% cd %CD%\Tests if exist "%PROJECT_NAME%Test.exe" ( echo.Deleting old file... del %PROJECT_NAME%Test.exe ) echo.Starting build... dcc32 -B -D"DEBUG;TEST" -U"%DELPHI%\source\dUnit\src" %PROJECT_NAME%Test.dpr echo; if exist %PROJECT_NAME%Test.exe goto runtest echo build failure! cd .. goto end ) :end