summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-10-21 11:19:09 +1100
committerAndrew Tridgell <tridge@samba.org>2010-10-21 19:03:24 +1100
commit1d8733537e47439f8d79cd78d278eace1b795df3 (patch)
tree655864eca6c1d194953a452d8ddfb7189903f0e2
parent713900b81297548c44a890c3bca1dde9019af8bc (diff)
downloadsamba-1d8733537e47439f8d79cd78d278eace1b795df3.tar.gz
samba-1d8733537e47439f8d79cd78d278eace1b795df3.tar.bz2
samba-1d8733537e47439f8d79cd78d278eace1b795df3.zip
waf: added the concept of a grouping_library
a grouping library is one which 'groups' a set of subsystems. This means that if a target depends on a subsystem that is within a grouping library then that dependency is replaced with a dependency on the grouping library. This gives us a powerful method to avoid duplicated object files between libraries. Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--buildtools/wafsamba/samba_deps.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
index c022fc7dbf..59bb764fb7 100644
--- a/buildtools/wafsamba/samba_deps.py
+++ b/buildtools/wafsamba/samba_deps.py
@@ -378,6 +378,36 @@ def add_samba_attributes(bld, tgt_list):
t.samba_includes_extended = TO_LIST(t.samba_includes)[:]
t.ccflags = getattr(t, 'samba_cflags', '')
+def replace_grouping_libraries(bld, tgt_list):
+ '''replace dependencies based on grouping libraries
+
+ If a library is marked as a grouping library, then any target that
+ depends on a subsystem that is part of that grouping library gets
+ that dependency replaced with a dependency on the grouping library
+ '''
+
+ targets = LOCAL_CACHE(bld, 'TARGET_TYPE')
+
+ grouping = {}
+
+ # find our list of grouping libraries, mapped from the subsystems they depend on
+ for t in tgt_list:
+ if not getattr(t, 'grouping_library', False):
+ continue
+ for dep in t.samba_deps_extended:
+ if targets[dep] == 'SUBSYSTEM':
+ grouping[dep] = t.sname
+
+ # now replace any dependencies on elements of grouping libraries
+ for t in tgt_list:
+ for i in range(len(t.samba_deps_extended)):
+ dep = t.samba_deps_extended[i]
+ if dep in grouping:
+ if t.sname != grouping[dep]:
+ debug("deps: target %s: replacing dependency %s with grouping library %s" % (t.sname, dep, grouping[dep]))
+ t.samba_deps_extended[i] = grouping[dep]
+
+
def build_direct_deps(bld, tgt_list):
'''build the direct_objects and direct_libs sets for each target'''
@@ -868,7 +898,7 @@ def show_object_duplicates(bld, tgt_list):
######################################################################
# this provides a way to save our dependency calculations between runs
savedeps_version = 3
-savedeps_inputs = ['samba_deps', 'samba_includes', 'local_include', 'local_include_first', 'samba_cflags', 'source']
+savedeps_inputs = ['samba_deps', 'samba_includes', 'local_include', 'local_include_first', 'samba_cflags', 'source', 'grouping_library']
savedeps_outputs = ['uselib', 'uselib_local', 'add_objects', 'includes', 'ccflags']
savedeps_outenv = ['INC_PATHS']
savedeps_envvars = ['NONSHARED_BINARIES', 'GLOBAL_DEPENDENCIES']
@@ -1028,6 +1058,7 @@ def check_project_rules(bld):
debug('deps: project rules checking started')
expand_subsystem_deps(bld)
+ replace_grouping_libraries(bld, tgt_list)
build_direct_deps(bld, tgt_list)
break_dependency_loops(bld, tgt_list)