Hi,
More and more users complain with 0.9.27 bugs which are solved by mob.
They often tell us they are using ./tcc -v => 0.9.27 which is meaningless as
0.9.27 is anything form last >3y old official 0.9.27 to mob.
To improve this, I would like to add the git last date (or anything that can
easily identify the source code version used to compile tcc).
./tcc -v
jullien@sims4:~/tinycc $ ./tcc -v
tcc version 0.9.27 (ARM eabihf Linux - git version Thu Mar 18 22:54:24 2021)
When tcc is compiled from a tarball (w.o. git info) it will tell:
jullien@sims4:~/tinycc $ ./tcc -v
tcc version 0.9.27 (ARM eabihf Linux - unknown git version)
Can I push this patch?
jullien@sims4:~/tinycc $ git diff
diff --git a/Makefile b/Makefile
index 6d09b65..691a2d3 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,12 @@ CFLAGS += -I$(TOP)
CFLAGS += $(CPPFLAGS)
VPATH = $(TOPSRC)
+TCC_GIT_DATE=$(shell which gut > /dev/null 2>&1 && git log -1 --format=%ad
--date=local || echo no)
+
+ifneq ($(TCC_GIT_DATE),no)
+ CFLAGS += -DTCC_GIT_DATE="\"$(TCC_GIT_DATE)\""
+endif
+
ifdef CONFIG_WIN32
CFG = -win
ifneq ($(CONFIG_static),yes)
diff --git a/tcc.c b/tcc.c
index bd9ce2f..36f4af1 100644
--- a/tcc.c
+++ b/tcc.c
@@ -181,6 +181,12 @@ static const char version[] =
" NetBSD"
#else
" Linux"
+#endif
+#ifdef TCC_GIT_DATE
+ " - git version "
+ TCC_GIT_DATE
+#else
+ " - unknown git version"
#endif
")\n"
;
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel