The colon is kinder to Debian than a dash and seems stylistically
better. The dash feels as though it introduces another version level,
e.g. -rc1-alpha2. We could just do +gitXXXXXXXX but as git commit
hashes are in lowercase hexadecimal the result can be something really
ugly like +giteaf0cb71. It's also easier to select the commit hash
for a copy/paste operation when there is something to separate it.
version.h: version.h.tmp Makefile $(mtr_SOURCES)
@cat $< > $@; \
if [ -d .git ] && [ -n "$$(which git)" ]; then \
- xver="+git-$$(git rev-list -n1 --abbrev=8 --abbrev-commit HEAD)"; \
+ xver="+git:$$(git rev-list -n1 --abbrev=8 --abbrev-commit HEAD)"; \
sed \
-e "/#define *MTR_VERSION */{s/\"\([^\"]*\)\"/\"\1$$xver\"/;}" \
$< > $@; \