[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: How to get the version number out?

From: Doug Goldstein <doug_at_monetra.com>
Date: 2007-02-16 15:37:59 CET

Kenny Leung wrote:
> Hi All.
>
> As part of our release process, I would like to "burn" the version
> number into the binary. I thought an easy way would be to create a file
> in the project directory with something like #define VERSION XXX upon
> export. However, there does not seem to be a post-export hook.
>
> Any help is much appreciated.
>
> Thanks!
>
> -Kenny
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

I typically add a hook to a makefile similar to this..

svnversion.h: svnversion-phony

svnversion-phony:
         @echo "#define SVNVER \""`svnversion -nc | @SED@ -e
's/^[^:]*://' | @SED@ -e 's/M.*//'`"\"" > svnversion.h.tmp
         @cmp -s svnversion.h svnversion.h.tmp || (mv svnversion.h.tmp
svnversion.h; echo created svnversion.h)

.PHONY: svnversion-phony

Then change BUILT_SOURCES to include svnversion.h and just include it
where it's necessary.

This has the advantage of being automatic, the rules provided will only
overwrite and replace the svnversion.h file if there was a
change/difference so your dependencies are still maintained and not
recompiled needlessly.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Feb 16 15:38:28 2007

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.