build: more accurate Boost lib dependencies

See also named-data/ndn-cxx@5686c51b87b6a642aa2dc8d93e061caebbb226cc

Change-Id: I28cfc24c3d8f0dd16a7bdcec092090a09c024fdf
diff --git a/tools/wscript b/tools/wscript
index 07de0e9..337bc7f 100644
--- a/tools/wscript
+++ b/tools/wscript
@@ -4,41 +4,47 @@
 
 def build(bld):
     # Single object tools:
-    # tools/example-tool.cpp is a self-contained tool with a main() function
-    # and is built as build/bin/example-tool.
-    # These tools cannot be unit-tested.
+    # tools/foo.cpp is a self-contained tool with a main() function
+    # and is built as build/bin/foo. These tools cannot be unit-tested.
     for tool in bld.path.ant_glob('*.cpp'):
         name = tool.change_ext('').path_from(bld.path.get_bld())
         bld.program(name=name,
-                    target='../bin/%s' % name,
+                    target=f'{top}/bin/{name}',
                     source=[tool],
-                    use='NDN_CXX libndn-nac')
+                    use='BOOST_TOOLS libndn-nac')
 
     # Sub-directory tools:
-    # tools/example-tool/**/*.cpp is compiled and linked into build/bin/example-tool.
-    # tools/example-tool/main.cpp must exist and must contain the main() function.
+    # tools/foo/**/*.cpp are compiled and linked into build/bin/foo.
+    # tools/foo/main.cpp must exist and must contain the main() function.
     # All other objects are collected into 'tools-objects' and can be unit-tested.
     testableObjects = []
     for subdir in bld.path.ant_glob('*', dir=True, src=False):
+        name = subdir.path_from(bld.path)
+        subWscript = subdir.find_node('wscript')
+        if subWscript:
+            # if the subdir has a wscript, delegate to it
+            bld.recurse(name)
+            continue
+
         mainFile = subdir.find_node('main.cpp')
         if mainFile is None:
-            continue # not a C++ tool
+            # not a C++ tool, skip the subdir
+            continue
 
-        name = subdir.path_from(bld.path)
         srcFiles = subdir.ant_glob('**/*.cpp', excl=['main.cpp'])
         srcObjects = ''
         if srcFiles:
-            srcObjects = 'tools-%s-objects' % name
+            srcObjects = f'tools-{name}-objects'
             bld.objects(target=srcObjects,
                         source=srcFiles,
-                        use='NDN_CXX libndn-nac',
+                        use='libndn-nac',
                         includes=name)
             testableObjects.append(srcObjects)
 
         bld.program(name=name,
-                    target='../bin/%s' % name,
+                    target=f'{top}/bin/{name}',
                     source=[mainFile],
-                    use='NDN_CXX libndn-nac ' + srcObjects,
+                    use=f'BOOST_TOOLS libndn-nac {srcObjects}',
                     includes=name)
 
     bld.objects(target='tools-objects',