If you'd use versioning software like svn
or git
you may have automatic replacement of strings like $Id: $
or $Date: $
by the id or date of the particular version of the file (svn) or of the "HEAD" release (git).
Edit: For git
you can extract the sources
git archive --format=zip -9 -o project.zip HEAD file1 file2...
To replace certain strings during that process you have to tell git in .gitattributes
that you want to have things substituted:
file* export-subst
For the syntax of what and how terms between "$...$", please refer to the formats in the man page of git-log
. Just as examples I have in my code
#define P99_VERSION_DATE "$Format:%cd$"
#define P99_VERSION_ID "$Format:%H$"
Which in the distribution version of the file is
#define P99_VERSION_DATE "Thu Oct 7 23:38:43 2010 +0200"
#define P99_VERSION_ID "6f9740a6808ff50f42d24bb7b5234a904f84e6fe"