新增根据git记录自动生成GIT_VERSION变量的代码
This commit is contained in:
@@ -17,7 +17,29 @@ typedef struct log_handle_t
|
||||
|
||||
#define LOGMSG_MAX_LEN 4096
|
||||
|
||||
const int HANDLE_LOGGER_VERSION_20190218 = 1;
|
||||
//const int HANDLE_LOGGER_VERSION_20190218 = 1;
|
||||
|
||||
#define GIT_VERSION_CATTER(v) __attribute__((__used__)) const char * GIT_VERSION_##v = NULL
|
||||
#define GIT_VERSION_EXPEND(v) GIT_VERSION_CATTER(v)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* VERSION TAG */
|
||||
#ifdef GIT_VERSION
|
||||
GIT_VERSION_EXPEND(GIT_VERSION);
|
||||
#else
|
||||
static __attribute__((__used__)) const char * GIT_VERSION_UNKNOWN = NULL;
|
||||
#endif
|
||||
#undef GIT_VERSION_CATTER
|
||||
#undef GIT_VERSION_EXPEND
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static unsigned char weekday_str[7][4] =
|
||||
{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
|
||||
@@ -3,6 +3,14 @@ VPATH=../inc
|
||||
CFLAGS= -g3 -Wall -fPIC -O -Werror
|
||||
CFLAGS+=-I../inc/
|
||||
|
||||
GIT_BRANCH=$(shell git symbolic-ref --short -q HEAD)
|
||||
GIT_SHA1=$(shell git rev-parse HEAD)
|
||||
MAKE_TIME=$(shell date "+%Y_%m_%d_%H")
|
||||
VERSION_FLAGS += -DGIT_VERSION=1_0_0_$(GIT_BRANCH)_$(GIT_SHA1)_$(MAKE_TIME)
|
||||
|
||||
CFLAGS += ${VERSION_FLAGS}
|
||||
CXXFLAGS += ${VERSION_FLAGS}
|
||||
|
||||
ifdef ASAN
|
||||
CFLAGS_+= -fsanitize=address -fno-omit-frame-pointer
|
||||
LIB+=-lasan
|
||||
|
||||
Reference in New Issue
Block a user