Kin*_*noP 4 c++ nmake visual-studio
我正在尝试将我的SVN修订信息保存到宏中,同时通过Microsoft Visual Studio的nmake创建我的代码.
在GNU make中,我做了类似的事情:
SVN_REVISION=r$(shell svnversion -n)
Run Code Online (Sandbox Code Playgroud)
所以我得到例如:SVN_REVISION = r10001
这也可以在Microsoft nmake中做到吗?
先感谢您.
使用提到的技术和递归调用make,可以这样做:
!IFNDEF MAKE
MAKE=NMAKE
!ENDIF
!IFNDEF SVN_REVISION
! IF [echo off && FOR /F "usebackq" %i IN (`svnrevision -n`) DO SET SVN_REVISION=%i && $(MAKE) /$(MAKEFLAGS) /nologo /f $(MAKEDIR)\Makefile && exit /b ] == 0
! MESSAGE Make completed
! ELSE
! ERROR Error in nmake
! ENDIF
!ELSE
# $(SVN_REVISION) now contains the string returned from the command `svnrevision -n`
!MESSAGE SVN_REVISION is $(SVN_REVISION)
# Put the parts of the makefile that depend on SVN_REVISION here
!ENDIF
#
# To be a valid makefile it must have some rules to perform
all:
@echo;$(SVN_REVISION)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1194 次 |
| 最近记录: |