diff --git a/makefile b/makefile index 270f7e7..ca17233 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,10 @@ CC := gcc +VERSION := $(shell git describe --tags --always --dirty) + CFLAGS := -Wall -Wextra -O2 \ - $(shell pkg-config --cflags libcjson ncurses) + -DVERSION=\"$(VERSION)\" \ + $(shell pkg-config --cflags libcjson ncurses) LDFLAGS := $(shell pkg-config --libs libcjson ncurses) diff --git a/src/main.c b/src/main.c index 2f5d6cc..94a5b2a 100644 --- a/src/main.c +++ b/src/main.c @@ -322,7 +322,7 @@ for (int i = 1; i < argc; i++) { return 0; } else if (strcmp(arg, "--version") == 0) { - printf("NoteWrapper version 1.0\n"); + printf("NoteWrapper %s\n", VERSION); return 0; } else { diff --git a/src/utils.h b/src/utils.h index f3d5bf0..e8b4704 100644 --- a/src/utils.h +++ b/src/utils.h @@ -18,6 +18,9 @@ #include #include #include +#ifndef VERSION +#define VERSION "dev" +#endif #define BUFFER_SIZE 256 //standard buffer size. // the three supported values are "daily" "weekly" and "monthly" (for months we use the avarage lenght of a month in a non leap year). All values were calculated on my loyal TI-30 ECO RS #define DAILY 86400