osmith has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/40503?usp=email )
Change subject: Generate a version.h file ......................................................................
Generate a version.h file
Related: OS#6626 Change-Id: I7fc28a976c922caa29f4e5b3832cdd743c939fa3 --- M .gitignore M include/Makefile.am A include/osmocom/abis/version.h.tpl 3 files changed, 31 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/.gitignore b/.gitignore index 80e6834..ee4b9f8 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,4 @@ *.sw?
contrib/libosmo-abis.spec +include/osmocom/abis/version.h diff --git a/include/Makefile.am b/include/Makefile.am index 0e53031..16c61a5 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,5 +1,18 @@ noinst_HEADERS=mISDNif.h internal.h
+osmocom/abis/version.h: osmocom/abis/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" \ + $< > $@ + +EXTRA_DIST = \ + osmocom/abis/version.h.tpl \ + $(NULL) + nobase_include_HEADERS = \ osmocom/abis/abis.h \ osmocom/abis/e1_input.h \ @@ -10,6 +23,7 @@ osmocom/abis/subchan_demux.h \ osmocom/abis/trau_frame.h \ osmocom/abis/unixsocket_proto.h \ + osmocom/abis/version.h \ osmocom/trau/csd_ra2.h \ osmocom/trau/csd_raa_prime.h \ osmocom/trau/trau_frame.h \ diff --git a/include/osmocom/abis/version.h.tpl b/include/osmocom/abis/version.h.tpl new file mode 100644 index 0000000..87f0ccf --- /dev/null +++ b/include/osmocom/abis/version.h.tpl @@ -0,0 +1,16 @@ +#pragma once + +#define LIBOSMO_ABIS_VERSION {{VERSION}} +#define LIBOSMO_ABIS_VERSION_STR "{{VERSION}}" + +#define LIBOSMO_ABIS_VERSION_MAJOR {{VERSION_MAJOR}} +#define LIBOSMO_ABIS_VERSION_MINOR {{VERSION_MINOR}} +#define LIBOSMO_ABIS_VERSION_PATCH {{VERSION_PATCH}} + +#define LIBOSMO_ABIS_VERSION_GREATER_EQUAL(major, minor, patch) \ + (LIBOSMO_ABIS_VERSION_MAJOR > (major) || \ + (LIBOSMO_ABIS_VERSION_MAJOR == (major) && \ + LIBOSMO_ABIS_VERSION_MINOR > (minor)) || \ + (LIBOSMO_ABIS_VERSION_MAJOR == (major) && \ + LIBOSMO_ABIS_VERSION_MINOR == (minor) && \ + LIBOSMO_ABIS_VERSION_PATCH >= (patch)))