osmith has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/40506?usp=email )
Change subject: Generate a version.h file ......................................................................
Generate a version.h file
Related: OS#6626 Change-Id: I764d2dce1305441b353d4f9315b57cbaeb8b873e --- M .gitignore M include/osmocom/netif/Makefile.am A include/osmocom/netif/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 fd14f41..74848f5 100644 --- a/.gitignore +++ b/.gitignore @@ -63,3 +63,4 @@ amr_test
contrib/libosmo-netif.spec +include/osmocom/netif/version.h diff --git a/include/osmocom/netif/Makefile.am b/include/osmocom/netif/Makefile.am index 5c10d71..3771859 100644 --- a/include/osmocom/netif/Makefile.am +++ b/include/osmocom/netif/Makefile.am @@ -2,6 +2,19 @@ stream_private.h \ $(NULL)
+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" \ + $< > $@ + +EXTRA_DIST = \ + version.h.tpl \ + $(NULL) + osmonetif_HEADERS = \ amr.h \ datagram.h \ @@ -13,6 +26,7 @@ rs232.h \ rtp.h \ stream.h \ + version.h \ $(NULL)
if ENABLE_LIBSCTP diff --git a/include/osmocom/netif/version.h.tpl b/include/osmocom/netif/version.h.tpl new file mode 100644 index 0000000..289ecbd --- /dev/null +++ b/include/osmocom/netif/version.h.tpl @@ -0,0 +1,16 @@ +#pragma once + +#define LIBOSMO_NETIF_VERSION {{VERSION}} +#define LIBOSMO_NETIF_VERSION_STR "{{VERSION}}" + +#define LIBOSMO_NETIF_VERSION_MAJOR {{VERSION_MAJOR}} +#define LIBOSMO_NETIF_VERSION_MINOR {{VERSION_MINOR}} +#define LIBOSMO_NETIF_VERSION_PATCH {{VERSION_PATCH}} + +#define LIBOSMO_NETIF_VERSION_GREATER_EQUAL(major, minor, patch) \ + (LIBOSMO_NETIF_VERSION_MAJOR > (major) || \ + (LIBOSMO_NETIF_VERSION_MAJOR == (major) && \ + LIBOSMO_NETIF_VERSION_MINOR > (minor)) || \ + (LIBOSMO_NETIF_VERSION_MAJOR == (major) && \ + LIBOSMO_NETIF_VERSION_MINOR == (minor) && \ + LIBOSMO_NETIF_VERSION_PATCH >= (patch)))