diff --git a/Makefile b/Makefile index 1496b7a..43e1d98 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,9 @@ sqlite-vec.h: sqlite-vec.h.tmpl VERSION VERSION=$(shell cat VERSION) \ DATE=$(shell date -r VERSION +'%FT%TZ%z') \ SOURCE=$(shell git log -n 1 --pretty=format:%H -- VERSION) \ + VERSION_MAJOR=$$(echo $$VERSION | cut -d. -f1) \ + VERSION_MINOR=$$(echo $$VERSION | cut -d. -f2) \ + VERSION_PATCH=$$(echo $$VERSION | cut -d. -f3 | cut -d- -f1) \ envsubst < $< > $@ clean: diff --git a/sqlite-vec.h.tmpl b/sqlite-vec.h.tmpl index 68ecfd5..b4f4411 100644 --- a/sqlite-vec.h.tmpl +++ b/sqlite-vec.h.tmpl @@ -23,6 +23,11 @@ #define SQLITE_VEC_DATE "${DATE}" #define SQLITE_VEC_SOURCE "${SOURCE}" + +#define SQLITE_VEC_VERSION_MAJOR ${VERSION_MAJOR} +#define SQLITE_VEC_VERSION_MINOR ${VERSION_MINOR} +#define SQLITE_VEC_VERSION_PATCH ${VERSION_PATCH} + #ifdef __cplusplus extern "C" { #endif