Compilation number

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Compilation number

1,025 Views
Teckna
Contributor V

Hi everyone,

 

Is there the way to have a variable to count the number of successful compilations of a project? This variable should be used in the firmware and should be auto incremented everytime the building process terminate ok.

 

Many thanks,

Teckna

Labels (1)
Tags (1)
0 Kudos
Reply
6 Replies

684 Views
CrasyCat
Specialist III

Hello

There is no such feature available inside of CodeWarrior.

If you wish to get something like that implemented you need to implement that manually.

On the other side I do not understand why you would capture the number of time the application has been built.

Wouldn't it be better to keep a firmware version number string that you increment each time you make an update to the project?

 

CrasyCat

0 Kudos
Reply

684 Views
Teckna
Contributor V

Thanks for your answer CrasyCat,

The solution you suggest is the one I use in another project with another compiler: at every successful compilation a script is called that increment the firmware version number in a file.

I tried the same approch in Codewarrior 10.1 (now I use 10.2) with the post build steps, but this way when I ran the build process again, the compilation was ran (and the version number was incremented once again) even if there was no modification in source files: the problem is that the file containing the firmware version is modified by the script is included in another file, so this file is in the dependency list for the compilation process.

Example:

File build.c

#include "build_no.h"

...

File build_no.h

#define BUILD_NO xxx

...

The script updates the xxx number at the end of the successful compilation and link, after the end of the process, so the build_no.h is modified from the last compilation. When I run the compilation again, even if the is no modification in the source files, the build.c file is compiled because of the modification of the build_no.h file.

My question is: is there a way to exclude a file from the dependecy list?

Many thanks

Teckna

0 Kudos
Reply

684 Views
CrasyCat
Specialist III

Hello

I did search on Google as well and I did not find a way to remove a file from the dependency list.

Only solution I see so far is to disable automatic generation of make file (i.e maintain your make file manually)

Now did you consider using a version control system software? This should allow you to manage software version numbers and most of the CVS have plug ins to integrate into Eclipse.

CrasyCat

0 Kudos
Reply

684 Views
Teckna
Contributor V


Thanks CrasyCat,

I've seen that a *.d file is generated for every *.c file in the project; this *.d file seems to contain the dependency list for the corresponding *.c file and I think that it could be included in the makefile.

So my question is: is there a way to disable automatic generation of makefile for an individual fiile or is it a global setting affecting all the files in the project?

Many thanks

Teckna

0 Kudos
Reply

684 Views
CrasyCat
Specialist III

Hello

You are right. The .d file is the file containing the dependency for a given source file.

Disabling automatic generation of makefile is a global settings. It affects the whole project. You cannot do that for a single source file.

What might be working (but I never tried it actually) is the following:

  • Create a project generating a static library where you place all the source code except the file where you include the version.h file. In this project use the automatic makefile generation.
  • Create a second project including just the source file when version.h is included. Make it generate an application.
  • Define a dependency between the 2 projects.
  • Once you have generated the required files for the build, disable automatic generation of the makefile and remove version.h from the .d file.

From this point, if anything changes in the library or in the application (except for version,h file) there will be a rebuild of the application.

As I said before I never tried that but from the logic of the tool-chain this might work.

CrasyCat

0 Kudos
Reply

684 Views
Teckna
Contributor V

Many thanks,

I will try your solution.

Teckna

0 Kudos
Reply