build: Enabling -Werror in debug mode and updating behavior of CXXFLAGS overriding

Change-Id: Ieee3ad85bf0e3eb283b2d42a6df8d3942cf11a51
diff --git a/wscript b/wscript
index a1f7a76..89c8f40 100644
--- a/wscript
+++ b/wscript
@@ -1,32 +1,35 @@
 # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
-from waflib import Build, Logs, Utils, Task, TaskGen, Configure
-import os
+from waflib import Logs
 
 def options(opt):
     opt.load('compiler_cxx gnu_dirs')
     opt.load('flags boost doxygen coverage', tooldir=['.waf-tools'])
 
     nrdopt = opt.add_option_group('NRD Options')
-    nrdopt.add_option('--debug',action='store_true',default=False,dest='debug',help='''Compile library debugging mode without all optimizations (-O0)''')
-    nrdopt.add_option('--with-tests', action='store_true',default=False,dest='with_tests',help='''Build unit tests''')
+    nrdopt.add_option('--debug', action='store_true', default=False,
+                      dest='debug',
+                      help='''Compile library debugging mode without all optimizations (-O0)''')
+    nrdopt.add_option('--with-tests', action='store_true',
+                      default=False, dest='with_tests', help='''Build unit tests''')
 
 def configure(conf):
     conf.load("compiler_cxx gnu_dirs boost flags")
 
-    conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'], uselib_store='NDN_CPP', mandatory=True)
+    conf.check_cfg(package='libndn-cpp-dev', args=['--cflags', '--libs'],
+                   uselib_store='NDN_CPP', mandatory=True)
 
-    boost_libs='system'
+    boost_libs = 'system'
     if conf.options.with_tests:
         conf.env['WITH_TESTS'] = 1
         conf.define('WITH_TESTS', 1);
-        boost_libs+=' unit_test_framework'
+        boost_libs += ' unit_test_framework'
 
     conf.check_boost(lib=boost_libs)
     if conf.env.BOOST_VERSION_NUMBER < 104800:
-        Logs.error ("Minimum required boost version is 1.48")
-        Logs.error ("Please upgrade your distribution or install custom boost libraries" +
-                    " (http://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
+        Logs.error("Minimum required boost version is 1.48")
+        Logs.error("Please upgrade your distribution or install custom boost libraries" +
+                   " (http://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)")
         return
 
     # conf.load('coverage')
@@ -40,25 +43,26 @@
 
 def build (bld):
     bld(
-        features=['cxx'],
-        name="nrd-objects",
-        source = bld.path.ant_glob('src/*.cpp', excl='src/main.cpp'),
-        use = 'NDN_CPP BOOST',
+        features='cxx',
+        name='nrd-objects',
+        source=bld.path.ant_glob('src/*.cpp',
+                                 excl='src/main.cpp'),
+        use='NDN_CPP BOOST',
         )
 
     bld.program(
-        target = 'nrd',
-        source = 'src/main.cpp',
-        use = 'nrd-objects'
+        target='nrd',
+        source='src/main.cpp',
+        use='nrd-objects'
         )
 
     # Unit tests
     if bld.env['WITH_TESTS']:
-        unit_tests = unittests = bld.program(
+        unit_tests = bld.program(
             target='unit-tests',
-            features = 'cxx cxxprogram',
-            source = bld.path.ant_glob(['tests/**/*.cpp']),
-            use = 'nrd-objects',
-            includes = ['.', 'src'],
-            install_prefix = None,
+            features='cxx cxxprogram',
+            source=bld.path.ant_glob(['tests/**/*.cpp']),
+            use='nrd-objects',
+            includes=['.', 'src'],
+            install_prefix=None,
           )