[SOLVED] 'Always Rebuild' - not quite what I wanted.

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] 'Always Rebuild' - not quite what I wanted.

    It is a common requirement to have a build time & date included in the executable.

    An easy way to do this is to have a file with something like

    C Source Code

    1. char build_date_str[] = __DATE__;
    2. char build_time_str[] = __TIME__;
    But, for that to work, it has to be re-compiled every time the project is rebuilt.

    SES has an 'Always Rebuild' option - but this will cause the affected file(s) to be rebuilt even when there is no other reason to build. Which is not quite what we want!

    So what I'm looking for is an option to compile a file every time anything else needs rebuilding - but not when the Project is otherwise "up-to-date".

    Is there a way to do this?

    If not, please could it be added as an option?
  • You could create a small tool (read: a shellscript, a python program or whatever your favorite poison is) that generates a unique timestamp in a headerfile that is included in your software. Run that in each build through the Pre-Build command settings ("Options > User Build Step > Pre-Build command" and its friends). That's how I do it.
    However, be aware there are small issues with this - there's a slightly different behavior between building from within the EDE and through emBuild.

    Alternatively, touch the module containing the __TIME__ and __DATE__ macro's before rebuilding. This can also be done through a script that runs as part of the build.

    The post was edited 1 time, last by jev ().

  • Yes - these are the usual tricks for IDEs which don't have an 'Always Build' option.

    So it's a bit frustrating that SES does have the option - but it doesn't (quite) do what I want!

    Does the SES 'Pre Build Step' run only when it's already decided that a build is necessary?
  • Aha! So what I really want is to have that option - 'when build required' or 'Always' - available on the "Always (sic) Rebuild" file option!

    I guess the "Always Rebuild" option could be changed to a "When to Rebuild" option, with 3 settings:
    1. As required (default);
    2. When any build is required;
    3. Always.
    (could have a 4th option - 'Never' - to replace the separate 'Exclude from build' option and consolidate it all into 1 setting).
  • Hello,

    Thank you for your inquiry.
    The Always Rebuild option does not have advanced conditional options. If it is set to yes it will always rebuild just as the name of the option indicates.
    We will add your proposal to our feature wish list and see if this could be added in future so the Always Rebuild option would get additional config options.

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • SEGGER - Nino wrote:

    We will add your proposal to our feature wish list and see if this could be added in future so the Always Rebuild option would get additional config options
    Thanks - either as additional options to the existing 'Always Rebuild', or as a separate new setting; eg, 'Include in Every Build'