diff --git a/Makefile b/Makefile index 94767ea..17229b7 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,9 @@ MANPATH = $(DESTDIR)/../man/man1 endif SOURCEDIR = `pwd` -VERSION = `scripts/getversion` +VERSION = $(shell git describe --always) + +CFLAGS += -DVERSION=\"$(VERSION)\" %.o: %.c $(CC) $(CFLAGS) -c -o $@ $^ diff --git a/main.c b/main.c index ea62d4a..9f5cb59 100644 --- a/main.c +++ b/main.c @@ -47,13 +47,6 @@ #include #include -#define VERSION_MAJOR 1 -#define VERSION_MINOR 1 -#define VERSION_APPEND "-dev" - -#define VERSION_STRING(x,y,z) VERSION_ARGS(x, y, z) -#define VERSION_ARGS(x,y,z) "v" #x "." #y z - #define MAX_BUFFER_SIZE (1000*1024) #define MAX_FILENAME_SIZE (256) @@ -252,7 +245,7 @@ int main(int argc, char *argv[]) } else if (argv[i][1] == 'v') { printf("%s %s\n", base(argv[0]), - VERSION_STRING(VERSION_MAJOR,VERSION_MINOR,VERSION_APPEND)); + VERSION); return 0; } else if (argv[i][1] == 'o') { i++;