laforge submitted this change.
Generate a version.h file
Related: OS#6626
Change-Id: I2ee394086af3ccf0ec789e2cba627054c09fe1cd
---
M .gitignore
M include/osmocom/tcap/Makefile.am
A include/osmocom/tcap/version.h.tpl
3 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 965bae4..50e7d67 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,4 @@
.deps
.libs
.version
+include/osmocom/tcap/version.h
diff --git a/include/osmocom/tcap/Makefile.am b/include/osmocom/tcap/Makefile.am
index 2b73bb6..d0a425a 100644
--- a/include/osmocom/tcap/Makefile.am
+++ b/include/osmocom/tcap/Makefile.am
@@ -78,9 +78,27 @@
TCAP_asn_constant.h \
$(NULL)
+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_tcap_HEADERS = \
$(SKEL_HEADER_FILES) \
$(GEN_HEADER_FILES) \
+ version.h \
$(NULL)
osmo_asn1_tcapdir = $(includedir)/osmocom/tcap
diff --git a/include/osmocom/tcap/version.h.tpl b/include/osmocom/tcap/version.h.tpl
new file mode 100644
index 0000000..5c7b455
--- /dev/null
+++ b/include/osmocom/tcap/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 change 41027. To unsubscribe, or for help writing mail filters, visit settings.