summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/firmware.make7
-rwxr-xr-xtools/genversion.sh5
2 files changed, 8 insertions, 4 deletions
diff --git a/firmware/firmware.make b/firmware/firmware.make
index 8f8014d82c..3d79837871 100644
--- a/firmware/firmware.make
+++ b/firmware/firmware.make
@@ -46,7 +46,10 @@ $(BUILDDIR)/sysfont.o: $(SYSFONT) $(BUILDDIR)/sysfont.h
46 $(call PRINTS,CONVBDF $(subst $(ROOTDIR)/,,$<))$(TOOLSDIR)/convbdf -l $(MAXCHAR) -c -o $(BUILDDIR)/sysfont.c $< 46 $(call PRINTS,CONVBDF $(subst $(ROOTDIR)/,,$<))$(TOOLSDIR)/convbdf -l $(MAXCHAR) -c -o $(BUILDDIR)/sysfont.c $<
47 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$(BUILDDIR)/sysfont.c))$(CC) $(CFLAGS) -c $(BUILDDIR)/sysfont.c -o $@ 47 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$(BUILDDIR)/sysfont.c))$(CC) $(CFLAGS) -c $(BUILDDIR)/sysfont.c -o $@
48 48
49SVNVERSION:=$(shell $(TOOLSDIR)/version.sh $(ROOTDIR)) 49# GNU make (at least) has a bug/feature that exported variable are not available
50# in the shell function (but are in recipe). Thus we need to explicitely pass
51# the VERSION environement variable
52SVNVERSION:=$(shell VERSION='$(VERSION)' $(TOOLSDIR)/version.sh $(ROOTDIR))
50OLDSVNVERSION:=$(shell grep 'RBVERSION' $(BUILDDIR)/rbversion.h 2>/dev/null|cut -d '"' -f 2 || echo "NOREVISION") 53OLDSVNVERSION:=$(shell grep 'RBVERSION' $(BUILDDIR)/rbversion.h 2>/dev/null|cut -d '"' -f 2 || echo "NOREVISION")
51 54
52ifneq ($(SVNVERSION),$(OLDSVNVERSION)) 55ifneq ($(SVNVERSION),$(OLDSVNVERSION))
@@ -54,4 +57,4 @@ ifneq ($(SVNVERSION),$(OLDSVNVERSION))
54endif 57endif
55 58
56$(BUILDDIR)/rbversion.h: 59$(BUILDDIR)/rbversion.h:
57 $(call PRINTS,GEN $(@F))$(TOOLSDIR)/genversion.sh $(BUILDDIR) $(TOOLSDIR)/version.sh $(ROOTDIR) 60 $(call PRINTS,GEN $(@F))$(TOOLSDIR)/genversion.sh $(BUILDDIR) $(SVNVERSION)
diff --git a/tools/genversion.sh b/tools/genversion.sh
index bd80ceb597..c385c36924 100755
--- a/tools/genversion.sh
+++ b/tools/genversion.sh
@@ -6,19 +6,20 @@
6# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7# \/ \/ \/ \/ \/ 7# \/ \/ \/ \/ \/
8 8
9# Usage: genversion.sh destination-dir path-to-version.sh [source-root] 9# Usage: genversion.sh destination-dir version
10 10
11# Generate rbversion.h file 11# Generate rbversion.h file
12 12
13# XXX DO NOT TWEAK VERSION HERE, EDIT version.sh INSTEAD 13# XXX DO NOT TWEAK VERSION HERE, EDIT version.sh INSTEAD
14 14
15VERSION=`$2 $3` 15VERSION="$2"
16 16
17cat > "$1/_rbversion.h" << EOF 17cat > "$1/_rbversion.h" << EOF
18/* Generated by genversion.sh */ 18/* Generated by genversion.sh */
19#define RBVERSION "$VERSION" 19#define RBVERSION "$VERSION"
20EOF 20EOF
21 21
22# Don't touch rbversion.h if it hasn't change, to avoid rebuilding stuff
22if [ -f "$1/rbversion.h" ] 23if [ -f "$1/rbversion.h" ]
23 then if diff "$1/_rbversion.h" "$1/rbversion.h" > /dev/null 24 then if diff "$1/_rbversion.h" "$1/rbversion.h" > /dev/null
24 then rm -f "$1/_rbversion.h" 25 then rm -f "$1/_rbversion.h"