summaryrefslogtreecommitdiff
path: root/lib/replace
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-02-24 17:38:54 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:38 +1000
commitf74584a96cf235500b86addf90c50184a21bc510 (patch)
tree477a1d51037b3a8af2dacfe39c4c85e281e673e2 /lib/replace
parent24511472a344749f67fd90ca5c7e76d6c290f93a (diff)
downloadsamba-f74584a96cf235500b86addf90c50184a21bc510.tar.gz
samba-f74584a96cf235500b86addf90c50184a21bc510.tar.bz2
samba-f74584a96cf235500b86addf90c50184a21bc510.zip
build: recursive dependency calculation
Diffstat (limited to 'lib/replace')
-rw-r--r--lib/replace/wafsamba.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/replace/wafsamba.py b/lib/replace/wafsamba.py
index a836eed86d..82dd174f9b 100644
--- a/lib/replace/wafsamba.py
+++ b/lib/replace/wafsamba.py
@@ -1,9 +1,10 @@
# a waf tool to add autoconf-like macros to the configure section
# and for SAMBA_ macros for building libraries, binaries etc
-import Build, os, Logs, sys, Configure, Options, string
+import Build, os, Logs, sys, Configure, Options, string, Task
from Configure import conf
from Logs import debug
+from TaskGen import extension
LIB_PATH="shared"
@@ -317,22 +318,22 @@ Build.BuildContext.PREDECLARE = PREDECLARE
################################################################
# add to the dependency list. Return a new dependency list with
# any circular dependencies removed
-# returns a tuple containing (systemdeps, localdeps)
+# returns a tuple containing (systemdeps, localdeps, add_objects)
def ADD_DEPENDENCIES(bld, name, deps):
debug('deps: Calculating dependencies for %s' % name)
- cache = LOCAL_CACHE(bld, 'LIB_DEPS')
- if not name in cache:
- cache[name] = {}
+ lib_deps = LOCAL_CACHE(bld, 'LIB_DEPS')
+ if not name in lib_deps:
+ lib_deps[name] = {}
list = deps.split()
list2 = []
for d in list:
- cache[name][d] = True;
+ lib_deps[name][d] = True;
try:
CHECK_TARGET_DEPENDENCY(bld, name)
list2.append(d)
except AssertionError:
debug("deps: Removing dependency %s from target %s" % (d, name))
- del(cache[name][d])
+ del(lib_deps[name][d])
# extract out the system dependencies
sysdeps = []
@@ -342,6 +343,7 @@ def ADD_DEPENDENCIES(bld, name, deps):
target_cache = LOCAL_CACHE(bld, 'TARGET_TYPE')
predeclare = LOCAL_CACHE(bld, 'PREDECLARED_TARGET')
for d in list2:
+ recurse = False
# strip out any dependencies on empty libraries
if d in cache:
debug("deps: Removing empty dependency '%s' from '%s'" % (d, name))
@@ -362,15 +364,28 @@ def ADD_DEPENDENCIES(bld, name, deps):
localdeps.append(d)
elif type == 'SUBSYSTEM':
add_objects.append(d)
+ recurse = True
elif type == 'MODULE':
add_objects.append(d)
+ recurse = True
elif type == 'PYTHON':
pass
elif type == 'ASN1':
pass
+ elif type == 'BINARY':
+ pass
else:
ASSERT(bld, False, "Unknown target type '%s' for dependency %s" % (
type, d))
+
+ # for some types we have to build the list recursively
+ if recurse and (d in lib_deps):
+ rec_deps = ' '.join(lib_deps[d].keys())
+ (rec_sysdeps, rec_localdeps, rec_add_objects) = ADD_DEPENDENCIES(bld, d, rec_deps)
+ sysdeps.extend(rec_sysdeps.split())
+ localdeps.extend(rec_localdeps.split())
+ add_objects.extend(rec_add_objects.split())
+
debug('deps: Dependencies for %s: sysdeps: %u localdeps: %u add_objects=%u' % (
name, len(sysdeps), len(localdeps), len(add_objects)))
return (' '.join(sysdeps), ' '.join(localdeps), ' '.join(add_objects))