build: allow waf to cache include lists more efficiently
authorAndrew Tridgell <tridge@samba.org>
Wed, 17 Mar 2010 00:46:14 +0000 (11:46 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:26:50 +0000 (20:26 +1000)
Using include paths all based on the topdir is more efficient

buildtools/wafsamba/samba_deps.py

index 24807f844e9f3f611645caecd57e0384ccd60679..f20bccba067c37e5ba9f2b48ac545fdf90b92794 100644 (file)
@@ -146,9 +146,23 @@ def build_includes(self):
     if getattr(self, 'local_include', True) == True and not getattr(self, 'local_include_first', True):
         includes.append('.')
 
-    self.env['INC_PATHS'] = unique_list(includes)
-    debug('deps: includes for target %s: INC_PATHS=%s',
-          self.sname, self.env['INC_PATHS'])
+    # now transform the includes list to be relative to the top directory
+    # which is represented by '#' in waf. This allows waf to cache the
+    # includes lists more efficiently
+    includes_top = []
+    for i in includes:
+        if i[0] == '#':
+            # some are already top based
+            includes_top.append(i)
+            continue
+        absinc = os.path.join(self.path.abspath(), i)
+        relinc = os_path_relpath(absinc, self.bld.srcnode.abspath())
+        includes_top.append('#' + relinc)
+
+    self.includes = unique_list(includes_top)
+    debug('deps: includes for target %s: includes=%s',
+          self.sname, self.includes)
+