wscript
changeset 7495 d87f20fd2421
parent 7494 d93f5e8e0a59
child 7496 ce1ec79d488c
--- a/wscript	Tue Sep 13 13:47:17 2011 +0100
+++ b/wscript	Tue Sep 13 17:21:44 2011 +0100
@@ -565,6 +565,13 @@
     # Each of the modules this program depends on has its own library.
     program.ns3_module_dependencies = ['ns3-'+dep for dep in dependencies]
     program.includes = "# #/.."
+    program.use = program.ns3_module_dependencies
+    if program.env['ENABLE_STATIC_NS3']:
+        if sys.platform == 'darwin':
+            program.env.STLIB_MARKER = '-Wl,-all_load'
+        else:
+            program.env.STLIB_MARKER = '-Wl,--whole-archive,-Bstatic'
+            program.env.SHLIB_MARKER = '-Wl,-Bdynamic,--no-whole-archive'
     return program
 
 def register_ns3_script(bld, name, dependencies=('core',)):
@@ -601,22 +608,6 @@
             obj.name = obj.target
 
 
-def _add_ns3_program_missing_deps(bld, program):
-    deps_found = program.ns3_module_dependencies
-    program.use = getattr(program, "use", []) + [dep #+ "--lib"
-                                                          for dep in deps_found]
-    if program.env['ENABLE_STATIC_NS3']:
-        if sys.platform == 'darwin':
-            program.env.append_value('LINKFLAGS', '-Wl,-all_load')
-            for dep in deps_found:
-                program.env.append_value('LINKFLAGS', '-l' + dep)
-        else:
-            program.env.append_value('LINKFLAGS', '-Wl,--whole-archive,-Bstatic')
-            for dep in deps_found:
-                program.env.append_value('LINKFLAGS', '-l' + dep)
-            program.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive')
-
-
 def _get_all_task_gen(self):
     for group in self.groups:
         for taskgen in group:
@@ -762,35 +753,10 @@
 
     bld.add_subdirs('bindings/python')
 
-    ## do a topological sort on the modules graph
-    dep_graph = []
-    for gen in bld.all_task_gen:
-        if type(gen).__name__ in ['ns3module_taskgen']:
-            for dep in gen.dependencies:
-                dep_graph.append(("ns3-"+dep, gen.name))
-    dep_graph.sort()
-    sys.path.insert(0, "bindings/python")
-    from topsort import topsort
-    sorted_ns3_modules = topsort(dep_graph)
-    #print sorted_ns3_modules
-
-    # we need to post() the ns3 modules, so they create libraries underneath, and programs can list them in uselib_local
-    for module in sorted_ns3_modules:
-        gen = bld.get_tgen_by_name(module)
-        if type(gen).__name__ in ['ns3module_taskgen']:
-            gen.post()
-            for lib in gen.libs:
-                lib.post()
-
     # Process this subfolder here after the lists of enabled modules
     # and module test libraries have been set.
     bld.add_subdirs('utils')
 
-    for gen in bld.all_task_gen:
-        if not getattr(gen, "is_ns3_program", False) or not hasattr(gen, "ns3_module_dependencies"):
-            continue
-        _add_ns3_program_missing_deps(bld, gen)
-
     if Options.options.run:
         # Check that the requested program name is valid
         program_name, dummy_program_argv = wutils.get_run_program(Options.options.run, wutils.get_command_template(env))
@@ -807,6 +773,8 @@
         _doxygen(bld)
         raise SystemExit(0)
 
+
+
 def shutdown(ctx):
     bld = wutils.bld
     if wutils.bld is None:
@@ -836,8 +804,7 @@
             print
 
     # Write the build status file.
-    build_status_file = os.path.join(bld.out_dir, #env['NS3_ACTIVE_VARIANT'],
-                                     'build-status.py')
+    build_status_file = os.path.join(bld.out_dir, 'build-status.py')
     out = open(build_status_file, 'w')
     out.write('#! /usr/bin/env python\n')
     out.write('\n')
@@ -870,13 +837,14 @@
 
     check_shell(bld)
 
+
 check_context = Build.BuildContext
-
 def check(bld):
     """run the equivalent of the old ns-3 unit tests using test.py"""
     env = wutils.bld.env
     wutils.run_python_program("test.py -n -c core", env)
 
+
 class print_introspected_doxygen_task(Task.TaskBase):
     after = 'cc cxx link'
     color = 'BLUE'