[D1] Include -devel-HASH(-dirty) in the version string

When not compiled with `make RELEASE=1`, the version string will include
a suffix with the exact version information based on the git hash. Also,
if the current working tree is dirty (it have uncommitted changed) an
extra suffix will be added (-dirty).

When using `make RELEASE=1` only the version information present in the
VERSION file will be used.

This is the D1 counterpart of #1737.