osmith has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-pfcp/+/40507?usp=email )
Change subject: Generate a version.h file ......................................................................
Generate a version.h file
Related: OS#6626 Change-Id: I5f1e568d5ef991371aa29188e54de86b4b940472 --- M .gitignore M include/osmocom/pfcp/Makefile.am A include/osmocom/pfcp/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 56bd8e6..9879e21 100644 --- a/.gitignore +++ b/.gitignore @@ -83,3 +83,4 @@ doc/manuals/build
contrib/libosmo-pfcp.spec +include/osmocom/pfcp/version.h diff --git a/include/osmocom/pfcp/Makefile.am b/include/osmocom/pfcp/Makefile.am index 2693be5..21b3aeb 100644 --- a/include/osmocom/pfcp/Makefile.am +++ b/include/osmocom/pfcp/Makefile.am @@ -2,6 +2,19 @@ pfcp_cp_peer_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) + pfcp_HEADERS = \ pfcp_endpoint.h \ pfcp_ies_custom.h \ @@ -10,6 +23,7 @@ pfcp_proto.h \ pfcp_strs.h \ pfcp_cp_peer.h \ + version.h \ $(NULL)
pfcpdir = $(includedir)/osmocom/pfcp diff --git a/include/osmocom/pfcp/version.h.tpl b/include/osmocom/pfcp/version.h.tpl new file mode 100644 index 0000000..1a7de1b --- /dev/null +++ b/include/osmocom/pfcp/version.h.tpl @@ -0,0 +1,16 @@ +#pragma once + +#define LIBOSMO_PFCP_VERSION {{VERSION}} +#define LIBOSMO_PFCP_VERSION_STR "{{VERSION}}" + +#define LIBOSMO_PFCP_VERSION_MAJOR {{VERSION_MAJOR}} +#define LIBOSMO_PFCP_VERSION_MINOR {{VERSION_MINOR}} +#define LIBOSMO_PFCP_VERSION_PATCH {{VERSION_PATCH}} + +#define LIBOSMO_PFCP_VERSION_GREATER_EQUAL(major, minor, patch) \ + (LIBOSMO_PFCP_VERSION_MAJOR > (major) || \ + (LIBOSMO_PFCP_VERSION_MAJOR == (major) && \ + LIBOSMO_PFCP_VERSION_MINOR > (minor)) || \ + (LIBOSMO_PFCP_VERSION_MAJOR == (major) && \ + LIBOSMO_PFCP_VERSION_MINOR == (minor) && \ + LIBOSMO_PFCP_VERSION_PATCH >= (patch)))