Changing default compiler flags

Is there an easy way to modify the compiler flags used to build a sketch?

As far as I see -Wall is not turned on at all and -Os is the default optimization level. How could I change these with Arduino IDE 1.5.8?

Look for a file platform.txt

http://forum.arduino.cc/index.php?topic=262231.0

AFAIK, older versions would need to recompile the IDE. Newer versions of IDE allow changing the settings inside the platform.txt file. 1.5.8 should have the platform.txt file.