osmith has uploaded this change for review. ( 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, 27 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-pfcp refs/changes/07/40507/1
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..e0305f4 100644 --- a/include/osmocom/pfcp/Makefile.am +++ b/include/osmocom/pfcp/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" \ + $< > $@ + noinst_HEADERS = \ pfcp_cp_peer_private.h \ $(NULL) @@ -10,6 +19,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)))