Use printf instead of echo

printf is just more portable, see
a058963931be5b309781dbdc3681a6812b1a6622 for a similar commit for D2.
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.
Merge pull request #1780 from leandro-lucarella-sociomantic/devel-version-d1

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