Just use COPTS to add whatever flags you want. Since it's appended to the default CFLAGS, it will override any previous -O2 option. If there's a directory that doesn't obey COPTS (or CXXOPTS for C++), that's a bug. That said, compiling with !-O2 might lead you into trouble.