osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sigtran/+/40504?usp=email )
Change subject: Generate a version.h file ......................................................................
Generate a version.h file
Related: OS#6626 Change-Id: I7b010b3815845fe49d105bc8bf3295707104923d --- M .gitignore M include/osmocom/sigtran/Makefile.am A include/osmocom/sigtran/version.h.tpl 3 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/04/40504/1
diff --git a/.gitignore b/.gitignore index 67685b4..99cb052 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,4 @@ doc/sigtran
contrib/libosmo-sccp.spec +include/osmocom/sigtran/version.h diff --git a/include/osmocom/sigtran/Makefile.am b/include/osmocom/sigtran/Makefile.am index 69895bc..5be57ec 100644 --- a/include/osmocom/sigtran/Makefile.am +++ b/include/osmocom/sigtran/Makefile.am @@ -1,3 +1,12 @@ +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" \ + $< > $@ + sigtran_HEADERS = \ mtp_sap.h \ osmo_ss7.h \ @@ -5,6 +14,7 @@ sccp_sap.h \ sigtran_sap.h \ xua_msg.h \ + version.h \ $(NULL)
sigtrandir = $(includedir)/osmocom/sigtran diff --git a/include/osmocom/sigtran/version.h.tpl b/include/osmocom/sigtran/version.h.tpl new file mode 100644 index 0000000..34b9cb1 --- /dev/null +++ b/include/osmocom/sigtran/version.h.tpl @@ -0,0 +1,16 @@ +#pragma once + +#define LIBOSMO_SIGTRAN_VERSION {{VERSION}} +#define LIBOSMO_SIGTRAN_VERSION_STR "{{VERSION}}" + +#define LIBOSMO_SIGTRAN_VERSION_MAJOR {{VERSION_MAJOR}} +#define LIBOSMO_SIGTRAN_VERSION_MINOR {{VERSION_MINOR}} +#define LIBOSMO_SIGTRAN_VERSION_PATCH {{VERSION_PATCH}} + +#define LIBOSMO_SIGTRAN_VERSION_GREATER_EQUAL(major, minor, patch) \ + (LIBOSMO_SIGTRAN_VERSION_MAJOR > (major) || \ + (LIBOSMO_SIGTRAN_VERSION_MAJOR == (major) && \ + LIBOSMO_SIGTRAN_VERSION_MINOR > (minor)) || \ + (LIBOSMO_SIGTRAN_VERSION_MAJOR == (major) && \ + LIBOSMO_SIGTRAN_VERSION_MINOR == (minor) && \ + LIBOSMO_SIGTRAN_VERSION_PATCH >= (patch)))