build+core: Add printing of version number in daemons and tools

This commit also changes how version number is handled.  Version is now
fully controlled from top-level wscript.  In addition to that, a new
NFD_VERSION_BUILD_STRING macro is set to include more detailed
information, including commit ID (e.g., "0.1.0-rc1-1-g5c86570").

Change-Id: I448eb627e0c42dc814de1107cf7bb0dc94fa2a89
Refs: #1575
diff --git a/tools/nfd-status.cpp b/tools/nfd-status.cpp
index 1c1f415..9e8fa28 100644
--- a/tools/nfd-status.cpp
+++ b/tools/nfd-status.cpp
@@ -25,6 +25,8 @@
  * @author Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
  */
 
+#include "version.hpp"
+
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/name.hpp>
 #include <ndn-cxx/interest.hpp>
@@ -56,7 +58,10 @@
       "  [-h] - print this help message\n"
       "  [-v] - retrieve version information\n"
       "  [-f] - retrieve face status information\n"
-      "  [-b] - retrieve FIB information\n\n"
+      "  [-b] - retrieve FIB information\n"
+      "\n"
+      "  [-V] - show version information of nfd-status and exit\n"
+      "\n"
       "If no options are provided, all information is retrieved.\n"
       ;
   }
@@ -299,12 +304,12 @@
 
 }
 
-int main( int argc, char* argv[] )
+int main(int argc, char* argv[])
 {
   int option;
-  ndn::NfdStatus nfdStatus (argv[0]);
+  ndn::NfdStatus nfdStatus(argv[0]);
 
-  while ((option = getopt(argc, argv, "hvfb")) != -1) {
+  while ((option = getopt(argc, argv, "hvfbV")) != -1) {
     switch (option) {
     case 'h':
       nfdStatus.usage();
@@ -318,6 +323,9 @@
     case 'b':
       nfdStatus.enableFibEnumerationRetrieval();
       break;
+    case 'V':
+      std::cout << NFD_VERSION_BUILD_STRING << std::endl;
+      return 0;
     default:
       nfdStatus.usage();
       return 1;