Signed-off-by: Mike Holmes <[email protected]>
---

V2
Reduce the number fo files touched.

 platform/Makefile.inc             |  4 ++++
 platform/linux-generic/odp_impl.c | 14 ++++++++++++--
 scripts/git_hash.sh               |  9 +++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)
 create mode 100755 scripts/git_hash.sh

diff --git a/platform/Makefile.inc b/platform/Makefile.inc
index 9e73fc4..4000d64 100644
--- a/platform/Makefile.inc
+++ b/platform/Makefile.inc
@@ -11,3 +11,7 @@ VPATH = $(srcdir) $(builddir)
 lib_LTLIBRARIES = $(LIB)/libodp.la
 
 AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)'
+
+GIT_DESC !=$(top_builddir)/scripts/git_hash.sh
+AM_CFLAGS += "-DGIT_HASH=$(GIT_DESC)"
+AM_CFLAGS += -DPLATFORM=${with_platform}
diff --git a/platform/linux-generic/odp_impl.c 
b/platform/linux-generic/odp_impl.c
index ca3224d..46d0e40 100644
--- a/platform/linux-generic/odp_impl.c
+++ b/platform/linux-generic/odp_impl.c
@@ -20,8 +20,18 @@ extern "C" {
 
 #include <odp/version.h>
 
-#define  ODP_VERSION_IMPL 0
-#define  ODP_VERSION_IMPL_STR ODP_VERSION_TO_STR(ODP_VERSION_IMPL)
+#define ODP_VERSION_IMPL 0
+#define ODP_VERSION_IMPL_STR \
+       ODP_VERSION_TO_STR(PLATFORM) " " \
+       ODP_VERSION_TO_STR(ODP_VERSION_API_GENERATION) "." \
+       ODP_VERSION_TO_STR(ODP_VERSION_API_MAJOR) "." \
+       ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR) "-" \
+       ODP_VERSION_TO_STR(ODP_VERSION_IMPL) " (v" \
+       ODP_VERSION_TO_STR(ODP_VERSION_API_GENERATION) "." \
+       ODP_VERSION_TO_STR(ODP_VERSION_API_MAJOR) "." \
+       ODP_VERSION_TO_STR(ODP_VERSION_API_MINOR) ") " \
+       __DATE__ " " __TIME__ " " \
+       ODP_VERSION_TO_STR(GIT_HASH)
 
 const char *odp_version_impl_str(void)
 {
diff --git a/scripts/git_hash.sh b/scripts/git_hash.sh
new file mode 100755
index 0000000..c9f1faf
--- /dev/null
+++ b/scripts/git_hash.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+repo=https://git.linaro.org/lng/odp.git
+hash=$(git describe | tr -d "\n")
+if git diff-index --name-only HEAD &>/dev/null ; then
+       dirty=-dirty
+fi
+
+echo -n "'${repo}' (${hash}${dirty})"
-- 
2.1.4

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to