On Tue, July 18, 2006 12:33 pm, Greg Hudson said:
> On Mon, 2006-07-17 at 21:34 +0100, Max Bowsher wrote:
>> It's deliberately not done to avoid needing to run 'svnversion', and
>> relink everything from libsvn_subr on upwards, on *every* invocation of
> svnversion . >> versionfile.new
> cmp versionfile versionfile.new || mv versionfile.new versionfile
> I believe that should work with every modern version of make (I've seen
> versions which won't re-check the timestamp on versionfile after
> executing the rebuild rule, but I think that's ancient history).
> svnversion would run on every build, but that's it, and repeated
> invocations of svnversion should be quite fast for a Subversion project
Thanks for the "make magic" Greg. I think you wanted to overwrite
versionfile.new instead of append to it though.
Once the version number is segregated into it's own file, it would still
need to be updated in the source header to reflect the version number when
the `cmp` command returned non-zero.
I've been writing a python script to do this - which is not the greatest
implimentation as I wouldn't want to add a requirement for python to
subversion. A proper C program could be written for cross platform
implimentations if this is seen as useful.
The python script is attached, just use the above make commands and put
the python script in after the || (or) command.
You would want to `cat` the contents of the version file instead of
running `svnversion` again as I show in the usage of the script.
Or just run the script in the ./subversion/include/ directory and build
Please let me know if you find any bugs in the python script.
I think the 'svn_version.h' target would have to depend on the
'versionfile' target in the Makefile so things get built in the right
order. But I'm not sure of that one.
Relinking is non-trivial as originally pointed out. After changing the
source header file make reports that 234 commands need to execute to build
[cgness@servicesvn dev-rev-devel]$ make -n | wc -l
Thanks for the chatter, I received more of a response than I expected.
Received on Tue Jul 18 20:05:02 2006
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com