core: unify version string

refs #2671

Change-Id: I88a58a500a43635cc8698c4bf444723d6e713590
diff --git a/tools/peek/ndn-peek.cpp b/tools/peek/ndn-peek.cpp
index 8f79a61..7bc8dae 100644
--- a/tools/peek/ndn-peek.cpp
+++ b/tools/peek/ndn-peek.cpp
@@ -48,11 +48,7 @@
  * @author Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
  */
 
-#include "version.hpp"
-
-#include <boost/noncopyable.hpp>
-
-#include <ndn-cxx/face.hpp>
+#include "core/version.hpp"
 
 namespace ndn {
 namespace peek {
@@ -282,7 +278,7 @@
       program.setTimeout(atoi(optarg));
       break;
     case 'V':
-      std::cout << NFD_VERSION_BUILD_STRING << std::endl;
+      std::cout << "ndnpeek " << tools::VERSION << std::endl;
       return 0;
     default:
       program.usage();
diff --git a/tools/peek/ndn-poke.cpp b/tools/peek/ndn-poke.cpp
index 73e4a56..afdf1d6 100644
--- a/tools/peek/ndn-poke.cpp
+++ b/tools/peek/ndn-poke.cpp
@@ -48,12 +48,7 @@
  * @author Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
  */
 
-#include "version.hpp"
-
-#include <boost/noncopyable.hpp>
-
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/security/key-chain.hpp>
+#include "core/version.hpp"
 
 namespace ndn {
 namespace peek {
@@ -274,7 +269,7 @@
       program.setTimeout(atoi(optarg));
       break;
     case 'V':
-      std::cout << NFD_VERSION_BUILD_STRING << std::endl;
+      std::cout << "ndnpoke " << tools::VERSION << std::endl;
       return 0;
     default:
       program.usage();
diff --git a/tools/peek/version.hpp b/tools/peek/version.hpp
deleted file mode 100644
index 9c758ba..0000000
--- a/tools/peek/version.hpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2015,  Regents of the University of California,
- *                           Arizona Board of Regents,
- *                           Colorado State University,
- *                           University Pierre & Marie Curie, Sorbonne University,
- *                           Washington University in St. Louis,
- *                           Beijing Institute of Technology,
- *                           The University of Memphis.
- *
- * This file is part of ndn-tools (Named Data Networking Essential Tools).
- * See AUTHORS.md for complete list of ndn-tools authors and contributors.
- *
- * ndn-tools is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * ndn-tools is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * ndn-tools, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-/**
- * Copyright (c) 2014,  Regents of the University of California,
- *                      Arizona Board of Regents,
- *                      Colorado State University,
- *                      University Pierre & Marie Curie, Sorbonne University,
- *                      Washington University in St. Louis,
- *                      Beijing Institute of Technology,
- *                      The University of Memphis
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_VERSION_HPP
-#define NFD_VERSION_HPP
-
-namespace nfd {
-
-/** NFD version follows Semantic Versioning 2.0.0 specification
- *  http://semver.org/
- */
-
-// To change version number, modify VERSION variable in top-level wscript.
-
-/** \brief NFD version represented as an integer
- *
- *  MAJOR*1000000 + MINOR*1000 + PATCH
- */
-#define NFD_VERSION 3001
-
-/** \brief NFD version represented as a string
- *
- *  MAJOR.MINOR.PATCH
- */
-#define NFD_VERSION_STRING "0.3.1"
-
-/** \brief NFD version string, including git commit information, if NFD is build from
- *         specific git commit
- *
- * NFD_VERSION_BUILD_STRING is obtained using the following command (`NFD-` prefix is
- * afterwards removed):
- *
- *    `git describe --match 'NFD-*'`
- *
- * When NFD is built not from git, NFD_VERSION_BUILD_STRING equals NFD_VERSION_STRING
- *
- * MAJOR.MINOR.PATCH(-release-candidate-tag)(-(number-of-commits-since-tag)-COMMIT-HASH)
- *
- * Example, 0.1.0-rc1-1-g5c86570
- */
-#define NFD_VERSION_BUILD_STRING "0.3.1-7-g2231ab5"
-
-/// MAJOR version
-#define NFD_VERSION_MAJOR 0
-/// MINOR version
-#define NFD_VERSION_MINOR 3
-/// PATCH version
-#define NFD_VERSION_PATCH 1
-
-} // namespace nfd
-
-#endif // NFD_VERSION_HPP
diff --git a/tools/ping/ndn-ping-server.cpp b/tools/ping/ndn-ping-server.cpp
index d508e6c..437c529 100644
--- a/tools/ping/ndn-ping-server.cpp
+++ b/tools/ping/ndn-ping-server.cpp
@@ -35,12 +35,7 @@
  * @author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
  */
 
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/name.hpp>
-#include <ndn-cxx/security/key-chain.hpp>
-
-#include <boost/asio.hpp>
-#include <boost/noncopyable.hpp>
+#include "core/version.hpp"
 
 namespace ndn {
 namespace ping {
@@ -209,7 +204,7 @@
   int res;
 
   NdnPingServer program(argv[0]);
-  while ((res = getopt(argc, argv, "hdtp:x:")) != -1)
+  while ((res = getopt(argc, argv, "hdtp:x:V")) != -1)
     {
       switch (res) {
       case 'h':
@@ -224,7 +219,10 @@
       case 't':
         program.setPrintTimestamp();
         break;
-      default:
+      case 'V':
+        std::cout << "ndnpingserver " << tools::VERSION << std::endl;
+        return 0;
+     default:
         program.usage();
         break;
       }
diff --git a/tools/ping/ndn-ping.cpp b/tools/ping/ndn-ping.cpp
index 11591a6..5d0908e 100644
--- a/tools/ping/ndn-ping.cpp
+++ b/tools/ping/ndn-ping.cpp
@@ -35,13 +35,9 @@
  * @author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
  */
 
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/name.hpp>
+#include "core/version.hpp"
 
-#include <boost/asio.hpp>
-#include <boost/bind.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/noncopyable.hpp>
 
 namespace ndn {
 namespace ping {
@@ -389,7 +385,7 @@
   int res;
 
   NdnPing program(argv[0]);
-  while ((res = getopt(argc, argv, "htai:c:n:p:")) != -1)
+  while ((res = getopt(argc, argv, "htai:c:n:p:V")) != -1)
     {
       switch (res) {
       case 'a':
@@ -418,6 +414,9 @@
       case 't':
         program.setPrintTimestamp();
         break;
+      case 'V':
+        std::cout << "ndnping " << tools::VERSION << std::endl;
+        return 0;
       default:
         program.usage();
         break;