2016-07-06 04:09:17 +00:00
|
|
|
@echo off
|
|
|
|
set BRA=Unknown
|
|
|
|
set REV=illegal
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
copy nul: /b +%1\comptime.c tmp.$$$ > nul
|
|
|
|
move tmp.$$$ %1\comptime.c > nul
|
2016-07-06 04:09:17 +00:00
|
|
|
|
|
|
|
if exist .git goto gitrev
|
|
|
|
if exist ..\.git goto gitrev
|
|
|
|
if exist .svn goto svnrev
|
|
|
|
goto filwri
|
|
|
|
|
|
|
|
:gitrev
|
|
|
|
set GIT=%2
|
|
|
|
if "%GIT%"=="" set GIT=git
|
|
|
|
for /f "usebackq" %%s in (`%GIT% rev-parse --abbrev-ref HEAD`) do @set BRA=%%s
|
|
|
|
for /f "usebackq" %%s in (`%GIT% rev-parse HEAD`) do @set REV=%%s
|
|
|
|
set REV=%REV:~0,8%
|
|
|
|
goto filwri
|
|
|
|
|
|
|
|
:svnrev
|
|
|
|
set BRA=Subversion
|
|
|
|
for /f "usebackq" %%s in (`svnversion .`) do @set REV=%%s
|
|
|
|
set REV=r%REV%
|
|
|
|
goto filwri
|
|
|
|
|
|
|
|
:filwri
|
|
|
|
echo // Do not edit! This file was autogenerated > %1\comptime.h
|
|
|
|
echo // by the %0 batch file >> %1\comptime.h
|
|
|
|
echo // >> %1\comptime.h
|
|
|
|
echo const char* compbranch = "%BRA%"; >> %1\comptime.h
|
|
|
|
echo const char* comprevision = "%REV%"; >> %1\comptime.h
|