Do not recompile version if not needed

This commit is contained in:
thorkill 2015-07-26 12:15:17 +02:00
parent 2d38e37168
commit 529576dad6
2 changed files with 10 additions and 4 deletions

View file

@ -3,10 +3,7 @@
sbin_PROGRAMS = tincd tinc sptps_test sptps_keypair
## Make sure version.c is always rebuilt with the latest git information
.PHONY: ${srcdir}/version.c version_git.h
version_git.h:
echo >$@
-(cd $(srcdir) && git describe) && echo '#define GIT_DESCRIPTION "'`(cd $(srcdir) && git describe) | sed 's/release-//'`'"' >$@
$(eval include version_git.mak)
${srcdir}/version.c: version_git.h
if LINUX

9
src/version_git.mak Normal file
View file

@ -0,0 +1,9 @@
gitdescription_new=$(shell git describe | sed 's/^release-//')
gitdescription_old=$(shell sed 's/.*"\(.*\)".*/\1/' version_git.h)
ifneq ($(gitdescription_new), $(gitdescription_old))
version_git.h:
echo $(gitdescription_new)
echo $(gitdescription_old)
echo '#define GIT_DESCRIPTION "$(gitdescription_new)"' >$@
endif