osmith submitted this change.

View Change

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

Related: OS#6626
Change-Id: Icf0319d4b7c27f80a696cb951aa40e2add64749b
---
M .gitignore
M include/osmocom/csn1/Makefile.am
A include/osmocom/csn1/version.h.tpl
M include/osmocom/gprs/gmm/Makefile.am
A include/osmocom/gprs/gmm/version.h.tpl
M include/osmocom/gprs/llc/Makefile.am
A include/osmocom/gprs/llc/version.h.tpl
M include/osmocom/gprs/rlcmac/Makefile.am
A include/osmocom/gprs/rlcmac/version.h.tpl
M include/osmocom/gprs/sm/Makefile.am
A include/osmocom/gprs/sm/version.h.tpl
M include/osmocom/gprs/sndcp/Makefile.am
A include/osmocom/gprs/sndcp/version.h.tpl
13 files changed, 181 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 020b541..93b84ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,3 +48,4 @@
/deps

contrib/libosmo-gprs.spec
+include/osmocom/**/version.h
diff --git a/include/osmocom/csn1/Makefile.am b/include/osmocom/csn1/Makefile.am
index d16b724..6fd59e3 100644
--- a/include/osmocom/csn1/Makefile.am
+++ b/include/osmocom/csn1/Makefile.am
@@ -1,6 +1,20 @@
+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" \
+ $< > $@
+
+EXTRA_DIST = \
+ version.h.tpl \
+ $(NULL)
+
csn1_HEADERS = \
wireshark_compat.h \
csn1.h \
+ version.h \
$(NULL)

csn1dir = $(includedir)/osmocom/csn1
diff --git a/include/osmocom/csn1/version.h.tpl b/include/osmocom/csn1/version.h.tpl
new file mode 100644
index 0000000..2f90851
--- /dev/null
+++ b/include/osmocom/csn1/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_CSN1_VERSION {{VERSION}}
+#define LIBOSMO_CSN1_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_CSN1_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_CSN1_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_CSN1_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_CSN1_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_CSN1_VERSION_MAJOR > (major) || \
+ (LIBOSMO_CSN1_VERSION_MAJOR == (major) && \
+ LIBOSMO_CSN1_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_CSN1_VERSION_MAJOR == (major) && \
+ LIBOSMO_CSN1_VERSION_MINOR == (minor) && \
+ LIBOSMO_CSN1_VERSION_PATCH >= (patch)))
diff --git a/include/osmocom/gprs/gmm/Makefile.am b/include/osmocom/gprs/gmm/Makefile.am
index 2adfed1..b1e6010 100644
--- a/include/osmocom/gprs/gmm/Makefile.am
+++ b/include/osmocom/gprs/gmm/Makefile.am
@@ -1,13 +1,26 @@
-
noinst_HEADERS = \
gmm_ms_fsm.h \
gmm_private.h \
gmm_pdu.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" \
+ $< > $@
+
+EXTRA_DIST = \
+ version.h.tpl \
+ $(NULL)
+
gmm_HEADERS = \
gmm.h \
gmm_prim.h \
+ version.h \
$(NULL)

gmmdir = $(includedir)/osmocom/gprs/gmm
diff --git a/include/osmocom/gprs/gmm/version.h.tpl b/include/osmocom/gprs/gmm/version.h.tpl
new file mode 100644
index 0000000..f6135ff
--- /dev/null
+++ b/include/osmocom/gprs/gmm/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_GPRS_GMM_VERSION {{VERSION}}
+#define LIBOSMO_GPRS_GMM_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_GPRS_GMM_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_GPRS_GMM_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_GPRS_GMM_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_GPRS_GMM_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_GPRS_GMM_VERSION_MAJOR > (major) || \
+ (LIBOSMO_GPRS_GMM_VERSION_MAJOR == (major) && \
+ LIBOSMO_GPRS_GMM_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_GPRS_GMM_VERSION_MAJOR == (major) && \
+ LIBOSMO_GPRS_GMM_VERSION_MINOR == (minor) && \
+ LIBOSMO_GPRS_GMM_VERSION_PATCH >= (patch)))
diff --git a/include/osmocom/gprs/llc/Makefile.am b/include/osmocom/gprs/llc/Makefile.am
index df56a08..c20c7cc 100644
--- a/include/osmocom/gprs/llc/Makefile.am
+++ b/include/osmocom/gprs/llc/Makefile.am
@@ -2,9 +2,23 @@
llc_private.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" \
+ $< > $@
+
+EXTRA_DIST = \
+ version.h.tpl \
+ $(NULL)
+
llc_HEADERS = \
llc.h \
llc_prim.h \
+ version.h \
$(NULL)

llcdir = $(includedir)/osmocom/gprs/llc
diff --git a/include/osmocom/gprs/llc/version.h.tpl b/include/osmocom/gprs/llc/version.h.tpl
new file mode 100644
index 0000000..dcae17d
--- /dev/null
+++ b/include/osmocom/gprs/llc/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_GPRS_LLC_VERSION {{VERSION}}
+#define LIBOSMO_GPRS_LLC_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_GPRS_LLC_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_GPRS_LLC_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_GPRS_LLC_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_GPRS_LLC_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_GPRS_LLC_VERSION_MAJOR > (major) || \
+ (LIBOSMO_GPRS_LLC_VERSION_MAJOR == (major) && \
+ LIBOSMO_GPRS_LLC_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_GPRS_LLC_VERSION_MAJOR == (major) && \
+ LIBOSMO_GPRS_LLC_VERSION_MINOR == (minor) && \
+ LIBOSMO_GPRS_LLC_VERSION_PATCH >= (patch)))
diff --git a/include/osmocom/gprs/rlcmac/Makefile.am b/include/osmocom/gprs/rlcmac/Makefile.am
index a117a34..5b71d85 100644
--- a/include/osmocom/gprs/rlcmac/Makefile.am
+++ b/include/osmocom/gprs/rlcmac/Makefile.am
@@ -22,11 +22,25 @@
types_private.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" \
+ $< > $@
+
+EXTRA_DIST = \
+ version.h.tpl \
+ $(NULL)
+
rlcmac_HEADERS = \
csn1_defs.h \
rlcmac.h \
rlcmac_prim.h \
types.h \
+ version.h \
$(NULL)

