osmith has uploaded this change for review. (
https://gerrit.osmocom.org/c/libusrp/+/40512?usp=email )
Change subject: Generate a version.h file
......................................................................
Generate a version.h file
Related: OS#6626
Change-Id: Ibb9a4fb34beabaca322031e9bde3646385591f3a
---
M .gitignore
M host/include/usrp/Makefile.am
A host/include/usrp/version.h.tpl
3 files changed, 29 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libusrp refs/changes/12/40512/1
diff --git a/.gitignore b/.gitignore
index 576da6d..f83ba42 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,4 @@
contrib/libusrp.spec
/.version
+/host/include/usrp/version.h
diff --git a/host/include/usrp/Makefile.am b/host/include/usrp/Makefile.am
index 1950431..d0e0fe6 100644
--- a/host/include/usrp/Makefile.am
+++ b/host/include/usrp/Makefile.am
@@ -23,6 +23,15 @@
usrpincludedir = $(includedir)/usrp
+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" \
+ $< > $@
+
usrpinclude_HEADERS = \
db_base.h \
db_basic.h \
@@ -45,7 +54,9 @@
usrp_slots.h \
usrp_standard.h \
usrp_subdev_spec.h \
- usrp_tune_result.h
+ usrp_tune_result.h \
+ version.h \
+ $(NULL)
EXTRA_DIST += \
libusb_types.h.in
diff --git a/host/include/usrp/version.h.tpl b/host/include/usrp/version.h.tpl
new file mode 100644
index 0000000..7bed445
--- /dev/null
+++ b/host/include/usrp/version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBUSRP_VERSION {{VERSION}}
+#define LIBUSRP_VERSION_STR "{{VERSION}}"
+
+#define LIBUSRP_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBUSRP_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBUSRP_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBUSRP_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBUSRP_VERSION_MAJOR > (major) || \
+ (LIBUSRP_VERSION_MAJOR == (major) && \
+ LIBUSRP_VERSION_MINOR > (minor)) || \
+ (LIBUSRP_VERSION_MAJOR == (major) && \
+ LIBUSRP_VERSION_MINOR == (minor) && \
+ LIBUSRP_VERSION_PATCH >= (patch)))
--
To view, visit
https://gerrit.osmocom.org/c/libusrp/+/40512?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libusrp
Gerrit-Branch: master
Gerrit-Change-Id: Ibb9a4fb34beabaca322031e9bde3646385591f3a
Gerrit-Change-Number: 40512
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>