Creating a sketch (.HEX) file from a .PDE file
At a project i'm working on we use the basic Makefile delivered by arduino and made some tweaks in it. You would need https://github.com/zarya/OpenCTRL/blob/master/src/c/Arduino.mk and https://github.com/zarya/OpenCTRL/blob/master/src/c/Makefile.sample rename the Makefile.sample to Makefile and you want to change the settings there. You might also want to remove the # at line 272 and place a one at the start of line 273 of Arduino.mk we use this make file on Debian and Ubuntu, hope it's also compatible with other distributions / windows?

The only downside, currently we can only include one external library in our projects. I'll probably fix this problem in the feature although we actually don't need more then one library at the moment :)