But you need to use their (terrible) IDE for writing your sketches this way.
You can also use avr dude; there's a sample makefile available here: http://playground.arduino.cc/Learning/CommandLine#.UzQ_ca1kF...