The compiler defines a macro called __OPTIMIZE__ when optimization is enabled.
If you insert these lines in any C file, the compiler will fail if the make flags do not work for this file.
#ifdef __OPTIMIZE__ #error Optimization enabled. That not right! #endif
Another option is to check the arch-specific flags on the embedded binary (.o or executable).
readelf -A myfile.o
ARM has a flag indicating the level of optimization, but I think the Android toolchain might be a little old to use it correctly, so YMMV.
source share