Changeset - r6812:2b2e29b47062
[Not reviewed]
master
0 2 0
rubidium - 17 years ago 2007-06-07 00:25:49
rubidium@openttd.org
(svn r10051) -Add: git "version" detection so we've got at least some indication what version we're playing when using git ;)
2 files changed with 21 insertions and 1 deletions:
0 comments (0 inline, 0 general)
Makefile.src.in
Show inline comments
 
@@ -93,14 +93,21 @@ 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
 
REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
 
# Find the revision like: rXXXX-branch
 
REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branch/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
 
else
 
# Are we a git dir?
 
ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1)
 
# Find the revision like: rXXXXM
 
REV := g$(shell if head=`git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(shell if git diff-index HEAD | read dummy; then echo M; fi)$(shell git branch|grep '*'|sed 's/\* /-/;s/^-master$$//')
 
endif
 
endif
 
endif
 

	
 
# Make sure we have something in REV
 
ifeq ($(REV),)
 
REV := norev000
 
endif
 

	
 
# This helps to recompile if flags change
config.lib
Show inline comments
 
@@ -630,16 +630,29 @@ check_params() {
 

	
 
			sleep 5
 
		elif [ -f "$ROOT_DIR/version" ]; then
 
			revision="`cat $ROOT_DIR/version`"
 

	
 
			log 1 "checking revision... $revision"
 
		elif [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help`" ]; then
 
			revision=""
 
			log 1 "checking revision... svn detection"
 
		elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help`" ]; then
 
			revision=""
 
			log 1 "checking revision... git detection"
 
		else
 
			revision=""
 
			log 1 "checking revision... no detection"
 
			log 1 "WARNING: there is no means to determine the version."
 
			log 1 "WARNING: please use a subversion or git checkout of OpenTTD."
 
			log 1 "WARNING: this version will be allowed by all game servers,"
 
			log 1 "WARNING: but you will be kicked from all incompatible"
 
			log 1 "WARNING: servers as you will desync."
 
			log 1 "WARNING: USE WITH CAUTION!"
 

	
 
			log 1 "checking revision... svn detection"
 
			sleep 5
 
		fi
 
	fi
 
}
 

	
 
make_cflags_and_ldflags() {
 
	# General CFlags for BUILD
0 comments (0 inline, 0 general)