osmith submitted this change.

View Change

Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
Generate a version.h file

Related: OS#6626
Change-Id: I7fc28a976c922caa29f4e5b3832cdd743c939fa3
---
M .gitignore
M include/Makefile.am
A include/osmocom/abis/version.h.tpl
3 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 80e6834..ee4b9f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,3 +54,4 @@
*.sw?

contrib/libosmo-abis.spec
+include/osmocom/abis/version.h
diff --git a/include/Makefile.am b/include/Makefile.am
index 0e53031..16c61a5 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,5 +1,18 @@
noinst_HEADERS=mISDNif.h internal.h

+osmocom/abis/version.h: osmocom/abis/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" \
+ $< > $@
+
+EXTRA_DIST = \
+ osmocom/abis/version.h.tpl \
+ $(NULL)
+
nobase_include_HEADERS = \
osmocom/abis/abis.h \
osmocom/abis/e1_input.h \
@@ -10,6 +23,7 @@
osmocom/abis/subchan_demux.h \
osmocom/abis/trau_frame.h \
osmocom/abis/unixsocket_proto.h \
+ osmocom/abis/version.h \
osmocom/trau/csd_ra2.h \
osmocom/trau/csd_raa_prime.h \
osmocom/trau/trau_frame.h \
diff --git a/include/osmocom/abis/version.h.tpl b/include/osmocom/abis/version.h.tpl
new file mode 100644
index 0000000..87f0ccf
--- /dev/null
+++ b/include/osmocom/abis/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_ABIS_VERSION {{VERSION}}
+#define LIBOSMO_ABIS_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_ABIS_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_ABIS_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_ABIS_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_ABIS_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_ABIS_VERSION_MAJOR > (major) || \
+ (LIBOSMO_ABIS_VERSION_MAJOR == (major) && \
+ LIBOSMO_ABIS_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_ABIS_VERSION_MAJOR == (major) && \
+ LIBOSMO_ABIS_VERSION_MINOR == (minor) && \
+ LIBOSMO_ABIS_VERSION_PATCH >= (patch)))

To view, visit change 40503. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I7fc28a976c922caa29f4e5b3832cdd743c939fa3
Gerrit-Change-Number: 40503
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>