This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Version information in build

Is it possible to create some kind of listing, in the compile/linking time, with file version information,taken from source control program (ClearCase in our case)?
I mean that I want to have detailed information, of what version of which file was used in current compilation.
Thank you in advance :)

Parents
  • Most source control systems have some way to insert version information into the text of the controlled files - usually by some sort of keyword expansion.

    You just need to use this to initialise some strings in code space; eg,

    code char version[] ="$_version_$";
    where $_version_$ will be replaced with real version information by the source control tool.

    You will need to read the Manual for your particular source control tool for find out precisely how it does it.

    Even without a source control tool you can get a simple timestamp by, eg,
    code char build_timestamp[] = "__DATE__" "__TIME__";
    Put this in a file - say timestamp.c - and set its project options to 'Always Rebuild'.

    http://www.keil.com/support/man/docs/c51/c51_pp_predefmacroconst.htm


    See also: http://www.keil.com/forum/docs/thread780.asp

Reply
  • Most source control systems have some way to insert version information into the text of the controlled files - usually by some sort of keyword expansion.

    You just need to use this to initialise some strings in code space; eg,

    code char version[] ="$_version_$";
    where $_version_$ will be replaced with real version information by the source control tool.

    You will need to read the Manual for your particular source control tool for find out precisely how it does it.

    Even without a source control tool you can get a simple timestamp by, eg,
    code char build_timestamp[] = "__DATE__" "__TIME__";
    Put this in a file - say timestamp.c - and set its project options to 'Always Rebuild'.

    http://www.keil.com/support/man/docs/c51/c51_pp_predefmacroconst.htm


    See also: http://www.keil.com/forum/docs/thread780.asp

Children
  • Did I get the wrong end of the stick there?

    You just want a listing, rather than to embed the information in the generated object file(s)?

    If that's the case, the solution is similar - but you just get the source control system to put the information into a comment somewhere in each file.

    The header comment for each file would seem the obvious place...

    eg,

    /* File:    blah.c
     * Version: $_version_$
     * etc...
     :
     :
     */
    Again, you need to check the documentaion for your source control system for specific details.
    I'd be surprised if it didn't actually tell you all this itself!