How to amend to firmware version

Can anyone explain how we can amend the reported firmware version with some extra information when we compile it?

We would like to add some information to it for our internal version tracking.

Imported from wikidot