summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile.in4
-rw-r--r--include/apimagic/apimagic.h10
-rw-r--r--src/driver/amgc_driver_ctx.c14
3 files changed, 26 insertions, 2 deletions
diff --git a/Makefile.in b/Makefile.in
index 0957e32..d8ae066 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -86,10 +86,10 @@ include $(PROJECT_DIR)/project/overrides.mk
$(APP_SRCS:%.c=%.o): version.tag
$(APP_SRCS:%.c=%.o): CFLAGS_STATIC = $(CFLAGS_APP)
-src/%.lo: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag
+src/%.lo: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag version.tag
$(CC) -c -o $@ $< $(CFLAGS_SHARED)
-src/%.o: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag
+src/%.o: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag version.tag
$(CC) -c -o $@ $< $(CFLAGS_STATIC)
lib/%$(OS_LIB_SUFFIX)$(VER_XYZ):
diff --git a/include/apimagic/apimagic.h b/include/apimagic/apimagic.h
index 4ec322a..6e7e38b 100644
--- a/include/apimagic/apimagic.h
+++ b/include/apimagic/apimagic.h
@@ -61,6 +61,13 @@ enum amgc_output_action {
AMGC_LIST_FUNCTION,
};
+struct amgc_source_version {
+ int major;
+ int minor;
+ int revision;
+ const char * commit;
+};
+
struct amgc_input {
void * addr;
size_t size;
@@ -153,6 +160,9 @@ struct amgc_layout {
int tabwidth;
};
+/* package info */
+amgc_api const struct amgc_source_version * amgc_source_version(void);
+
/* driver api */
amgc_api int amgc_get_driver_ctx (char ** argv, char ** envp, uint32_t flags, struct amgc_driver_ctx **);
amgc_api int amgc_create_driver_ctx (const struct amgc_common_ctx *, struct amgc_driver_ctx **);
diff --git a/src/driver/amgc_driver_ctx.c b/src/driver/amgc_driver_ctx.c
index d774307..ba753a1 100644
--- a/src/driver/amgc_driver_ctx.c
+++ b/src/driver/amgc_driver_ctx.c
@@ -22,9 +22,18 @@
#define ARGV_DRIVER
#include <apimagic/apimagic.h>
+#include "apimagic_version.h"
#include "apimagic_driver_impl.h"
#include "argv/argv.h"
+/* package info */
+static const struct amgc_source_version amgc_src_version = {
+ AMGC_TAG_VER_MAJOR,
+ AMGC_TAG_VER_MINOR,
+ AMGC_TAG_VER_PATCH,
+ APIMAGIC_GIT_VERSION
+};
+
struct amgc_driver_ctx_alloc {
struct argv_meta * meta;
struct amgc_action * actions;
@@ -283,3 +292,8 @@ void amgc_free_driver_ctx(struct amgc_driver_ctx * ctx)
amgc_free_driver_ctx_impl(ictx);
}
}
+
+const struct amgc_source_version * amgc_source_version(void)
+{
+ return &amgc_src_version;
+}