> (at a little backend complexity cost: now you've got the Arduino IDE around, hope it doesn't break!)
Doesn't really matter if it does break; just use gcc and a Makefile like you would for any other firmware.
You probably want to replace the Arduino libraries with your own ones eventually anyway, because there's so much cruft in there that you're never going to use.