osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-hlr/+/40513?usp=email )


Change subject: Generate version.h files
......................................................................

Generate version.h files

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



  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/13/40513/1

diff --git a/.gitignore b/.gitignore
index 6c8e9b9..725d280 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,3 +86,5 @@
 /debian/osmo-mslookup-utils/
 /debian/*.log
 /debian/*.substvars
+
+include/osmocom/*/version.h
diff --git a/include/Makefile.am b/include/Makefile.am
index f3baca6..8a5e8ed 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,14 +1,25 @@
 SUBDIRS = osmocom

+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/gsupclient/cni_peer_id.h \
        osmocom/gsupclient/gsup_client.h \
        osmocom/gsupclient/gsup_client_mux.h \
        osmocom/gsupclient/gsup_req.h \
+       osmocom/gsupclient/version.h \
        osmocom/mslookup/mdns.h \
        osmocom/mslookup/mdns_sock.h \
        osmocom/mslookup/mslookup_client_fake.h \
        osmocom/mslookup/mslookup_client.h \
        osmocom/mslookup/mslookup_client_mdns.h \
        osmocom/mslookup/mslookup.h \
+       osmocom/mslookup/version.h \
        $(NULL)
diff --git a/include/osmocom/gsupclient/version.h.tpl 
b/include/osmocom/gsupclient/version.h.tpl
new file mode 100644
index 0000000..eb8805c
--- /dev/null
+++ b/include/osmocom/gsupclient/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_GSUP_CLIENT_VERSION {{VERSION}}
+#define LIBOSMO_GSUP_CLIENT_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_GSUP_CLIENT_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_GSUP_CLIENT_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_GSUP_CLIENT_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_GSUP_CLIENT_VERSION_GREATER_EQUAL(major, minor, patch) \
+       (LIBOSMO_GSUP_CLIENT_VERSION_MAJOR > (major) || \
+        (LIBOSMO_GSUP_CLIENT_VERSION_MAJOR == (major) && \
+         LIBOSMO_GSUP_CLIENT_VERSION_MINOR > (minor)) || \
+        (LIBOSMO_GSUP_CLIENT_VERSION_MAJOR == (major) && \
+         LIBOSMO_GSUP_CLIENT_VERSION_MINOR == (minor) && \
+         LIBOSMO_GSUP_CLIENT_VERSION_PATCH >= (patch)))
diff --git a/include/osmocom/mslookup/version.h.tpl 
b/include/osmocom/mslookup/version.h.tpl
new file mode 100644
index 0000000..c6daf87
--- /dev/null
+++ b/include/osmocom/mslookup/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBOSMO_MSLOOKUP_VERSION {{VERSION}}
+#define LIBOSMO_MSLOOKUP_VERSION_STR "{{VERSION}}"
+
+#define LIBOSMO_MSLOOKUP_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBOSMO_MSLOOKUP_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBOSMO_MSLOOKUP_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBOSMO_MSLOOKUP_VERSION_GREATER_EQUAL(major, minor, patch) \
+       (LIBOSMO_MSLOOKUP_VERSION_MAJOR > (major) || \
+        (LIBOSMO_MSLOOKUP_VERSION_MAJOR == (major) && \
+         LIBOSMO_MSLOOKUP_VERSION_MINOR > (minor)) || \
+        (LIBOSMO_MSLOOKUP_VERSION_MAJOR == (major) && \
+         LIBOSMO_MSLOOKUP_VERSION_MINOR == (minor) && \
+         LIBOSMO_MSLOOKUP_VERSION_PATCH >= (patch)))

--
To view, visit https://gerrit.osmocom.org/c/osmo-hlr/+/40513?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Change-Id: I716821b2426c28fc2500fa8cdf44b7b8cb339d65
Gerrit-Change-Number: 40513
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osm...@sysmocom.de>

Reply via email to