better method to generate version.c + cleanup

Change-Id: Icded1b0e3b2472f10fa0a11be6084335eb70158e