mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-28 04:00:06 +08:00
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).
This commit is contained in:
parent
675046bd59
commit
c7a57bf1fa
2
Makefile
2
Makefile
@ -224,7 +224,7 @@ endif
|
||||
|
||||
GITHASH := $(shell git rev-parse >/dev/null 2>&1 && git rev-parse --short HEAD || echo no)
|
||||
ifneq ($(GITHASH),no)
|
||||
DEF_GITHASH := -DTCC_GITHASH="\"$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
|
||||
DEF_GITHASH := -DTCC_GITHASH="\"$(shell git rev-parse --abbrev-ref HEAD):$(GITHASH)$(shell git diff --quiet || echo '-mod')\""
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_debug),yes)
|
||||
|
@ -7,6 +7,14 @@ setlocal
|
||||
if (%1)==(-clean) goto :cleanup
|
||||
set CC=gcc
|
||||
set /p VERSION= < ..\VERSION
|
||||
git.exe --version 2>nul
|
||||
if not %ERRORLEVEL%==0 goto :git_done
|
||||
for /f %%b in ('git.exe rev-parse --abbrev-ref HEAD') do set GITHASH=%%b
|
||||
for /f %%h in ('git.exe rev-parse --short HEAD') do set GITHASH=%GITHASH%:%%h
|
||||
git.exe diff --quiet
|
||||
if %ERRORLEVEL%==1 set GITHASH=%GITHASH%-mod
|
||||
set DEF_GITHASH=-DTCC_GITHASH="""%GITHASH%"""
|
||||
:git_done
|
||||
set INST=
|
||||
set DOC=no
|
||||
set EXES_ONLY=no
|
||||
@ -74,7 +82,7 @@ set CMD=%CMD% %ARG%
|
||||
shift
|
||||
if not (%1)==() goto :c0
|
||||
echo on
|
||||
%CMD% -O1 -W2 -Zi -MT -GS- -nologo -link -opt:ref,icf
|
||||
%CMD% -O2 -W2 -Zi -MT -GS- -nologo %DEF_GITHASH% -link -opt:ref,icf
|
||||
@exit /B %ERRORLEVEL%
|
||||
|
||||
@rem ------------------------------------------------------
|
||||
@ -86,7 +94,7 @@ set T=32
|
||||
if %PROCESSOR_ARCHITECTURE%_==AMD64_ set T=64
|
||||
if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64
|
||||
:p2
|
||||
if "%CC:~-3%"=="gcc" set CC=%CC% -Os -s -static
|
||||
if "%CC:~-3%"=="gcc" set CC=%CC% -O2 -s -static %DEF_GITHASH%
|
||||
set D32=-DTCC_TARGET_PE -DTCC_TARGET_I386
|
||||
set D64=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
|
||||
set P32=i386-win32
|
||||
|
Loading…
Reference in New Issue
Block a user