Author Topic: Changing revision/version number on compiling  (Read 1213 times)

0 Members and 1 Guest are viewing this topic.

Offline Simon Small

Changing revision/version number on compiling
« on: March 24, 2014, 09:56:32 PM »
I have been playing Simutrans, and messing around with the source code and compiling. I have managed to compile the run time executable, which I have also used to run a game. At the moment my compiled run time has the same version as the pre-compiled file, and I would like to have them show as different numbers. I only plan to use my compiled version on my computer, but would like to know the version of the source code, and the number of times I had compiled it myself, so I know when to update my code. I want to test any changes that I make before submitting them here (I don't think there will be many)

How does the versioning work? I have looked at simversion.h and could use the patch number, but I am not sure what that is used for officially. I also see mentioned a revision.h file, but I cannot find what should be in that file. What is the best way of handling version numbers shown in the played game?

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4578
  • Total likes: 167
  • Helpful: 106
  • Languages: EN, NO
Re: Changing revision/version number on compiling
« Reply #1 on: March 25, 2014, 05:36:30 AM »
When building with make and GCC, the version number is specified as a -D parameter on the command line. This is not part of of make's up-to-date check, which only looks at file dates. If a revision.h file is used, as is done for MSVC++, would on the other hand cause the build to never be considered up-to-date, as revision.h is always updated at the start of each build (even if it's with the same contents). I've seen a few hacks to avoid always updating revision.h, which typically involves creating another file, diffing it against revision.h, and replacing the latter with the former if they are different. This does however require diff, which may not be installed by default, at least for mingw (haven't checked).

So far, I just delete simsys*.o before every build if I really care about the revision number. Since I check the SVN log before updating, I skip this step if there are trivial changes.