History

Prepended branch name to githash (tcc -v). WIN32: added githash support. - E.g. "tcc version 0.9.27 mob:675046b (x86_64 Windows)" - WIN32: Replaced compiler opt -O1 and -Os with -O2 (only 1% larger executable).

Tyge Løvset committed 5 years ago

Commit c7a57bf1 parent 675046b2 files · +11 −3Browse files

Unified · Split

2 files
  1. Makefile +1 −1
  2. win32/build-tcc.bat +10 −2
Makefile+1−1
@@ -224,7 +224,7 @@ endif · 223 unmodified lines
224224
225225 GITHASH := $(shell git rev-parse >/dev/null 2>&1 && git rev-parse --short HEAD || echo no)
226226 ifneq ($(GITHASH),no)
227−DEF_GITHASH := -DTCC_GITHASH="\"$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
227+DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
228228 endif
229229
230230 ifeq ($(CONFIG_debug),yes)
win32/build-tcc.bat+10−2
@@ -7,6 +7,14 @@ setlocal · 6 unmodified lines
77 if (%1)==(-clean) goto :cleanup
88 set CC=gcc
99 set /p VERSION= < ..\VERSION
10+git.exe --version 2>nul
11+if not %ERRORLEVEL%==0 goto :git_done
12+for /f %%b in ('git.exe rev-parse --abbrev-ref HEAD') do set GITHASH=%%b
13+for /f %%h in ('git.exe rev-parse --short HEAD') do set GITHASH=%GITHASH%:%%h
14+git.exe diff --quiet
15+if %ERRORLEVEL%==1 set GITHASH=%GITHASH%-mod
16+set DEF_GITHASH=-DTCC_GITHASH="""%GITHASH%"""
17+:git_done
1018 set INST=
1119 set DOC=no
1220 set EXES_ONLY=no
@@ -74,7 +82,7 @@ set CMD=%CMD% %ARG% · 61 unmodified lines
7482 shift
7583 if not (%1)==() goto :c0
7684 echo on
77−%CMD% -O1 -W2 -Zi -MT -GS- -nologo -link -opt:ref,icf
85+%CMD% -O2 -W2 -Zi -MT -GS- -nologo %DEF_GITHASH% -link -opt:ref,icf
7886 @exit /B %ERRORLEVEL%
7987
8088 @rem ------------------------------------------------------
@@ -86,7 +94,7 @@ set T=32 · 5 unmodified lines
8694 if %PROCESSOR_ARCHITECTURE%_==AMD64_ set T=64
8795 if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64
8896 :p2
89−if "%CC:~-3%"=="gcc" set CC=%CC% -Os -s -static
97+if "%CC:~-3%"=="gcc" set CC=%CC% -O2 -s -static %DEF_GITHASH%
9098 set D32=-DTCC_TARGET_PE -DTCC_TARGET_I386
9199 set D64=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
92100 set P32=i386-win32

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