Better handling of optimization flags for lib/

Rethink the way scons should reinstate -O0 if compiling with debug=1.
Trying to be clever with CCFLAGS was causing problems: see #52.