osmith submitted this change.

View Change

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

Related: OS#6626
Change-Id: I5087a677ef8117a6556942dcf1ff3915b107eb37
---
M .gitignore
M include/Makefile.am
A include/osmocom/e1d/version.h.tpl
A include/osmocom/octoi/version.h.tpl
4 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4d83803..42158c0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,3 +52,5 @@
tests/testsuite.log
tests/testsuite.dir
tests/*/*_test
+
+include/osmocom/*/version.h
diff --git a/include/Makefile.am b/include/Makefile.am
index a736481..ce33860 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,7 +1,18 @@
+osmocom/%/version.h: osmocom/%/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" \
+ $< > $@
+
nobase_include_HEADERS = \
osmocom/e1d/proto.h \
osmocom/e1d/proto_clnt.h \
osmocom/e1d/proto_srv.h \
+ osmocom/e1d/version.h \
osmocom/octoi/e1oip_proto.h \
osmocom/octoi/octoi.h \
+ osmocom/octoi/version.h \
$(NULL)
diff --git a/include/osmocom/e1d/version.h.tpl b/include/osmocom/e1d/version.h.tpl
new file mode 100644
index 0000000..a84b38a
--- /dev/null
+++ b/include/osmocom/e1d/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_E1D_VERSION {{VERSION}}
+#define LIBOSMO_E1D_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_E1D_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_E1D_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_E1D_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_E1D_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_E1D_VERSION_MAJOR > (major) || \
+ (LIBOSMO_E1D_VERSION_MAJOR == (major) && \
+ LIBOSMO_E1D_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_E1D_VERSION_MAJOR == (major) && \
+ LIBOSMO_E1D_VERSION_MINOR == (minor) && \
+ LIBOSMO_E1D_VERSION_PATCH >= (patch)))
diff --git a/include/osmocom/octoi/version.h.tpl b/include/osmocom/octoi/version.h.tpl
new file mode 100644
index 0000000..fa81278
--- /dev/null
+++ b/include/osmocom/octoi/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_OCTOI_VERSION {{VERSION}}
+#define LIBOSMO_OCTOI_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_OCTOI_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_OCTOI_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_OCTOI_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_OCTOI_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_OCTOI_VERSION_MAJOR > (major) || \
+ (LIBOSMO_OCTOI_VERSION_MAJOR == (major) && \
+ LIBOSMO_OCTOI_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_OCTOI_VERSION_MAJOR == (major) && \
+ LIBOSMO_OCTOI_VERSION_MINOR == (minor) && \
+ LIBOSMO_OCTOI_VERSION_PATCH >= (patch)))

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

Gerrit-MessageType: merged
Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I5087a677ef8117a6556942dcf1ff3915b107eb37
Gerrit-Change-Number: 40518
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge@osmocom.org>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>