osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/40520?usp=email )
Change subject: Generate a version.h file ......................................................................
Generate a version.h file
Related: OS#6626 Change-Id: Ia894a9d9a20e343755d8060822d33b8a1c59b4db --- M .gitignore M host/include/Makefile.am A host/include/osmocom/simtrace2/version.h.tpl 3 files changed, 28 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/20/40520/1
diff --git a/.gitignore b/.gitignore index f8f1139..0a86b0d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,5 @@ usb_strings_generated.h firmware/usbstring/usbstring firmware/apps/*/usb_strings.txt.patched -firmware/misc/crctool \ No newline at end of file +firmware/misc/crctool +host/include/osmocom/simtrace2/version.h diff --git a/host/include/Makefile.am b/host/include/Makefile.am index 60134f3..3a9722c 100644 --- a/host/include/Makefile.am +++ b/host/include/Makefile.am @@ -1,3 +1,12 @@ +osmocom/simtrace2/version.h: osmocom/simtrace2/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/simtrace2/apdu_dispatch.h \ osmocom/simtrace2/simtrace2_api.h \ @@ -5,4 +14,5 @@ osmocom/simtrace2/simtrace_prot.h \ osmocom/simtrace2/usb_util.h \ osmocom/simtrace2/gsmtap.h \ + osmocom/simtrace2/version.h \ $(NULL) diff --git a/host/include/osmocom/simtrace2/version.h.tpl b/host/include/osmocom/simtrace2/version.h.tpl new file mode 100644 index 0000000..14f965f --- /dev/null +++ b/host/include/osmocom/simtrace2/version.h.tpl @@ -0,0 +1,16 @@ +#pragma once + +#define LIBOSMO_SIMTRACE2_VERSION {{VERSION}} +#define LIBOSMO_SIMTRACE2_VERSION_STR "{{VERSION}}" + +#define LIBOSMO_SIMTRACE2_VERSION_MAJOR {{VERSION_MAJOR}} +#define LIBOSMO_SIMTRACE2_VERSION_MINOR {{VERSION_MINOR}} +#define LIBOSMO_SIMTRACE2_VERSION_PATCH {{VERSION_PATCH}} + +#define LIBOSMO_SIMTRACE2_VERSION_GREATER_EQUAL(major, minor, patch) \ + (LIBOSMO_SIMTRACE2_VERSION_MAJOR > (major) || \ + (LIBOSMO_SIMTRACE2_VERSION_MAJOR == (major) && \ + LIBOSMO_SIMTRACE2_VERSION_MINOR > (minor)) || \ + (LIBOSMO_SIMTRACE2_VERSION_MAJOR == (major) && \ + LIBOSMO_SIMTRACE2_VERSION_MINOR == (minor) && \ + LIBOSMO_SIMTRACE2_VERSION_PATCH >= (patch)))