snestracker icon indicating copy to clipboard operation
snestracker copied to clipboard

Add git commit hash to build number

Open bazz1tv opened this issue 4 years ago • 0 comments

In order to keep track of binary versions, do as titled.

After some research ( https://stackoverflow.com/questions/6526451/how-to-include-git-commit-number-into-a-c-executable ), it seems the best way is to add some steps at the beginning of the linker stage in Makefile.

# pipe declaration of string constant into gcc for compilation as an object file

# link as normal

Then in source code organization.h, add an extern to that linked variable.

snestracker will then have a version output like "v0.1.0-123bcd" Signifying the predominant version and commit.

There should also be a compile-time Toggle to not include the hash when providing the version string.

bazz1tv avatar Jun 05 '20 08:06 bazz1tv