History

Use my latest proposed patch for improved -v message. It is simpler and gives a better message, especially when repository has been locally modified: 'tcc version 0.9.27 mob:fef701b 2022-12-02T07:11:55+01:00 locally modified (ARM eabihf Linux)'. Hope it's Ok for maintainers

Christian Jullien committed 3 years ago

Commit 70158381 parent fef701b2 files · +5 −10Browse files

Unified · Split

2 files
  1. Makefile +5 −7
  2. tcc.c +0 −3
Makefile+5−7
@@ -241,14 +241,12 @@ $(TCC_FILES) : DEFINES += -DONE_SOURCE=0 · 240 unmodified lines
241241 $(X)tccpp.o : $(TCCDEFS_H)
242242 endif
243243
244−GITHASH := $(shell git rev-parse >/dev/null 2>&1 && git rev-parse --short HEAD || echo no)
245−ifneq ($(GITHASH),no)
246−DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo ' - modified')\""
247−endif
244+FROM_GIT := $(shell git rev-parse >/dev/null 2>&1 && echo yes || echo no)
248245
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')\""
246+ifeq ($(FROM_GIT),yes)
247+GITHASH:=$(shell git rev-parse --abbrev-ref HEAD):$(shell git rev-parse --short HEAD) $(shell git log -1 --pretty='format:%cI')
248+GITHASH+=$(shell git diff --quiet || echo locally modified)
249+DEF_GITHASH := -DTCC_GITHASH="\"$(GITHASH)\""
252250 endif
253251
254252 ifeq ($(CONFIG_debug),yes)
tcc.c+0−3
@@ -155,9 +155,6 @@ 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
161158 #endif
162159 " ("
163160 #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