Make openflow and tap-bridge modules not be built if not appropriate
authorMitch Watrous <watrous@u.washington.edu>
Tue, 31 May 2011 10:32:52 -0700
changeset 7304 1ebf059e9ebc
parent 7303 0f574c532cee
child 7305 44c96d2cc1ec
Make openflow and tap-bridge modules not be built if not appropriate
src/emu/wscript
src/openflow/wscript
src/tap-bridge/wscript
--- a/src/emu/wscript	Mon May 30 15:30:49 2011 -0700
+++ b/src/emu/wscript	Tue May 31 10:32:52 2011 -0700
@@ -19,6 +19,8 @@
         emucreatordir = os.path.abspath(os.path.join(blddir, "src/emu"))
         conf.env.append_value('NS3_EXECUTABLE_PATH', emucreatordir)
     else:
+        # Add this module to the list of modules that won't be built
+        # if they are enabled.
         conf.env['MODULES_NOT_BUILT'].append('emu')
 
 def build(bld):
--- a/src/openflow/wscript	Mon May 30 15:30:49 2011 -0700
+++ b/src/openflow/wscript	Tue May 31 10:32:52 2011 -0700
@@ -25,6 +25,11 @@
     if not conf.env['BOOST']:
 	conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False,
 				     "Required boost libraries not found")
+
+        # Add this module to the list of modules that won't be built
+        # if they are enabled.
+        conf.env['MODULES_NOT_BUILT'].append('openflow')
+
 	return 
 
     if Options.options.with_openflow:
@@ -41,6 +46,10 @@
 	conf.check_message("OpenFlow location", '', False)
 	conf.report_optional_feature("openflow", "NS-3 OpenFlow Integration", False,
 				     "OpenFlow not enabled (see option --with-openflow)")
+        # Add this module to the list of modules that won't be built
+        # if they are enabled.
+        conf.env['MODULES_NOT_BUILT'].append('openflow')
+
 	return 
 
     test_code = '''
@@ -112,10 +121,18 @@
         conf.env.append_value('CXXDEFINES', 'NS3_OPENFLOW')
         conf.env.append_value('CPPPATH', conf.env['CPPPATH_OPENFLOW']) 
         conf.env.append_value('LIBPATH', conf.env['LIBPATH_OPENFLOW']) 
+    else:
+        # Add this module to the list of modules that won't be built
+        # if they are enabled.
+        conf.env['MODULES_NOT_BUILT'].append('openflow')
 
 
 
 def build(bld):
+    # Don't do anything for this module if openflow's not enabled.
+    if 'openflow' in bld.env['MODULES_NOT_BUILT']:
+        return
+
     # Build the Switch module
     obj = bld.create_ns3_module('openflow', ['internet'])
     obj.source = [
--- a/src/tap-bridge/wscript	Mon May 30 15:30:49 2011 -0700
+++ b/src/tap-bridge/wscript	Tue May 31 10:32:52 2011 -0700
@@ -18,31 +18,30 @@
         blddir = os.path.abspath(os.path.join(conf.blddir, conf.env.variant()))
         tapcreatordir = os.path.abspath(os.path.join(blddir, "src/tap-bridge"))
         conf.env.append_value('NS3_EXECUTABLE_PATH', tapcreatordir)
+    else:
+        # Add this module to the list of modules that won't be built
+        # if they are enabled.
+        conf.env['MODULES_NOT_BUILT'].append('tap-bridge')
 
 def build(bld):
+    # Don't do anything for this module if tap-bridge's not enabled.
+    if not bld.env['ENABLE_TAP']:
+        return
+
     module = bld.create_ns3_module('tap-bridge', ['network', 'internet'])
     module.source = [
+        'model/tap-bridge.cc',
+        'model/tap-encode-decode.cc',
+        'helper/tap-bridge-helper.cc',
         ]
     headers = bld.new_task_gen('ns3header')
     headers.module = 'tap-bridge'
     headers.source = [
+        'model/tap-bridge.h',
+        'helper/tap-bridge-helper.h',
         'doc/tap.h',
         ]
 
-    if not bld.env['ENABLE_TAP']:
-        return
-
-    module.source.extend([
-            'model/tap-bridge.cc',
-            'model/tap-encode-decode.cc',
-            'helper/tap-bridge-helper.cc',
-            ])
-    headers.source.extend([
-            'model/tap-bridge.h',
-            'helper/tap-bridge-helper.h',
-            ])
-
-
     if not bld.env['PLATFORM'].startswith('freebsd'):
         obj = bld.create_suid_program('tap-creator')
         obj.source = [