版本写入服务程序
程序员文章站
2022-07-14 10:11:33
...
SvnRevision.h: @if [ -d .svn ]; then \ ( \ echo "//////////////////////////////////////////////////////////////////////////////"; \ echo "//"; \ echo "//////////////////////////////////////////////////////////////////////////////"; \ echo ""; \ echo "#ifndef _SVN_REVISION_H_"; \ echo "#define _SVN_REVISION_H_"; \ echo ""; \ echo "// 编译时增加svn版本号, 该文件不能传上svn 源码库"; \ echo -n '#define SVN_REVISION_NUM "'; \ (cd ..; svnversion -nc .); \ echo '"'; \ echo -n '#define SVN_URL "'; \ (cd ..; echo -n `svn info|grep URL`|sed 's/URL: //'); \ echo '"'; \ echo -n '#define BUILD_TIME "'; \ (echo -n `date "+%x %X"`); \ echo '"'; \ echo -n '#define BUILD_BY "'; \ (echo -n `whoami`); \ echo '"'; \ echo -n '#define BUILD_AT "'; \ (echo -n `hostname`); \ echo '"'; \ echo ""; \ echo "#endif // _SVN_REVISION_H_"; \ ) > SvnRevision.h; \ echo "Marking subversion revision to SvnRevision.h..."; \ fi; GitRevision.h: ( \ echo "//////////////////////////////////////////////////////////////////////////////"; \ echo "//"; \ echo "//////////////////////////////////////////////////////////////////////////////"; \ echo ""; \ echo "#ifndef _Git_REVISION_H_"; \ echo "#define _Git_REVISION_H_"; \ echo ""; \ echo -n '#define Git_REVISION_NUM "'; \ (echo -n `git log | head -1`); \ echo '"'; \ echo -n '#define BUILD_TIME "'; \ (echo -n `date "+%x %X"`); \ echo '"'; \ echo -n '#define BUILD_BY "'; \ (echo -n `whoami`); \ echo '"'; \ echo -n '#define BUILD_AT "'; \ (echo -n `hostname`); \ echo '"'; \ echo ""; \ echo "#endif // _Git_REVISION_H_"; \ ) > GitRevision.h; \ echo "Marking subversion revision to GitRevision.h..."; \
上一篇: 我发现开始喜欢Python了