From 93a099c2de1939f86a8d2f56ec19c18db0b98a3a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 2 Apr 2010 18:16:23 +1100 Subject: build: loop until all object reductions are complete we will issue a warning if any object duplication remains --- buildtools/wafsamba/samba_deps.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py index a05092f525..08a24db5bb 100644 --- a/buildtools/wafsamba/samba_deps.py +++ b/buildtools/wafsamba/samba_deps.py @@ -582,6 +582,8 @@ def reduce_objects(bld, tgt_list): for t in tgt_list: t.extended_objects = None + changed = False + for type in ['BINARY', 'PYTHON', 'LIBRARY']: for t in tgt_list: if t.samba_type != type: continue @@ -601,11 +603,16 @@ def reduce_objects(bld, tgt_list): rely_on[l] = rely_on[l].union(dup) t.final_objects = new + if not changed: + return False + # add back in any objects that were relied upon by the reduction rules for r in rely_on: t = bld.name_to_obj(r, bld.env) t.final_objects = t.final_objects.union(rely_on[r]) + return True + def calculate_final_deps(bld, tgt_list, loops): '''calculate the final library and object dependencies''' @@ -655,8 +662,13 @@ def calculate_final_deps(bld, tgt_list, loops): t.final_libs = t.final_libs.union(diff) # remove objects that are also available in linked libs - reduce_objects(bld, tgt_list) - reduce_objects(bld, tgt_list) + count = 0 + while reduce_objects(bld, tgt_list): + count += 1 + if count > 100: + print("WARNING: Unable to remove all inter-target object duplicates") + break + debug('deps: Object reduction took %u iterations', count) # add in any syslib dependencies for t in tgt_list: -- cgit