osmith has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-asn1-tcap/+/41027?usp=email )
Change subject: Generate a version.h file
......................................................................
Generate a version.h file
Related: OS#6626
Change-Id: I2ee394086af3ccf0ec789e2cba627054c09fe1cd
---
M .gitignore
M include/Makefile.am
A include/version.h.tpl
3 files changed, 38 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-asn1-tcap refs/changes/27/41027/1
diff --git a/.gitignore b/.gitignore
index e9d5b47..4fa7f3c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,4 @@
*.pc
.deps
.libs
+include/version.h
diff --git a/include/Makefile.am b/include/Makefile.am
index afcbf1b..19e5a23 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -72,6 +72,25 @@
GraphicString.h \
ReturnError.h \
ber_tlv_tag.h \
- asn_ioc.h
+ asn_ioc.h \
+ version.h \
+ $(NULL)
-osmo_asn1_tcapdir = $(includedir)/osmocom/tcap
\ No newline at end of file
+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" \
+ $< > $@
+
+BUILT_SOURCES = \
+ version.h \
+ $(NULL)
+
+EXTRA_DIST = \
+ version.h.tpl \
+ $(NULL)
+
+osmo_asn1_tcapdir = $(includedir)/osmocom/tcap
diff --git a/include/version.h.tpl b/include/version.h.tpl
new file mode 100644
index 0000000..5c7b455
--- /dev/null
+++ b/include/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_ASN1_TCAP_VERSION {{VERSION}}
+#define LIBOSMO_ASN1_TCAP_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_ASN1_TCAP_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_ASN1_TCAP_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_ASN1_TCAP_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_ASN1_TCAP_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_ASN1_TCAP_VERSION_MAJOR > (major) || \
+ (LIBOSMO_ASN1_TCAP_VERSION_MAJOR == (major) && \
+ LIBOSMO_ASN1_TCAP_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_ASN1_TCAP_VERSION_MAJOR == (major) && \
+ LIBOSMO_ASN1_TCAP_VERSION_MINOR == (minor) && \
+ LIBOSMO_ASN1_TCAP_VERSION_PATCH >= (patch)))
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-asn1-tcap/+/41027?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-asn1-tcap
Gerrit-Branch: master
Gerrit-Change-Id: I2ee394086af3ccf0ec789e2cba627054c09fe1cd
Gerrit-Change-Number: 41027
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>