Unconditionally add version info to the build header

This reworks the changes in #2442 so we always include the version info, regardless of whether the module is run as main or not.  This also addresses a few lint related issues.
Merge pull request #2446 from tschaub/version

Unconditionally add version info to the build header.