aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--Makefile.common44
2 files changed, 32 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 54f6ea4ed3..2395511ee3 100644
--- a/Makefile
+++ b/Makefile
@@ -30,10 +30,6 @@ CXXFLAGS+= -Wshadow -Wimplicit -Wnon-virtual-dtor -Wwrite-strings
# Disable RTTI and exceptions, and enabled checking of pointers returned by "new"
CXXFLAGS+= -fno-rtti -fno-exceptions -fcheck-new
-ifneq "$(SCUMMVM_SVN_REVISION)" ""
-CXXFLAGS+= -DSCUMMVM_SVN_REVISION=\"$(SCUMMVM_SVN_REVISION)\"
-endif
-
# There is a nice extra warning that flags variables that are potentially
# used before being initialized. Very handy to catch a certain kind of
# bugs. Unfortunately, it only works when optimizations are turned on,
diff --git a/Makefile.common b/Makefile.common
index a1a6cac9ea..d189838c23 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -111,19 +111,45 @@ endif
######################################################################
-# Create the files that depend on the version
+# Get the current version information
######################################################################
-VERSION_FILES = \
- $(srcdir)/dists/iphone/Info.plist \
- $(srcdir)/dists/macosx/Info.plist
-
-VERSION = $(shell tail -1 "${srcdir}/base/internal_version.h" | cut -d\" -f2)
+VERSION = $(shell grep SCUMMVM_VERSION "${srcdir}/base/internal_version.h" | cut -d\" -f2)
VER_MAJOR = $(shell echo $(VERSION) | cut -d. -f 1)
VER_MINOR = $(shell echo $(VERSION) | cut -d. -f 2)
VER_PATCH = $(shell echo $(VERSION) | cut -d. -f 3 | cut -c1)
VER_EXTRA = $(shell echo $(VERSION) | cut -d. -f 3 | cut -c2-)
+
+######################################################################
+# Get Subversion's working copy information
+######################################################################
+
+ifeq ($(shell svn stat $(srcdir) 2>&1 | grep "is not a working copy"),)
+SVNROOT := $(srcdir)
+ifeq ($(origin SVNREV), undefined)
+# Get the working copy base revision
+VER_SVNREV := $(shell svn info $(SVNROOT) | grep "^Revision" | cut -d ' ' -f 2)
+endif
+else
+SVNROOT := https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/
+endif
+
+# Define the Subversion revision if available, either autodetected or
+# specified by the user
+ifneq ($(origin VER_SVNREV), undefined)
+CXXFLAGS+= -DSCUMMVM_SVN_REVISION=\"$(VER_SVNREV)\"
+endif
+
+
+######################################################################
+# Create the files that depend on the version
+######################################################################
+
+VERSION_FILES = \
+ $(srcdir)/dists/iphone/Info.plist \
+ $(srcdir)/dists/macosx/Info.plist
+
$(VERSION_FILES): %: %.in
@echo "Creating $@"
@cat $< | sed \
@@ -149,12 +175,6 @@ DISTNAME := scummvm-$(DISTVERSION)
DISTDIR := dist
VERFILE := $(DISTDIR)/$(DISTNAME)/base/internal_version.h
-ifeq ($(shell svn stat $(srcdir) 2>&1 | grep "is not a working copy"),)
-SVNROOT := $(srcdir)
-else
-SVNROOT := https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/
-endif
-
$(VERFILE): $(srcdir)/base/internal_version.h
@$(RM_REC) $(DISTDIR)
@$(MKDIR) $(DISTDIR)