summaryrefslogtreecommitdiff
path: root/Makefile.src.in
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2008-09-07 13:24:49 +0000
committermatthijs <matthijs@openttd.org>2008-09-07 13:24:49 +0000
commit6cf61714ca18fbee15fcb127246420922b13f078 (patch)
treedf4f2ec9532b053c653eec3d2f2c7d4ba55a7c6a /Makefile.src.in
parent3b7ffcf7593ad1339845ee3c8abbcd958102ef6e (diff)
downloadopenttd-6cf61714ca18fbee15fcb127246420922b13f078.tar.xz
(svn r14261) -Change [Makefile]: Move the revision detection code from Makefile.src.in to a
new bash script findversion.sh. This commit should have no functional changes.
Diffstat (limited to 'Makefile.src.in')
-rw-r--r--Makefile.src.in56
1 files changed, 9 insertions, 47 deletions
diff --git a/Makefile.src.in b/Makefile.src.in
index 5202809e2..98e06abcb 100644
--- a/Makefile.src.in
+++ b/Makefile.src.in
@@ -9,6 +9,7 @@ CFLAGS = !!CFLAGS!!
CFLAGS_BUILD = !!CFLAGS_BUILD!!
LIBS = !!LIBS!!
LDFLAGS = !!LDFLAGS!!
+ROOT_DIR = !!ROOT_DIR!!
BIN_DIR = !!BIN_DIR!!
LANG_DIR = !!LANG_DIR!!
SRC_OBJS_DIR = !!SRC_OBJS_DIR!!
@@ -87,58 +88,19 @@ $(LANG_OBJS_DIR)/$(STRGEN):
$(LANG_OBJS_DIR)/table/strings.h: $(LANG_DIR)/english.txt $(LANG_OBJS_DIR)/$(STRGEN)
$(MAKE) -C $(LANG_OBJS_DIR) table/strings.h
+# Always run version detection, so we always have an accurate modified
+# flag
+VERSIONS := $(shell AWK="$(AWK)" "$(ROOT_DIR)/findversion.sh")
+MODIFIED := $(shell echo "$(VERSIONS)" | cut -f 3)
-# Determine if we are using a modified version
-ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1)
-REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
-else
-# Are we a git dir?
-ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1)
-REV_MODIFIED := $(shell if cd "$(SRC_DIR)/.." && git diff-index HEAD src | read dummy; then echo M; fi)
-else
-# Are we a hg (Mercurial) dir?
-ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1)
-REV_MODIFIED := $(shell if hg status $(SRC_DIR) | grep -v '^?' | read dummy; then echo M; fi)
-else
-MODIFIED="1"
-endif
-endif
-endif
-
-ifneq ($(MODIFIED),"1")
-ifeq ($(REV_MODIFIED),)
-MODIFIED="0"
-else
-MODIFIED="2"
-endif
-endif
-
-# Make the revision number
ifdef REVISION
+# Use specified revision (which should be of the form "r000").
REV := $(REVISION)
REV_NR := $(shell echo $(REVISION) | sed "s/[^0-9]//g")
else
-# Are we a SVN dir?
-ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1)
-# Find if the local source if modified
-# Find the revision like: rXXXXM-branch
-REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branches/ { split($$2, a, "/"); for(i in a) if (a[i]=="branches") { BRANCH="-"a[i+1]; break } } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
-REV_NR := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^Last Changed Rev:/ { print $$4 }')
-else
-# Are we a git dir?
-ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1)
-# Find the revision like: gXXXXM-branch
-REV := g$(shell if head=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(REV_MODIFIED)$(shell git branch|grep '[*]' | sed 's/\* /-/;s/^-master$$//')
-REV_NR := $(shell LC_ALL=C cd "$(SRC_DIR)/.." && git log --pretty=format:%s src | grep "^(svn r[0-9]*)" | head -n 1 | sed "s/.*(svn r\([0-9]*\)).*/\1/" )
-else
-# Are we a hg (Mercurial) dir?
-ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1)
-# Find the revision like: hXXXXM-branch
-REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -d: -f3 | cut -c1-8; fi)$(REV_MODIFIED)$(shell hg branch | sed 's/^/-/;s/^-default$$//')
-REV_NR := $(shell LC_ALL=C hg log -k "svn" -l 1 --template "{desc}\n" $(SRC_DIR) | grep "^(svn r[0-9]*)" | head -n 1 | sed "s/.*(svn r\([0-9]*\)).*/\1/" )
-endif
-endif
-endif
+# Use autodetected revisions
+REV := $(shell echo "$(VERSIONS)" | cut -f 1)
+REV_NR := $(shell echo "$(VERSIONS)" | cut -f 2)
endif
# Make sure we have something in REV and REV_NR