diff --git a/wscript b/wscript
index 1cfebef..fece357 100644
--- a/wscript
+++ b/wscript
@@ -1,53 +1,55 @@
 # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
 
-VERSION='0.1'
-APPNAME='ChronoSync'
+from waflib import Logs, Utils, Context
+import os
 
-from waflib import Configure, Build, Logs
+VERSION = '0.2'
+APPNAME = 'ChronoSync'
 
 def options(opt):
-    opt.load('compiler_c compiler_cxx gnu_dirs')
-    opt.load('boost doxygen sphinx_build protoc default-compiler-flags pch',
-             tooldir='.waf-tools')
+    opt.load(['compiler_c', 'compiler_cxx', 'gnu_dirs'])
+    opt.load(['boost', 'doxygen', 'sphinx_build', 'default-compiler-flags',
+              'pch', 'protoc'],
+             tooldir=['.waf-tools'])
 
     syncopt = opt.add_option_group ("ChronoSync Options")
 
-    syncopt.add_option('--debug',action='store_true', default=False, dest='debug',
+    syncopt.add_option('--debug', action='store_true', default=False, dest='debug',
                        help='''debugging mode''')
     syncopt.add_option('--with-log4cxx', action='store_true', default=False, dest='log4cxx',
                        help='''Compile with log4cxx''')
-    syncopt.add_option('--with-tests', action='store_true', default=False, dest='_test',
+    syncopt.add_option('--with-tests', action='store_true', default=False, dest='_tests',
                        help='''build unit tests''')
 
 def configure(conf):
-    conf.load('compiler_c compiler_cxx gnu_dirs boost default-compiler-flags pch')
-    conf.load('doxygen sphinx_build')
-    conf.load('protoc')
+    conf.load(['compiler_c', 'compiler_cxx', 'gnu_dirs', 'boost', 'pch',
+               'doxygen', 'sphinx_build', 'default-compiler-flags', 'protoc'])
 
-    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'], uselib_store='NDNCXX',
-                   mandatory=True)
+    conf.check_cfg(package='libndn-cxx', args=['--cflags', '--libs'],
+                   uselib_store='NDN_CXX', mandatory=True)
 
-    conf.check_boost(lib='system iostreams thread unit_test_framework')
+    boost_libs = 'system iostreams'
+    if conf.options._tests:
+        conf.env['_TESTS'] = 1
+        conf.define('_TESTS', 1);
+        boost_libs += ' unit_test_framework'
 
     if conf.options.log4cxx:
         conf.check_cfg(package='liblog4cxx', args=['--cflags', '--libs'], uselib_store='LOG4CXX',
                        mandatory=True)
 
-    if conf.options._test:
-      conf.define('_TEST', 1)
-
 def build(bld):
     libsync = bld(
         target="ChronoSync",
         # vnum = "1.0.0",
         features=['cxx', 'cxxshlib'],
         source =  bld.path.ant_glob(['src/**/*.cc', 'src/**/*.proto']),
-        use = 'BOOST NDNCXX',
+        use = 'BOOST NDN_CXX',
         includes = ['src'],
         )
 
     # Unit tests
-    if bld.get_define("_TEST"):
+    if bld.get_define("_TESTS"):
       unittests = bld.program(
           target="unit-tests",
           source = bld.path.ant_glob(['tests/**/*.cc']),
@@ -59,7 +61,7 @@
 
     if bld.get_define("HAVE_LOG4CXX"):
         libsync.use += ' LOG4CXX'
-        if bld.get_define("_TEST"):
+        if bld.get_define("_TESTS"):
             unittests.use += ' LOG4CXX'
 
     bld.install_files(
@@ -86,9 +88,65 @@
         VERSION      = VERSION,
         )
 
+# docs
+def docs(bld):
+    from waflib import Options
+    Options.commands = ['doxygen', 'sphinx'] + Options.commands
+
 def doxygen(bld):
+    version(bld)
+
     if not bld.env.DOXYGEN:
-        bld.fatal("ERROR: cannot build documentation(`doxygen' is not found in $PATH)")
-    bld(features="doxygen",
-         doxyfile='doc/doxygen.conf',
-         output_dir = 'doc')
+        Logs.error("ERROR: cannot build documentation (`doxygen' is not found in $PATH)")
+    else:
+        bld(features="subst",
+            name="doxygen-conf",
+            source=["docs/doxygen.conf.in",
+                    "docs/named_data_theme/named_data_footer-with-analytics.html.in"],
+            target=["docs/doxygen.conf",
+                    "docs/named_data_theme/named_data_footer-with-analytics.html"],
+            VERSION=VERSION,
+            HTML_FOOTER="../build/docs/named_data_theme/named_data_footer-with-analytics.html" \
+                          if os.getenv('GOOGLE_ANALYTICS', None) \
+                          else "../docs/named_data_theme/named_data_footer.html",
+            GOOGLE_ANALYTICS=os.getenv('GOOGLE_ANALYTICS', ""),
+            )
+
+        bld(features="doxygen",
+            doxyfile='docs/doxygen.conf',
+            use="doxygen-conf")
+
+def sphinx(bld):
+    version(bld)
+
+    if not bld.env.SPHINX_BUILD:
+        bld.fatal("ERROR: cannot build documentation (`sphinx-build' is not found in $PATH)")
+    else:
+        bld(features="sphinx",
+            outdir="docs",
+            source=bld.path.ant_glob("docs/**/*.rst"),
+            config="docs/conf.py",
+            VERSION=VERSION)
+
+def version(ctx):
+    if getattr(Context.g_module, 'VERSION_BASE', None):
+        return
+
+    Context.g_module.VERSION_BASE = Context.g_module.VERSION
+    Context.g_module.VERSION_SPLIT = [v for v in VERSION_BASE.split('.')]
+
+    try:
+        cmd = ['git', 'describe', '--match', 'ChronoSync-*']
+        p = Utils.subprocess.Popen(cmd, stdout=Utils.subprocess.PIPE,
+                                   stderr=None, stdin=None)
+        out = p.communicate()[0].strip()
+        if p.returncode == 0 and out != "":
+            Context.g_module.VERSION = out[11:]
+    except:
+        pass
+
+def dist(ctx):
+    version(ctx)
+
+def distcheck(ctx):
+    version(ctx)
