doc: improvements to version-stamp makefile logic.
auto merge of #4822 : graydon/rust/doc-version-stamp, r=brson

This just improves the version stamp, which was not being regenerated in cached workspaces even when the version changed. Also adds it to the pdf.