Including SVN revision of a project in C source code

c, project, revision, svn

Solution

We use a line like this in our makefile:

REPO_REV := $(shell svnversion -n)

That stores the revision number of the working copy into a make variable. To use it in C code, you can have your makefile use that value to define a macro on the compiler command line (something like `-DREPO_REV=$(REPO_REV)` for gcc).

Problem

How to include SVN revision of my project (not file revision) in C source code or in Makefile?

Original source