tcc -v displays short hash to ease detection of source version used to compile tcc
This commit is contained in:
parent
47da8e450e
commit
65d00b13d5
2 changed files with 13 additions and 1 deletions
6
Makefile
6
Makefile
|
@ -24,6 +24,12 @@ CFLAGS += -I$(TOP)
|
||||||
CFLAGS += $(CPPFLAGS)
|
CFLAGS += $(CPPFLAGS)
|
||||||
VPATH = $(TOPSRC)
|
VPATH = $(TOPSRC)
|
||||||
|
|
||||||
|
TCC_GIT_HASH=$(shell git rev-parse > /dev/null 2>&1 && git rev-parse --short HEAD || echo no)
|
||||||
|
|
||||||
|
ifneq ($(TCC_GIT_HASH),no)
|
||||||
|
CFLAGS += -DTCC_GIT_HASH=\"$(TCC_GIT_HASH)\"
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_WIN32
|
ifdef CONFIG_WIN32
|
||||||
CFG = -win
|
CFG = -win
|
||||||
ifneq ($(CONFIG_static),yes)
|
ifneq ($(CONFIG_static),yes)
|
||||||
|
|
8
tcc.c
8
tcc.c
|
@ -149,7 +149,13 @@ static const char help2[] =
|
||||||
;
|
;
|
||||||
|
|
||||||
static const char version[] =
|
static const char version[] =
|
||||||
"tcc version "TCC_VERSION" ("
|
"tcc version "TCC_VERSION
|
||||||
|
#ifdef TCC_GIT_HASH
|
||||||
|
" - " TCC_GIT_HASH
|
||||||
|
#else
|
||||||
|
" - unknown hash"
|
||||||
|
#endif
|
||||||
|
" ("
|
||||||
#ifdef TCC_TARGET_I386
|
#ifdef TCC_TARGET_I386
|
||||||
"i386"
|
"i386"
|
||||||
#elif defined TCC_TARGET_X86_64
|
#elif defined TCC_TARGET_X86_64
|
||||||
|
|
Loading…
Add table
Reference in a new issue