automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: revision control info in generated files


From: Jef Driesen
Subject: Re: revision control info in generated files
Date: Thu, 01 Apr 2010 14:34:29 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9pre) Gecko/20100217 Lightning/1.0pre Shredder/3.0.3pre

On 31/03/10 22:45, Ralf Wildenhues wrote:
* Jef Driesen wrote on Wed, Mar 31, 2010 at 02:49:48PM CEST:
Sure. I use both git and subversion, and this are the commands I
would use to retrieve the revision info:

git rev-parse --quiet --verify HEAD
svnversion

The svnversion command is a little tricky because it does not fail
when run outside a subversion tree.

'test -d $(top_srcdir)/.svn' should help with that.

So easy... why didn't I come up with that myself :-)

Why the depencency on Makefile.am? I assume it has something to do
with that FORCE target?

No.   I would like the files to be updated when I change the rule to
update the files.  This is arguable, something of a developer decision,
came probably from the moment I changed 'foo_version' to 'bar_version'
in the version.c rule and 'make' didn't rebuild, because the sources
were dirty before that already.

That's a very good reason to keep the dependency!

Why do you add the .git-version-t file to CLEANFILES if it gets
removed in the script?

So that an interrupted 'make' doesn't leave this file around.  'make'
removes at most the currently updated target when interrupted, but it
cannot know about other files (and with SIGQUIT or SIGKILL it can't even
remove $@, but that's not relevant here).

I didn't know about that.

Shouldn't the .git-version file be created inside the build directory,
rather than the source directory?

No.  I want the .git-version file to be distributed, so that it is
present in an extracted tarball that has no .git information.  There,
the file will be in the source directory.  Might as well have it in the
source directory in my git checkout as well then, to be consistent;
otherwise, you may end up running into one of the 'make' portability
issues documented in info Autoconf 'Make Target Lookup'.

Since the .git-version file is a generated file, I would think it belongs in the build directory, where all other generated files end up.

If I make a tarball (by running make distcheck) the version.c file is included too. But that file does not exist in the source directory, only in the build directory. So it doesn't seem to be a problem to distribute a file from the build directory.

When building from a tarball, the version file will indeed be located in the source directory. But in that case you could copy it from the source directory.

I do not understand everything that is explained in the 'Make Target Lookup' section, but it seems that not all make variants do build everything in the build directory? And that could cause problems? (Doesn't that cause trouble anyway when trying to use two different build directories with the same source directory?)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]