diff options
author | Junio C Hamano <junkio@cox.net> | 2005-12-27 14:40:17 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2005-12-27 17:57:28 -0800 |
commit | 9b88fcef7dd6327cc3aba3927e56fef6f6c4d628 (patch) | |
tree | a2cb7dd3ca1ea6ac13e20e97819ed7e112e33bdd | |
parent | c06818e20a88f58294de0a948a437c7c32c382fe (diff) | |
download | git-9b88fcef7dd6327cc3aba3927e56fef6f6c4d628.tar.gz |
Makefile: use git-describe to mark the git version.
Note: with this commit, the GIT maintainer workflow must change.
GIT-VERSION-GEN is now the file to munge when the default
version needs to be changed, not Makefile. The tag needs to be
pushed into the repository to build the official tarball and
binary package beforehand.
Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | GIT-VERSION-GEN | 18 | ||||
-rw-r--r-- | Makefile | 20 |
3 files changed, 34 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore index 6bd508e4be..47d76f407e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +GIT-VERSION-FILE git git-add git-am diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN new file mode 100755 index 0000000000..196402ce66 --- /dev/null +++ b/GIT-VERSION-GEN @@ -0,0 +1,18 @@ +#!/bin/sh + +GVF=GIT-VERSION-FILE + +VN=$(git describe --abbrev=4 HEAD 2>/dev/null) || VN=v1.0.GIT +VN=$(expr "$VN" : v'\(.*\)') +if test -r $GVF +then + VC=$(sed -e 's/^GIT_VERSION = //' <$GVF) +else + VC=unset +fi +test "$VN" = "$VC" || { + echo >&2 "GIT_VERSION = $VN" + echo "GIT_VERSION = $VN" >$GVF +} + + @@ -55,7 +55,9 @@ all: # Define USE_STDEV below if you want git to care about the underlying device # change being considered an inode change from the update-cache perspective. -GIT_VERSION = 1.0.GIT +GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE + @sh ./GIT-VERSION-GEN +-include GIT-VERSION-FILE # CFLAGS and LDFLAGS are for the users to override from the command line. @@ -369,7 +371,7 @@ all: $(ALL_PROGRAMS) all: $(MAKE) -C templates -git$X: git.c $(LIB_FILE) Makefile +git$X: git.c $(LIB_FILE) $(CC) -DGIT_EXEC_PATH='"$(bindir)"' -DGIT_VERSION='"$(GIT_VERSION)"' \ $(CFLAGS) $(COMPAT_CFLAGS) -o $@ $(filter %.c,$^) $(LIB_FILE) @@ -398,8 +400,12 @@ $(patsubst %.py,%,$(SCRIPT_PYTHON)) : % : %.py git-cherry-pick: git-revert cp $< $@ -# format-patch records GIT_VERSION -git-format-patch: Makefile +# These can record GIT_VERSION +git$X git.spec \ + $(patsubst %.sh,%,$(SCRIPT_SH)) \ + $(patsubst %.perl,%,$(SCRIPT_PERL)) \ + $(patsubst %.py,%,$(SCRIPT_PYTHON)) \ + : GIT-VERSION-FILE %.o: %.c $(CC) -o $*.o -c $(ALL_CFLAGS) $< @@ -475,7 +481,7 @@ install-doc: ### Maintainer's dist rules -git.spec: git.spec.in Makefile +git.spec: git.spec.in sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@ GIT_TARNAME=git-$(GIT_VERSION) @@ -510,4 +516,8 @@ clean: $(MAKE) -C Documentation/ clean $(MAKE) -C templates clean $(MAKE) -C t/ clean + rm -f GIT-VERSION-FILE + +.PHONY: all install clean +.PHONY: .FORCE-GIT-VERSION-FILE |