[build] gendate.sh for generating date strings

A new script gendate.sh is introduced for generating date strings for C
and LaTeX, production-date.h, manualdate.tex and devrefdate.tex.

It also resolves the "date -d (invalid date)" issue of #13.