Encountered lousy boo-boo in arduino IDE generated compilation commands

You could try using the mpide GUI to build the AVR sketches rather than the Arduino IDE.
mpide has additional capabilities in the boards.txt file
and introduces a platforms.txt which allows you to set custom defines and compiler
options on a per platform (AVR, pic32 etc..) or per board level within the platform.

There are also some decent makefiles out there for Arduino these days so you can bypass the IDE
completely.

--- bill