Generate a version.h file

Related: OS#6626
Change-Id: Ia894a9d9a20e343755d8060822d33b8a1c59b4db
This commit is contained in:
Oliver Smith
2025-06-23 16:00:59 +02:00
parent c38ad746f2
commit d0ad985eb0
3 changed files with 28 additions and 1 deletions

1
.gitignore vendored
View File

@@ -26,3 +26,4 @@ usb_strings_generated.h
firmware/usbstring/usbstring firmware/usbstring/usbstring
firmware/apps/*/usb_strings.txt.patched firmware/apps/*/usb_strings.txt.patched
firmware/misc/crctool firmware/misc/crctool
host/include/osmocom/simtrace2/version.h

View File

@@ -1,3 +1,12 @@
osmocom/simtrace2/version.h: osmocom/simtrace2/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" \
$< > $@
nobase_include_HEADERS = \ nobase_include_HEADERS = \
osmocom/simtrace2/apdu_dispatch.h \ osmocom/simtrace2/apdu_dispatch.h \
osmocom/simtrace2/simtrace2_api.h \ osmocom/simtrace2/simtrace2_api.h \
@@ -5,4 +14,5 @@ nobase_include_HEADERS = \
osmocom/simtrace2/simtrace_prot.h \ osmocom/simtrace2/simtrace_prot.h \
osmocom/simtrace2/usb_util.h \ osmocom/simtrace2/usb_util.h \
osmocom/simtrace2/gsmtap.h \ osmocom/simtrace2/gsmtap.h \
osmocom/simtrace2/version.h \
$(NULL) $(NULL)

View File

@@ -0,0 +1,16 @@
#pragma once
#define LIBOSMO_SIMTRACE2_VERSION {{VERSION}}
#define LIBOSMO_SIMTRACE2_VERSION_STR "{{VERSION}}"
#define LIBOSMO_SIMTRACE2_VERSION_MAJOR {{VERSION_MAJOR}}
#define LIBOSMO_SIMTRACE2_VERSION_MINOR {{VERSION_MINOR}}
#define LIBOSMO_SIMTRACE2_VERSION_PATCH {{VERSION_PATCH}}
#define LIBOSMO_SIMTRACE2_VERSION_GREATER_EQUAL(major, minor, patch) \
(LIBOSMO_SIMTRACE2_VERSION_MAJOR > (major) || \
(LIBOSMO_SIMTRACE2_VERSION_MAJOR == (major) && \
LIBOSMO_SIMTRACE2_VERSION_MINOR > (minor)) || \
(LIBOSMO_SIMTRACE2_VERSION_MAJOR == (major) && \
LIBOSMO_SIMTRACE2_VERSION_MINOR == (minor) && \
LIBOSMO_SIMTRACE2_VERSION_PATCH >= (patch)))