diff --git a/Makefile b/Makefile index 84914abb2c..67d1bbb06c 100644 --- a/Makefile +++ b/Makefile @@ -632,8 +632,11 @@ config.mak: configure @echo "####### Please run ./configure again - it's changed! #######" @echo "############################################################" -version.h: version.sh - ./$< `$(CC) -dumpversion` +version.h .version: version.sh + ./$< + +# Force version.sh to run to potentially regenerate version.h +-include .version %$(EXESUF): %.c $(CC) $(CFLAGS) -o $@ $^ @@ -855,7 +858,7 @@ driversclean: -include $(DEP_FILES) .PHONY: all doxygen locales *install* *tools drivers -.PHONY: checkheaders *clean tests +.PHONY: checkheaders *clean tests .version # Disable suffix rules. Most of the builtin rules are suffix rules, # so this saves some time on slow systems. diff --git a/configure b/configure index 1742c65686..57caa24a58 100755 --- a/configure +++ b/configure @@ -7286,8 +7286,6 @@ cmp -s "$TMPH" config.h || mv -f "$TMPH" config.h ############################################################################# -./version.sh `$_cc -dumpversion` - cat << EOF Config files successfully generated by ./configure $configuration ! diff --git a/version.sh b/version.sh index 193645b859..aaf6c1cfaa 100755 --- a/version.sh +++ b/version.sh @@ -5,8 +5,8 @@ test "$1" && extra="-$1" # Extract revision number from file used by daily tarball snapshots # or from "git describe" output git_revision=$(cat snapshot_version 2> /dev/null) -test $git_revision || test ! -d .git || git_revision=`git describe --always` -test $git_revision && git_revision=git-$git_revision +test $git_revision || test ! -d .git || git_revision=`git describe --match "v[0-9]*" --always` +git_revision=$(expr "$git_revision" : v*'\(.*\)') test $git_revision || git_revision=UNKNOWN # releases extract the version number from the VERSION file