osmith has uploaded this change for review. (
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, 27 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/libsmpp34 refs/changes/09/40509/1
diff --git a/src/Makefile.am b/src/Makefile.am
index e594dd9..7feb2a7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,11 +18,21 @@
$(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" \
+ $< > $@
+
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: newchange
Gerrit-Project: libsmpp34
Gerrit-Branch: master
Gerrit-Change-Id: I03ba56c80d83fda5824da247a942e2e33f48580e
Gerrit-Change-Number: 40509
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>