diff --git a/GNUmakefile b/GNUmakefile index 3715a8c..da9e35e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -69,8 +69,10 @@ LDFLAGS += -L/source/libevent -include release_setup.mk ifeq ($(RELEASE),YES) CFLAGS += -Os -DNDEBUG +GIT_REVISION ?= NO else CFLAGS += -g -DDEBUG +GIT_REVISION ?= YES endif ifeq ($(STACK_PROTECT),YES) @@ -127,6 +129,10 @@ CFLAGS += -I$(LIBEVENT_PATH) LDFLAGS += -L$(LIBEVENT_PATH) endif +ifeq ($(GIT_REVISION),YES) +CFLAGS += -DGIT_REVISION=\"-git:$(shell git show --oneline | head -n 1 | cut -f 1 -d " ")\" +endif + # Sources libuhub_SOURCES := \ src/auth.c \ diff --git a/version.h b/version.h index 836e09c..dd38934 100644 --- a/version.h +++ b/version.h @@ -6,8 +6,12 @@ #define PRODUCT_TITLE "(micro-Hub)" #endif +#ifndef GIT_REVISION +#define GIT_REVISION "" +#endif + #ifndef VERSION -#define VERSION "0.3.0-rc0" +#define VERSION "0.3.0-rc0" GIT_REVISION #endif #ifndef COPYRIGHT