There are a few larger programs I am interested in compiling with -Os. The normal method I use to patch/recompile programs is apt-get source followed by dpkg-buildpackage.
I learned from the dpkg-buildflags man page that I can set global flags in a configuration file. This seems to work for only some packages if I append the flags I want. The problem is that most programs ignore the flags and build with -O2 (and in some cases -O3) anyway.
Is there a way I can force the compiler to use -Os?