os/os2/svn_version.mak
changeset 1525 47f8859113ad
equal deleted inserted replaced
1524:d5cb3a8cfddc 1525:47f8859113ad
       
     1 all : rev.c
       
     2 
       
     3 # What revision are we compiling, if we have an idea?
       
     4 REV_NUMBER := $(shell if test -d .svn; then svnversion . | tr -dc 0-9; fi)
       
     5 
       
     6 ifdef RELEASE
       
     7 REV:=$(RELEASE)
       
     8 else
       
     9 REV := $(shell if test -d .svn; then svnversion . | awk '{ print "r"$$0 }'; fi)
       
    10 tmp_test:=$(shell echo "$(REV)" | grep "M" )
       
    11 ifdef tmp_test
       
    12 REV_NUMBER:=1
       
    13 endif
       
    14 endif
       
    15 
       
    16 ifndef REV_NUMBER
       
    17 REV_NUMBER:=0
       
    18 endif
       
    19 
       
    20 rev.c: FORCE
       
    21 	@# setting the revision number in a place, there the binary can read it
       
    22 	@echo 'const char _openttd_revision[] = "$(REV)";' >>rev.c.new
       
    23 	@echo 'const int _revision_number = $(REV_NUMBER);' >>rev.c.new
       
    24 	@# some additions for MorphOS versions tag
       
    25 	@echo '#ifdef __MORPHOS__'  >>rev.c.new
       
    26 	@echo 'const char morphos_versions_tag[] = "\\0$$VER: OpenTTD $(REV) ('${BUILDDATE}') © OpenTTD Team [MorphOS, PowerPC]";'  >>rev.c.new
       
    27 	@echo '#endif' >>rev.c.new
       
    28 	@# Only update the real rev.c if it actually changed, to prevent
       
    29 	@# useless rebuilds.
       
    30 	@cmp -s rev.c rev.c.new 2>/dev/null || mv rev.c.new rev.c
       
    31 	@rm -f rev.c.new
       
    32 
       
    33 FORCE:
       
    34