Search code examples
svnmakefilegit-svn

'SVN_REV' undeclared when build the target in git-svn environment


I use the following command to get the repository from the svn server:

git svn clone ...

However when build the specific target, the stdout shows the following:

error: 'SVN_REV' undeclared here (not in a function)
__attribute__((used)) u32 sys_fw_info = SVN_REV;

Here is the simplified makefile:

haha: dirs revision
    -$(MAKE) -C ./src

revision:
    -$(SVNVERSION) . version.tmp build/svnrev.h

I have tried the following:

  1. If I copy the .svn folder from the normal checkout repository in svn server [since folder I got from git-svn only has .git folder], then I can build the target of haha in the git-svn environment.

  2. If I manually do the following command and don't copy the .svn folder:

    SubWCRev.exe . version.tmp  build/svnrev.h
    

The building process still fail... Have the following two questions:

  1. I don't know if the .svn folder has some dependency with building process?
  2. How can I use the git-svn elegantly locally?

Thanks in advance!!!


Solution

  • I don't know if the .svn folder has some dependency with building process?

    Indirectly.

    You must pre-process your sources with subwcrev (in order to get variable defined in svnrev.h), and subwcrev have to have access to Subversion Working Copy (SubWCRev.exe .) for getting svn-based metadata (which doesn't exist in Git's Working Directory)

    How can I use the git-svn elegantly locally?

    You have to at least try and inspect output of git svn info. This question and answer of @bmv in it will help mainly