help-make
[Top][All Lists]
Advanced

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

Re: Version Number counting


From: Todd Showalter
Subject: Re: Version Number counting
Date: Tue, 27 Apr 2010 08:53:13 -0400

On Mon, Apr 26, 2010 at 5:39 PM, Erik Rull <address@hidden> wrote:

> I want to increase the version number automatically (script, makefile,...)
> if the structure definition of my shared library has changed.

    The robust way to do it would be to place some sort of greppable
marker in the file:

--------8<--------

/* %%%% API_STRUCTURE BEGIN %%%% */

typedef struct
{
  int foo;
  ...
} API_STRUCTURE;

/* %%%% API_STRUCTURE END %%%% */

-------->8---------

    Then, a simple tool (I'd suggest doing it in ruby, though you
could probably do it in pure make).  The tool generates two files; one
called Version.txt, and one called Version.md5.  The idea is that you
make a copy of your header file, strip it down to just the bit between
the markers and compact any whitespace (and strip any comments; your
compiler can do this for you), and then feed it to md5sum.  If the
md5sum of the stripped structure doesn't match the previously cached
one, read in the version file and bump the version number, and then
write out the new cached md5sum.

    That should give you what you want.  If you're careful about it,
you can design it so that you can version as many things as you like
this way.  I'd advise, for instance, that if you have any macros or
constants you move them inside the markers.

                                                             Todd.

-- 
 Todd Showalter, President,
 Electron Jump Games, Inc.




reply via email to

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