osmith has uploaded this change for review. (
https://gerrit.osmocom.org/c/libgtpnl/+/40511?usp=email )
Change subject: Generate a version.h file
......................................................................
Generate a version.h file
Related: OS#6626
Change-Id: I7761491ae767f1f21b2a3bba62d9ecb8a7d1226b
---
M .gitignore
M include/libgtpnl/Makefile.am
A include/libgtpnl/version.h.tpl
3 files changed, 28 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libgtpnl refs/changes/11/40511/1
diff --git a/.gitignore b/.gitignore
index 56eefa6..c5757f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,5 @@
tools/gtp-tunnel
tests/qemu/_*
+
+include/libgtpnl/version.h
diff --git a/include/libgtpnl/Makefile.am b/include/libgtpnl/Makefile.am
index 90b0a2e..f17f9d1 100644
--- a/include/libgtpnl/Makefile.am
+++ b/include/libgtpnl/Makefile.am
@@ -1,4 +1,14 @@
+version.h: version.h.tpl
+ $(AM_V_GEN)$(MKDIR_P) $(dir $@)
+ $(AM_V_GEN)sed \
+ -e "s/{{VERSION}}/$$(echo '@VERSION@' | cut -d. -f1-3)/g" \
+ -e "s/{{VERSION_MAJOR}}/$$(echo '@VERSION@' | cut -d. -f1)/g" \
+ -e "s/{{VERSION_MINOR}}/$$(echo '@VERSION@' | cut -d. -f2)/g" \
+ -e "s/{{VERSION_PATCH}}/$$(echo '@VERSION@' | cut -d. -f3)/g" \
+ $< > $@
+
pkginclude_HEADERS = \
gtp.h \
gtpnl.h \
+ version.h \
$(NULL)
diff --git a/include/libgtpnl/version.h.tpl b/include/libgtpnl/version.h.tpl
new file mode 100644
index 0000000..0a5a209
--- /dev/null
+++ b/include/libgtpnl/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBGTPNL_VERSION {{VERSION}}
+#define LIBGTPNL_VERSION_STR "{{VERSION}}"
+
+#define LIBGTPNL_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBGTPNL_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBGTPNL_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBGTPNL_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBGTPNL_VERSION_MAJOR > (major) || \
+ (LIBGTPNL_VERSION_MAJOR == (major) && \
+ LIBGTPNL_VERSION_MINOR > (minor)) || \
+ (LIBGTPNL_VERSION_MAJOR == (major) && \
+ LIBGTPNL_VERSION_MINOR == (minor) && \
+ LIBGTPNL_VERSION_PATCH >= (patch)))
--
To view, visit
https://gerrit.osmocom.org/c/libgtpnl/+/40511?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libgtpnl
Gerrit-Branch: master
Gerrit-Change-Id: I7761491ae767f1f21b2a3bba62d9ecb8a7d1226b
Gerrit-Change-Number: 40511
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>