move VERSION_NUM calculation to build files

This duplicates the code, but makes discid.h easier to read and
understand.