History

make tcc -v more informative (also add commit date/time) patch from 'Christian Jullien' <eligis@orange.fr>

noneofyourbusiness committed 3 years ago

Commit 4cb99781 parent 62096262 files · +10 −2Browse files

Unified · Split

2 files
  1. Makefile +7 −2
  2. tcc.c +3 −0
Makefile+7−2
@@ -243,7 +243,12 @@ endif · 242 unmodified lines
243243
244244 GITHASH := $(shell git rev-parse >/dev/null 2>&1 && git rev-parse --short HEAD || echo no)
245245 ifneq ($(GITHASH),no)
246−DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
246+DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo ' - modified')\""
247+endif
248+
249+GITDATE := $(shell git log -1 >/dev/null 2>&1 && git log -1 --pretty='format:%cI' || echo no)
250+ifneq ($(GITDATE),no)
251+DEF_GITDATE := -DTCC_GITDATE="\"$(shell git log -1 --pretty='format:%cI')\""
247252 endif
248253
249254 ifeq ($(CONFIG_debug),yes)
@@ -265,7 +270,7 @@ $(X)%.o : %.c $(LIBTCC_INC) · 15 unmodified lines
265270
266271 # additional dependencies
267272 $(X)tcc.o : tcctools.c
268−$(X)tcc.o : DEFINES += $(DEF_GITHASH)
273+$(X)tcc.o : DEFINES += $(DEF_GITHASH) $(DEF_GITDATE)
269274
270275 # Host Tiny C Compiler
271276 tcc$(EXESUF): tcc.o $(LIBTCC)
tcc.c+3−0
@@ -155,6 +155,9 @@ static const char version[] = · 154 unmodified lines
155155 "tcc version "TCC_VERSION
156156 #ifdef TCC_GITHASH
157157 " "TCC_GITHASH
158+#endif
159+#ifdef TCC_GITDATE
160+ " on "TCC_GITDATE
158161 #endif
159162 " ("
160163 #ifdef TCC_TARGET_I386

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t