osmith has submitted this change. ( 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, 32 insertions(+), 2 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
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..8657d58 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,10 +54,14 @@ 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 + libusb_types.h.in \ + version.h.tpl \ + $(NULL)
swiginclude_HEADERS = \ db_base.i 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)))