1
0
Fork 0

make tcc -v more informative (also add commit date/time)

patch from 'Christian Jullien' <eligis@orange.fr>
This commit is contained in:
noneofyourbusiness 2022-12-01 06:33:51 +01:00
parent 62096265ed
commit 4cb99787a7
No known key found for this signature in database
GPG Key ID: FF810A8659912F5A
2 changed files with 10 additions and 2 deletions

View File

@ -243,7 +243,12 @@ endif
GITHASH := $(shell git rev-parse >/dev/null 2>&1 && git rev-parse --short HEAD || echo no)
ifneq ($(GITHASH),no)
DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo ' - modified')\""
endif
GITDATE := $(shell git log -1 >/dev/null 2>&1 && git log -1 --pretty='format:%cI' || echo no)
ifneq ($(GITDATE),no)
DEF_GITDATE := -DTCC_GITDATE="\"$(shell git log -1 --pretty='format:%cI')\""
endif
ifeq ($(CONFIG_debug),yes)
@ -265,7 +270,7 @@ $(X)%.o : %.c $(LIBTCC_INC)
# additional dependencies
$(X)tcc.o : tcctools.c
$(X)tcc.o : DEFINES += $(DEF_GITHASH)
$(X)tcc.o : DEFINES += $(DEF_GITHASH) $(DEF_GITDATE)
# Host Tiny C Compiler
tcc$(EXESUF): tcc.o $(LIBTCC)

3
tcc.c
View File

@ -155,6 +155,9 @@ static const char version[] =
"tcc version "TCC_VERSION
#ifdef TCC_GITHASH
" "TCC_GITHASH
#endif
#ifdef TCC_GITDATE
" on "TCC_GITDATE
#endif
" ("
#ifdef TCC_TARGET_I386