rlcmacdir = $(includedir)/osmocom/gprs/rlcmac
diff --git a/include/osmocom/gprs/rlcmac/version.h.tpl b/include/osmocom/gprs/rlcmac/version.h.tpl
new file mode 100644
index 0000000..16776bd
--- /dev/null
+++ b/include/osmocom/gprs/rlcmac/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_GPRS_RLCMAC_VERSION {{VERSION}}
+#define LIBOSMO_GPRS_RLCMAC_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_GPRS_RLCMAC_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_GPRS_RLCMAC_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_GPRS_RLCMAC_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_GPRS_RLCMAC_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_GPRS_RLCMAC_VERSION_MAJOR > (major) || \
+ (LIBOSMO_GPRS_RLCMAC_VERSION_MAJOR == (major) && \
+ LIBOSMO_GPRS_RLCMAC_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_GPRS_RLCMAC_VERSION_MAJOR == (major) && \
+ LIBOSMO_GPRS_RLCMAC_VERSION_MINOR == (minor) && \
+ LIBOSMO_GPRS_RLCMAC_VERSION_PATCH >= (patch)))
diff --git a/include/osmocom/gprs/sm/Makefile.am b/include/osmocom/gprs/sm/Makefile.am
index f6bede4..cf0c072 100644
--- a/include/osmocom/gprs/sm/Makefile.am
+++ b/include/osmocom/gprs/sm/Makefile.am
@@ -1,14 +1,27 @@
-
noinst_HEADERS = \
sm_ms_fsm.h \
sm_pdu.h \
sm_private.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" \
+ $< > $@
+
+EXTRA_DIST = \
+ version.h.tpl \
+ $(NULL)
+
sm_HEADERS = \
sm.h \
sm_prim.h \
sm_qos.h \
+ version.h \
$(NULL)

smdir = $(includedir)/osmocom/gprs/sm
diff --git a/include/osmocom/gprs/sm/version.h.tpl b/include/osmocom/gprs/sm/version.h.tpl
new file mode 100644
index 0000000..ea4ad50
--- /dev/null
+++ b/include/osmocom/gprs/sm/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_GPRS_SM_VERSION {{VERSION}}
+#define LIBOSMO_GPRS_SM_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_GPRS_SM_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_GPRS_SM_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_GPRS_SM_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_GPRS_SM_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_GPRS_SM_VERSION_MAJOR > (major) || \
+ (LIBOSMO_GPRS_SM_VERSION_MAJOR == (major) && \
+ LIBOSMO_GPRS_SM_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_GPRS_SM_VERSION_MAJOR == (major) && \
+ LIBOSMO_GPRS_SM_VERSION_MINOR == (minor) && \
+ LIBOSMO_GPRS_SM_VERSION_PATCH >= (patch)))
diff --git a/include/osmocom/gprs/sndcp/Makefile.am b/include/osmocom/gprs/sndcp/Makefile.am
index 0546475..b19e214 100644
--- a/include/osmocom/gprs/sndcp/Makefile.am
+++ b/include/osmocom/gprs/sndcp/Makefile.am
@@ -1,4 +1,3 @@
-
noinst_HEADERS = \
comp.h \
dcomp.h \
@@ -10,9 +9,23 @@
v42bis_private.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" \
+ $< > $@
+
+EXTRA_DIST = \
+ version.h.tpl \
+ $(NULL)
+
sndcp_HEADERS = \
sndcp.h \
sndcp_prim.h \
+ version.h \
$(NULL)

sndcpdir = $(includedir)/osmocom/gprs/sndcp
diff --git a/include/osmocom/gprs/sndcp/version.h.tpl b/include/osmocom/gprs/sndcp/version.h.tpl
new file mode 100644
index 0000000..16b2ca5
--- /dev/null
+++ b/include/osmocom/gprs/sndcp/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_GPRS_SNDCP_VERSION {{VERSION}}
+#define LIBOSMO_GPRS_SNDCP_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_GPRS_SNDCP_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_GPRS_SNDCP_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_GPRS_SNDCP_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_GPRS_SNDCP_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBOSMO_GPRS_SNDCP_VERSION_MAJOR > (major) || \
+ (LIBOSMO_GPRS_SNDCP_VERSION_MAJOR == (major) && \
+ LIBOSMO_GPRS_SNDCP_VERSION_MINOR > (minor)) || \
+ (LIBOSMO_GPRS_SNDCP_VERSION_MAJOR == (major) && \
+ LIBOSMO_GPRS_SNDCP_VERSION_MINOR == (minor) && \
+ LIBOSMO_GPRS_SNDCP_VERSION_PATCH >= (patch)))

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

Gerrit-MessageType: merged
Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: Icf0319d4b7c27f80a696cb951aa40e2add64749b
Gerrit-Change-Number: 40508
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>