From 425ac89e8df98d12a5c4b5c84bd463b3f03901d4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sat, 27 Feb 2021 18:22:52 +0100 Subject: [PATCH] :art: Add short commit hash as version --- Makefile | 3 +++ src/arg.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d845210e..fa0ccc4b 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,9 @@ test_dir += examples CFLAGS += -Iutil/include -Iast/include -Ilibcmdapp/src -D_GNU_SOURCE +# add commit hash to version for now +CFLAGS += -DGWION_VERSION=\"$(shell git log -n1 --format="%h")\" + ifeq (${DEBUG_STACK}, 1) CFLAGS += -DDEBUG_STACK endif diff --git a/src/arg.c b/src/arg.c index bcae9ed7..c4504a27 100644 --- a/src/arg.c +++ b/src/arg.c @@ -288,12 +288,16 @@ static void myproc(void *data, cmdopt_t* option, const char* arg) { } } +#ifndef GWION_VERSION +#define GWION_VERSION "N.A." +#endif + ANN m_bool _arg_parse(struct ArgInternal *arg) { cmdapp_t app; const cmdapp_info_t info = { .program = "gwion", .synopses = NULL, // so it's automatic - .version = "N.A.", + .version = GWION_VERSION, .author = "Jérémie Astor", .year = 2016, .description = "Strongly timed musical programming language.", -- 2.43.0