Re: Versioning of tree

Sam Ravnborg
2004-10-27T11:37:14Z

> On Tue, Oct 26, 2004 at 09:08:15PM +0200, Sam Ravnborg wrote:
>> On Tue, Oct 26, 2004 at 08:26:33AM -0400, Ryan Anderson wrote:
>> > > Surely there's no need for this? Can't the script spit out an
>> > > appropriate localversion* file instead?
>> >
>> > It can, and yes, my first version used that method.
>> >
>> > Except it never worked. I was able to generate the file before
>> > include/linux/version.h was rebuilt, but failed to get it picked up in
>> > that. I'm not really sure why.
>>
>> The $(wildcard ...) function was executed before you created the file.
>
> Can you explain why?

GNU make distingush between ":=" and "=".
An assignment made using ":=" is done immediatly.
So when make first encounter ":=" is will execute the $(wildcard ...)
function, long
before you create the localversion-bk file.

If instead "=" is used the evaluation will be deferred until you actually
dereference the variable - so here the localversion-bk fiel may well be
created.

>
>> If we shall retreive the version from a SCM then as you already do
>> must hide it in a script.
>
>> I want the script only to be executed when we actually ask kbuild to
>> build a kernel - so it has to be part of the prepare rule set.
>
> As part of the prepare ruleset, should I simply add a prepare3 (and hook
> it in appropriately), or do you mean, just have it in the same section
The prepare part is more or less made to have full control on order of
the rules - so a make -j 50 goes well.
So just hooking it under prepare1 should do the trick.

>
> The patch below has both the Perl and shell script in it, as well as the
> added config option to disable this feature.

Will take a look when I'm on my Linux box.

Sam