Index: builder.py
===================================================================
--- builder.py	(revision 097ccba6b0926f0615622769e5d269e359307065)
+++ builder.py	(revision 307b324a4268f8e9fec19ac96b810d76912cf132)
@@ -195,4 +195,8 @@
             '-Itestsuite/include']
 
+def buildInclude():
+    """ Returns the path where headers will be copied during build. """
+    return 'build-include'
+
 def cpuIncludes():
     return ['-Irtemsbsd/@CPU@/include',
@@ -206,4 +210,14 @@
 
 def headerPaths():
+    """ Returns a list of information about what header files should be
+    installed.
+
+    The list is also used to find headers with a local path that doesn't match
+    it's dest path. Due to the difference in the path name such files are
+    problematic during the build if they are included using their later
+    installation path (dest path) name. Therefore they are copied into a
+    sub-directory of the build path so that they can be included with their
+    normal installation path. """
+
     #         local path                      wildcard             dest path
     return [('rtemsbsd/include',              '*.h',               ''),
Index: libbsd_waf.py
===================================================================
--- libbsd_waf.py	(revision 097ccba6b0926f0615622769e5d269e359307065)
+++ libbsd_waf.py	(revision 307b324a4268f8e9fec19ac96b810d76912cf132)
@@ -84,4 +84,5 @@
     includes += ["mDNSResponder/mDNSPosix"]
     includes += ["testsuite/include"]
+    includes += ["build-include"]
 
     # Collect the libbsd uses
@@ -123,4 +124,18 @@
         rule = "sed -e 's/@NET_CFG_SELF_IP@/%s/' -e 's/@NET_CFG_NETMASK@/%s/' -e 's/@NET_CFG_PEER_IP@/%s/' -e 's/@NET_CFG_GATEWAY_IP@/%s/' < ${SRC} > ${TGT}" % (net_cfg_self_ip, net_cfg_netmask, net_cfg_peer_ip, net_cfg_gateway_ip),
         update_outputs = True)
+
+    # copy headers if necessary
+    header_build_copy_paths = [
+                              ]
+    for headers in header_build_copy_paths:
+        target = os.path.join("build-include", headers[2])
+        start_dir = bld.path.find_dir(headers[0])
+        for header in start_dir.ant_glob(os.path.join("**/", headers[1])):
+            relsourcepath = header.path_from(start_dir)
+            targetheader = os.path.join(target, relsourcepath)
+            bld(features = 'subst',
+                target = targetheader,
+                source = header,
+                is_copy = True)
 
     # KVM Symbols
Index: waf_generator.py
===================================================================
--- waf_generator.py	(revision 097ccba6b0926f0615622769e5d269e359307065)
+++ waf_generator.py	(revision 307b324a4268f8e9fec19ac96b810d76912cf132)
@@ -393,5 +393,5 @@
         self.add('        for i in %r:' % (builder.cpuIncludes()))
         self.add('            includes += ["%s" % (i[2:].replace("@CPU@", "x86"))]')
-        for i in builder.includes():
+        for i in builder.includes() + ['-I' + builder.buildInclude()]:
             self.add('    includes += ["%s"]' % (i[2:]))
         self.add('')
@@ -446,4 +446,26 @@
 
         #
+        # Add a copy rule for all headers where the install path and the source
+        # path are not the same.
+        #
+        self.add('    # copy headers if necessary')
+        self.add('    header_build_copy_paths = [')
+        for hp in builder.headerPaths():
+            if hp[2] != '' and not hp[0].endswith(hp[2]):
+                self.add('                               %s,' % (str(hp)))
+        self.add('                              ]')
+        self.add('    for headers in header_build_copy_paths:')
+        self.add('        target = os.path.join("%s", headers[2])' % (builder.buildInclude()))
+        self.add('        start_dir = bld.path.find_dir(headers[0])')
+        self.add('        for header in start_dir.ant_glob(os.path.join("**/", headers[1])):')
+        self.add('            relsourcepath = header.path_from(start_dir)')
+        self.add('            targetheader = os.path.join(target, relsourcepath)')
+        self.add('            bld(features = \'subst\',')
+        self.add('                target = targetheader,')
+        self.add('                source = header,')
+        self.add('                is_copy = True)')
+        self.add('')
+
+        #
         # Add the specific rule based builders for generating files.
         #
