build: change version number generation

Force Makefile to always run version.sh to potentially regenerate
version.h. Drop compiler version and 'git-' prefix from version
number. Match only git tags starting 'v'+number when generating
version number; leave the 'v' out from the result.
This commit is contained in:
Uoti Urpala 2011-02-19 19:01:07 +02:00
parent d9c79b7dc6
commit e786c70de9
3 changed files with 8 additions and 7 deletions

View File

@ -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.

2
configure vendored
View File

@ -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 !

View File

@ -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