編譯 binary 的時候自動加入 release version 與 date
Makefile
.c 檔
Preprocessing 的時候 macro 會自動被帶換掉啦!
1
2
3
4
| SVN_VERSION = "\"`svn info | grep Revision | sed 's/Revision: //g'`\""BUILD_TIME = "\"`date '+%Y/%m/%d %H:%M:%S'`\""CFLAGS += -DSVN_VERSION=$(SVN_VERSION) -DBUILD_TIME=$(BUILD_TIME) |
.c 檔
1
2
3
4
| void show_version (void){ printf("SVN Version: %s, Bulid time: %s\n", SVN_VERSION, BUILD_TIME);} |
reference: http://blog.yslin.tw/2012/03/binary-release-version-date.html
留言
張貼留言