Generate VERSION files for submodules at build time.

Relates #814.
For stable release tarballs, assign submodules the same version as IMP itself.
Pick up submodule version in build dir.

Closes #814.