diff --git a/Makefile b/Makefile index b6a8be24..73a1e3de 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/source/network/networkops.cpp b/source/network/networkops.cpp index 9edb91a0..b6c35564 100644 --- a/source/network/networkops.cpp +++ b/source/network/networkops.cpp @@ -16,6 +16,7 @@ #include "settings/cfg.h" #include "main.h" #include "http.h" +#include "svnrev.h" #define PORT 4299 diff --git a/source/prompts/PromptWindows.cpp b/source/prompts/PromptWindows.cpp index 8e8dd510..b241fc3c 100644 --- a/source/prompts/PromptWindows.cpp +++ b/source/prompts/PromptWindows.cpp @@ -28,6 +28,7 @@ #include "wad/wad.h" #include "unzip/unzip.h" #include "zlib.h" +#include "svnrev.h" /*** Variables that are also used extern ***/ diff --git a/svnrev.sh b/svnrev.sh new file mode 100644 index 00000000..5632717a --- /dev/null +++ b/svnrev.sh @@ -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