osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/40514?usp=email )
Change subject: Generate a version.h file ......................................................................
Generate a version.h file
Related: OS#6626 Change-Id: I8460e85d50149f4bc58b6048e5596c5768010829 --- M .gitignore M include/osmocom/mgcp_client/Makefile.am A include/osmocom/mgcp_client/version.h.tpl 3 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/14/40514/1
diff --git a/.gitignore b/.gitignore index 3f1a890..71cd588 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ bscconfig.h bscconfig.h.in include/osmocom/mgcp_client/mgcp_common.h +include/osmocom/mgcp_client/version.h src/osmo-mgw/osmo-mgw *.*~ *.sw? diff --git a/include/osmocom/mgcp_client/Makefile.am b/include/osmocom/mgcp_client/Makefile.am index 90b1bd7..ee6ff9f 100644 --- a/include/osmocom/mgcp_client/Makefile.am +++ b/include/osmocom/mgcp_client/Makefile.am @@ -1,5 +1,6 @@ BUILT_SOURCES = \ mgcp_common.h \ + version.h \ $(NULL)
noinst_HEADERS = \ @@ -11,4 +12,13 @@ echo -e "/*\n\n DO NOT EDIT THIS FILE!\n THIS IS OVERWRITTEN DURING BUILD\n This is an automatic copy of <osmocom/mgcp/mgcp_common.h>\n\n */" > mgcp_common.h cat $(top_srcdir)/include/osmocom/mgcp/mgcp_common.h >> mgcp_common.h
+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" \ + $< > $@ + CLEANFILES = mgcp_common.h diff --git a/include/osmocom/mgcp_client/version.h.tpl b/include/osmocom/mgcp_client/version.h.tpl new file mode 100644 index 0000000..db873af --- /dev/null +++ b/include/osmocom/mgcp_client/version.h.tpl @@ -0,0 +1,16 @@ +#pragma once + +#define LIBOSMO_MGCP_CLIENT_VERSION {{VERSION}} +#define LIBOSMO_MGCP_CLIENT_VERSION_STR "{{VERSION}}" + +#define LIBOSMO_MGCP_CLIENT_VERSION_MAJOR {{VERSION_MAJOR}} +#define LIBOSMO_MGCP_CLIENT_VERSION_MINOR {{VERSION_MINOR}} +#define LIBOSMO_MGCP_CLIENT_VERSION_PATCH {{VERSION_PATCH}} + +#define LIBOSMO_MGCP_CLIENT_VERSION_GREATER_EQUAL(major, minor, patch) \ + (LIBOSMO_MGCP_CLIENT_VERSION_MAJOR > (major) || \ + (LIBOSMO_MGCP_CLIENT_VERSION_MAJOR == (major) && \ + LIBOSMO_MGCP_CLIENT_VERSION_MINOR > (minor)) || \ + (LIBOSMO_MGCP_CLIENT_VERSION_MAJOR == (major) && \ + LIBOSMO_MGCP_CLIENT_VERSION_MINOR == (minor) && \ + LIBOSMO_MGCP_CLIENT_VERSION_PATCH >= (patch)))