problem uploading with Makefile (avrdude)

Hi all,

I'm having trouble uploading code to the Arduino Mega 2560 without using the IDE. It works fine with the IDE (although I had to set the correct permissions on /dev/ttyACM0 to get it to work. With the Makefile that calls avrdude, I get an out of sync message. There's no communication between my laptop and the Arduino for some reason.

I'm typing this on my phone, so let me refer you for to this stackoverflow post for details:

As mentioned there, I suppose avrdude receives the wrong parameters. Doea anyone know how to get this to work?

Cheers,
Joren

Edit: I'm on Debian (Jessie)

the Arduino MEGA (atmega2560) uses a different bootloader than the Uno, and needs a different programmer type. Change "arduino" to "wiring" (or "stk500v2")