OpenOCD Makefile Automation

I haven’t tried much with OpenOCD so far and would like to integrate flash programming into the Makefile. Calling

make burn

should compile and link the code and flash the binary in the target’s program memory in one go. With interest, I read Martin’s excellent and helpful

http://www.siwawi.arubi.uni-kl.de/avr_p … index.html

but this is based on a DOS Batch, which I want to avoid. The solution should be as platform independent as possible, portable C/C++ is fine though. My idea is to write a small tool, which feeds an OpenOCD script to the telnet interface at port 4444. I observed, that OpenOCD is not always responding with a prompt, but that should provide no real problem.

Does such a tool already exist (at least for Win32, Linux and OS X)?

Is there any simpler way to add flashing via OpenOCD to a Makefile?

Many thanks,

Harald