* insert last SVN-Rev (#define SVN_REV) also in use of TortoiseSVN

* all files that refere SVN_REV are automatically recompile
This commit is contained in:
ardi@ist-einmalig.de 2009-07-24 16:16:31 +00:00
parent a66f10db11
commit f3296b3570
4 changed files with 21 additions and 2 deletions

View File

@ -21,13 +21,12 @@ SOURCES := source source/libwiigui source/images source/fonts source/sounds \
source/usbloader source/xml source/network source/settings source/prompts \
source/ramdisc source/wad source/banner source/cheats source/homebrewboot
INCLUDES := source
SVNDEV := -D'SVN_REV="$(shell svnversion -n ..)"'
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -save-temps -Wall $(SVNDEV) $(MACHDEP) $(INCLUDE)
CFLAGS = -g -O2 -save-temps -Wall $(MACHDEP) $(INCLUDE)
CXXFLAGS = -Xassembler -aln=$@.lst $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80c00000
@ -124,6 +123,7 @@ release:
else
DEPENDS := $(OFILES:.o=.d)
SVNREV := $(shell ../svnrev.sh)
#---------------------------------------------------------------------------------
# main targets

View File

@ -16,6 +16,7 @@
#include "settings/cfg.h"
#include "main.h"
#include "http.h"
#include "svnrev.h"
#define PORT 4299

View File

@ -28,6 +28,7 @@
#include "wad/wad.h"
#include "unzip/unzip.h"
#include "zlib.h"
#include "svnrev.h"
/*** Variables that are also used extern ***/

17
svnrev.sh Normal file
View File

@ -0,0 +1,17 @@
#! /bin/sh
#
a=$(svnversion -n ..)
[ -n "$a" ] || a=$(SubWCRev .. | tr -d '\n' | sed 's/[^0-9]*\([0-9]*\).*/\1/')
[ -f ../source/svnrev.h ] || touch ../source/svnrev.h
b=$(cat ../source/svnrev.h | tr -d '\n' | sed 's/[^0-9]*\([0-9]*\).*/\1/')
if [ $a -ne $b ]; then
echo '#ifndef SVNREV_H' > ../source/svnrev.h
echo ' #define SVNREV_H' >> ../source/svnrev.h
echo ' #define SVN_REV "'$a'"' >> ../source/svnrev.h
echo '#endif /* SVNREV_H */' >> ../source/svnrev.h
echo 'svnrev.h changed' >&2
fi
echo $a