From f99cbd7ebc3d3287fbd6c4c17f62e4d9d1dbccc7 Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Mon, 25 Oct 2010 22:21:50 +0100 Subject: [PATCH] One more stop to fixing --enable-modules --- wscript | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/wscript b/wscript index c7c225b35..441657de5 100644 --- a/wscript +++ b/wscript @@ -549,24 +549,44 @@ def build(bld): env['NS3_ENABLED_MODULES'] = modules print "Modules to build:", modules + def exclude_task(bld, task): + # ok, so WAF does not provide an API to prevent an + # arbitrary task from running; we have to muck around with + # WAF internal state, something that might stop working if + # WAF is upgraded... + bld.all_task_gen.remove(task) + for group in bld.task_manager.groups: + try: + group.tasks_gen.remove(task) + except ValueError: + pass + else: + break + # Exclude the programs other misc task gens that depend on disabled modules for obj in list(bld.all_task_gen): # check for ns3moduleheader_taskgen if type(obj).__name__ == 'ns3moduleheader_taskgen': if ("ns3-%s" % obj.module) not in modules: - bld.all_task_gen.remove(obj) + exclude_task(bld, obj) # check for programs if hasattr(obj, 'ns3_module_dependencies'): # this is an NS-3 program (bld.create_ns3_program) for dep in obj.ns3_module_dependencies: if dep not in modules: # prog. depends on a module that isn't enabled? - bld.all_task_gen.remove(obj) + exclude_task(bld, obj) break + # disable the modules themselves if hasattr(obj, "is_ns3_module") and obj.name not in modules: - bld.all_task_gen.remove(obj) + exclude_task(bld, obj) + + # disable the ns3header_taskgen + if type(obj).__name__ == 'ns3header_taskgen': + if ("ns3-%s" % obj.module) not in modules: + exclude_task(bld, obj) ## Create a single ns3 library containing all enabled modules if env['ENABLE_STATIC_NS3']: