BCB6 Post Build

846 views Asked by At

I am using Borland C++ Builder version 6 and would like to add some method of invoking a batch file after a project build has been performed. There is no direct support in the IDE to do this but I have read that it is possible to modify project makefiles to perform such actions. After much digging around on the internet and experimentation i have still not managed to do get this to work.

The batch file in this case will simply invoke an exe file but may also be required to copy certain build outputs files to system directories for example.

If it makes any difference I am running BCB6 on a Windows 7 x64 laptop.

Regards FarmerJo

1

There are 1 answers

0
manlio On

You can run the bpr2mak.exe utility, passing your project *.bpr

bpr2mak.exe Project.bpr

Now you have a Project.mak file and running make.exe:

make.exe -f Project.mak

you'll build the Project.

Don't change make -f Project.mak with make Project.mak or make will try to build target Project.mak of Makefile (you can rename Project.mak in Makefile and simply call make, if you prefer).

Assembling everything in a batch file:

build.bat

@echo off
bpr2mak Project.bpr || goto :error
make -f Project.mak || goto :error
yourCommand_1.exe || goto :error
...
yourCommand_n.exe || goto :error
goto :EOF

:error
echo Failed - error #%errorlevel%.
pause
exit /b %errorlevel%

Of course you can add your additional commands under the appropriate target of the Makefile, but this way you'll have to manually edit the file after every execution of bpr2mak.