Arduino GUI Works but not Command Line

The makefile in the hardware core directory can be used to build the sketches... simply copy the makefile to your sketch directory and call "make" on your shell... but the makefile does something different than the UI... for the UI you should have a look here:
http://code.google.com/p/arduino/source/browse/tags/0015/app/AvrdudeUploader.java

I am not sure about the status of the makefile, some bugfixes were added with the 0015 release I guess. But since I don't use 0015 I can't really say something about the makefile. Oh and when I write makefile I mean this one:
http://code.google.com/p/arduino/source/browse/tags/0015/hardware/cores/arduino/Makefile