]> Nishi Git Mirror - gwion.git/commitdiff
:art: Add short commit hash as version
authorJérémie Astor <fennecdjay@gmail.com>
Sat, 27 Feb 2021 17:22:52 +0000 (18:22 +0100)
committerJérémie Astor <fennecdjay@gmail.com>
Sat, 27 Feb 2021 17:22:52 +0000 (18:22 +0100)
Makefile
src/arg.c

index d845210eba11790ceeca568c119e406d1ecf0d4f..fa0ccc4b00bc2c7d8d6aab73ca7238d0a667938e 100644 (file)
--- 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
index bcae9ed7e236f9a1d4376d6c1d1af5baeff9b9f4..c4504a277886890b4eb61a0c2c3d5479f5662743 100644 (file)
--- 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.",