I realize this might not be a typical RPi question.
However, I have a RPi with a Gertduino plugged into the GPIO headers.
I can use the wrapper program_328 for avrdude to upload a precompiled blink.hex file. OR use the arduino program (with X11 forwarded to my local machine) and upload the sketch with the "Upload sketch with programmer"
However, how can I write raw "sketch"/C code, and then compile it to the proper hex file and use the wrapper program_328 to upload the hex code to the Gertduino without using the arduino program?