summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c06818e)
raw | patch | inline | side by side (parent: c06818e)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 27 Dec 2005 22:40:17 +0000 (14:40 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 28 Dec 2005 01:57:28 +0000 (17:57 -0800) |
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>
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>
.gitignore | patch | blob | history | |
GIT-VERSION-GEN | [new file with mode: 0755] | patch | blob |
Makefile | patch | blob | history |
diff --git a/.gitignore b/.gitignore
index 6bd508e4be252d5afeb24db9b4ca7f0541f895ce..47d76f407e35326824360fffde440e4b4bb0ac7b 100644 (file)
--- a/.gitignore
+++ b/.gitignore
+GIT-VERSION-FILE
git
git-add
git-am
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
--- /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
+}
+
+
diff --git a/Makefile b/Makefile
index 47e78982e0c1280b650ce3ee5a9c08b7aaeef184..1b6caf85bb11e00c9d579bf79662bb05ca80827f 100644 (file)
--- a/Makefile
+++ b/Makefile
# 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.
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)
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) $<
### 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)
$(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