detect svn version
authorrpolzer <rpolzer@61c419a2-8eb2-4b30-bcec-8cead039b335>
Wed, 17 Sep 2008 13:45:02 +0000 (13:45 +0000)
committerrpolzer <rpolzer@61c419a2-8eb2-4b30-bcec-8cead039b335>
Wed, 17 Sep 2008 13:45:02 +0000 (13:45 +0000)
git-svn-id: svn://svn.icculus.org/netradiant/trunk@83 61c419a2-8eb2-4b30-bcec-8cead039b335

Makefile

index 8d82717..4ae8520 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -33,9 +33,13 @@ CP_R               ?= $(CP) -r
 RM                 ?= rm
 RM_R               ?= $(RM) -r
 TEE_STDERR         ?= | tee /dev/stderr
+TR                 ?= tr
 FIND               ?= find
 DIFF               ?= diff
 
+# optional:
+SVNVERSION         ?= svnversion
+
 STDOUT_TO_DEVNULL  ?= >/dev/null
 STDERR_TO_DEVNULL  ?= 2>/dev/null
 STDERR_TO_STDOUT   ?= 2>&1
@@ -146,6 +150,12 @@ endif
 RADIANT_VERSION = 1.5.0
 RADIANT_MAJOR_VERSION = 5
 RADIANT_MINOR_VERSION = 0
+
+SVN_VERSION := $(shell $(SVNVERSION) -n $(STDERR_TO_DEVNULL) | $(TR) -cd 0-9:)
+ifneq ($(SVN_VERSION),)
+       RADIANT_VERSION := $(RADIANT_VERSION)-svn$(SVN_VERSION)
+endif
+
 CPPFLAGS += -DRADIANT_VERSION="\"$(RADIANT_VERSION)\"" -DRADIANT_MAJOR_VERSION="\"$(RADIANT_MAJOR_VERSION)\"" -DRADIANT_MINOR_VERSION="\"$(RADIANT_MINOR_VERSION)\"" -DRADIANT_ABOUTMSG="\"$(RADIANT_ABOUTMSG)\""
 
 .PHONY: all
@@ -187,6 +197,7 @@ dependencies-check:
        checkbinary coreutils "$(RM)"; \
        checkbinary coreutils "$(RM_R)"; \
        checkbinary coreutils "$(ECHO) test $(TEE_STDERR)"; \
+       checkbinary coreutils "$(TR)"; \
        checkbinary findutils "$(FIND)"; \
        checkbinary diff "$(DIFF)"; \
        checkbinary gcc "$(CC)"; \