Makefile: fix compilation if source is not in a git repo
authorPatrick Steinhardt <ps@pks.im>
Wed, 27 Mar 2019 06:47:30 +0000 (07:47 +0100)
committerPatrick Steinhardt <ps@pks.im>
Wed, 27 Mar 2019 06:47:30 +0000 (07:47 +0100)
commit0eda3ec2ac78577a08ace4c18cd9e912a56609e6
tree13c85efe1939d2565b04cf6c52a781ae6e0b3885
parent0c9df4a809629496827fe694d42483716cfcd3da
Makefile: fix compilation if source is not in a git repo

To make the version available, the Makefile creates a "version.h"
header. This file will either contain the output of `git describe
--tags` or a fallback value that is declared inside the Makefile
itself.

This logic is broken as there is a hard dependcy on the
".git/index" file. The intent here is to regenerate the header
file whenever there is any change to the git repo itself. But in
case where vimb is for example being compiled from a tarball,
there will be no git index at all, leading to an error "No rule
to make target '.git/index'".

Fix the issue by using `$(wildcard .git/index)`. In case the file
exists, we will pick it up as a dependency of "version.h" and
thus recompile it whenever the git repo changes. Otherwise, the
wildcard won't match and we will fall back to just using the
declared value of the "version" variable.
Makefile