Often, the Arduino IDE is expecting to be programming for a certain device, but your device is different. I don't have it open right now, but somewhere in your menu options should be a "Device" tab. It will have a list of Arduino devices. You need to choose whichever Arduino device uses the ATMega644P...and at the moment I don't know which one that is.
What I think is happening is that the Arduino IDE is expecting, say, a ATMega168, and it's getting a 644, and it's saying "Whoa! I'm programming the wrong chip!"
There are some workarounds if a '644P based device doesn't exist:
1) Ignore the flag, using the -f option. This is...probably not a good idea, since it will be setting registers and the like and these may not be the same for the 644.
2) Get an ISP programmer. They're like $30. You can still program with the Arduino IDE, but you just tell it to program using the ISP instead of USB. It's easier to tell the ISP what device you're using.
3) Work with AVRStudio. Unfortunately, this is only a Windows thing, which can be irritating if you're using Linux. But AVRStudio is about a thousand times better than Arduino IDE if you're not programming an Arduino :-)
MIKE