osmith has submitted this change. (
https://gerrit.osmocom.org/c/libsmpp34/+/40509?usp=email )
Change subject: Generate a version.h file
......................................................................
Generate a version.h file
Give the file a smpp34_ prefix as it ends up in /usr/include.
Related: OS#6626
Change-Id: I03ba56c80d83fda5824da247a942e2e33f48580e
---
M src/Makefile.am
A src/smpp34_version.h.tpl
2 files changed, 31 insertions(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/Makefile.am b/src/Makefile.am
index e594dd9..96783fb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,11 +18,25 @@
$(LIBRARY_SOURCE_DIR)/smpp34_params.c \
$(LIBRARY_SOURCE_DIR)/smpp34_params.h
+smpp34_version.h: $(LIBRARY_SOURCE_DIR)/smpp34_version.h.tpl
+ $(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 = \
+ $(LIBRARY_SOURCE_DIR)/smpp34_version.h.tpl \
+ $(NULL)
+
include_HEADERS = \
$(LIBRARY_SOURCE_DIR)/smpp34.h \
$(LIBRARY_SOURCE_DIR)/smpp34_heap.h \
$(LIBRARY_SOURCE_DIR)/smpp34_structs.h \
- $(LIBRARY_SOURCE_DIR)/smpp34_params.h
+ $(LIBRARY_SOURCE_DIR)/smpp34_params.h \
+ smpp34_version.h \
+ $(NULL)
libsmpp34_la_CFLAGS = @CFLAGS@ -Wall
libsmpp34_la_CFLAGS += -D_REENTRANT -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS
diff --git a/src/smpp34_version.h.tpl b/src/smpp34_version.h.tpl
new file mode 100644
index 0000000..e9bc8cd
--- /dev/null
+++ b/src/smpp34_version.h.tpl
@@ -0,0 +1,16 @@
+#pragma once
+
+#define LIBSMPP34_VERSION {{VERSION}}
+#define LIBSMPP34_VERSION_STR "{{VERSION}}"
+
+#define LIBSMPP34_VERSION_MAJOR {{VERSION_MAJOR}}
+#define LIBSMPP34_VERSION_MINOR {{VERSION_MINOR}}
+#define LIBSMPP34_VERSION_PATCH {{VERSION_PATCH}}
+
+#define LIBSMPP34_VERSION_GREATER_EQUAL(major, minor, patch) \
+ (LIBSMPP34_VERSION_MAJOR > (major) || \
+ (LIBSMPP34_VERSION_MAJOR == (major) && \
+ LIBSMPP34_VERSION_MINOR > (minor)) || \
+ (LIBSMPP34_VERSION_MAJOR == (major) && \
+ LIBSMPP34_VERSION_MINOR == (minor) && \
+ LIBSMPP34_VERSION_PATCH >= (patch)))
--
To view, visit
https://gerrit.osmocom.org/c/libsmpp34/+/40509?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: libsmpp34
Gerrit-Branch: master
Gerrit-Change-Id: I03ba56c80d83fda5824da247a942e2e33f48580e
Gerrit-Change-Number: 40509
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>