diff options
author | Steven Noonan <steven@uplinklabs.net> | 2009-10-25 10:14:30 -0700 |
---|---|---|
committer | Steven Noonan <steven@uplinklabs.net> | 2009-10-25 10:18:59 -0700 |
commit | cacd371bee57f00fd9eddac70570401495a7157f (patch) | |
tree | 24727e286adf0e826c523da772f2ff556c886469 | |
parent | b127eb5181fb4f1b26a794bc083c0ea85c2d3d6e (diff) | |
download | crawl-ref-cacd371bee57f00fd9eddac70570401495a7157f.tar.gz crawl-ref-cacd371bee57f00fd9eddac70570401495a7157f.zip |
makefile: allow build.h to be generated based on git-merge-base
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
-rw-r--r-- | crawl-ref/source/makefile | 6 | ||||
-rwxr-xr-x | crawl-ref/source/util/gen_ver.pl | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/crawl-ref/source/makefile b/crawl-ref/source/makefile index 1b36d16eb4..da620bbf7c 100644 --- a/crawl-ref/source/makefile +++ b/crawl-ref/source/makefile @@ -142,6 +142,10 @@ ifdef NEED_STATIC LDFLAGS += -static endif +ifdef USE_MERGE_BASE +MERGE_BASE := $(shell git merge-base HEAD $(USE_MERGE_BASE)) +endif + # Permissions to set on the game executable. MCHMOD := 2755 @@ -605,7 +609,7 @@ compflag.h: $(QUIET_GEN)util/gen-cflg.pl compflag.h "$(CFLAGS)" "$(CFLAGS_L)" "$(LDFLAGS)" build.h: - $(QUIET_GEN)util/gen_ver.pl $@ + $(QUIET_GEN)util/gen_ver.pl $@ $(MERGE_BASE) version.cc: build.h compflag.h diff --git a/crawl-ref/source/util/gen_ver.pl b/crawl-ref/source/util/gen_ver.pl index a82486380f..4902be79a9 100755 --- a/crawl-ref/source/util/gen_ver.pl +++ b/crawl-ref/source/util/gen_ver.pl @@ -11,6 +11,11 @@ my $cwd = cwd; my $in_git = 1; my $scriptpath = dirname($0); my $outfile = $ARGV[0]; +my $mergebase = $ARGV[1]; + +if (!$mergebase) { + $mergebase = ""; +} my $releasever; @@ -22,7 +27,7 @@ mkdir dirname($outfile); my $verstring = ""; -$verstring = `git describe --tags --long 2> /dev/null || git describe --tags 2> /dev/null`; +$verstring = `git describe --tags --long $mergebase 2> /dev/null || git describe --tags $mergebase 2> /dev/null`; if (!$verstring) { print STDERR "WARNING: Couldn't get revision information from Git. Using $scriptpath/release_ver.\n"; @@ -80,7 +85,7 @@ if ( !$build ) { # Old versions of git omit the commits-since-tag number, # so we can try 'git rev-list' to get this instead. if ( $commit == 0 && $in_git ) { - $commit = `git rev-list $tag.. | wc -l` + $commit = `git rev-list $tag..$mergebase | wc -l` } if ( $commit == 0 ) { |