osmith has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-cbc/+/40516?usp=email )
Change subject: Generate a version.h file
......................................................................
Generate a version.h file
Related: OS#6626
Change-Id: Ia4ccdc833b95cd60fc27e7d73b55c99c1a0a8d7d
---
M .gitignore
M include/osmocom/sbcap/Makefile.am
A include/osmocom/sbcap/version.h.tpl
3 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-cbc refs/changes/16/40516/1
diff --git a/.gitignore b/.gitignore
index 7f8336d..d8ffce0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,3 +62,4 @@
contrib/osmo-cbc.spec
libosmo-sbcap.pc
+include/osmocom/sbcap/version.h
diff --git a/include/osmocom/sbcap/Makefile.am b/include/osmocom/sbcap/Makefile.am
index cc994eb..295f2e7 100644
--- a/include/osmocom/sbcap/Makefile.am
+++ b/include/osmocom/sbcap/Makefile.am
@@ -1,3 +1,12 @@
+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" \
+ $< > $@
+
sbcap_HEADERS = \
sbcap_common.h \
sbcap_internal.h \
@@ -115,6 +124,7 @@
SBcAP_Write-Replace-Warning-Indication.h \
SBcAP_Write-Replace-Warning-Request.h \
SBcAP_Write-Replace-Warning-Response.h \
+ version.h \
$(NULL)
sbcapdir = $(includedir)/osmocom/sbcap
diff --git a/include/osmocom/sbcap/version.h.tpl b/include/osmocom/sbcap/version.h.tpl
new file mode 100644
index 0000000..40c554f
--- /dev/null
+++ b/include/osmocom/sbcap/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_SBCAP_VERSION {{VERSION}}
+#define LIBOSMO_SBCAP_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_SBCAP_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_SBCAP_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_SBCAP_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_SBCAP_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_SBCAP_VERSION_MAJOR > (major) || \
+ (LIBOSMO_SBCAP_VERSION_MAJOR == (major) && \
+ LIBOSMO_SBCAP_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_SBCAP_VERSION_MAJOR == (major) && \
+ LIBOSMO_SBCAP_VERSION_MINOR == (minor) && \
+ LIBOSMO_SBCAP_VERSION_PATCH >= (patch)))
--
To view, visit
https://gerrit.osmocom.org/c/osmo-cbc/+/40516?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: Ia4ccdc833b95cd60fc27e7d73b55c99c1a0a8d7d
Gerrit-Change-Number: 40516
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>