From 21e2b595c2797c226699cf19a2a2ad4abf22b210 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 27 Aug 2014 20:47:46 -0400 Subject: [PATCH] Prevent spurious recompiles on account of changed version. After a local commit, any file that included version.h would have to be recompiled on account of the changed version string. This changes version.h in the build directory to rbversion.h and includes the preprocessor macro from rbversion.h in firmware/common/version.c so that only that one file needs to be recompiled after a local commit rather than a whole slew of them. Change-Id: I900d97e3a24a0610698283416d97b4fa3a3a2cf6 Reviewed-on: http://gerrit.rockbox.org/937 Reviewed-by: Michael Sevakis Tested: Michael Sevakis --- firmware/common/version.c | 2 +- firmware/firmware.make | 6 +++--- firmware/include/version.h | 26 ++++++++++++++++++++++++++ tools/genversion.sh | 15 +++++++-------- 4 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 firmware/include/version.h diff --git a/firmware/common/version.c b/firmware/common/version.c index 762842c6de..bb856e4219 100644 --- a/firmware/common/version.c +++ b/firmware/common/version.c @@ -19,5 +19,5 @@ * ****************************************************************************/ -#include "version.h" +#include "rbversion.h" const char rbversion[] = RBVERSION; diff --git a/firmware/firmware.make b/firmware/firmware.make index 8e2d475683..8f8014d82c 100644 --- a/firmware/firmware.make +++ b/firmware/firmware.make @@ -47,11 +47,11 @@ $(BUILDDIR)/sysfont.o: $(SYSFONT) $(BUILDDIR)/sysfont.h $(call PRINTS,CC $(subst $(ROOTDIR)/,,$(BUILDDIR)/sysfont.c))$(CC) $(CFLAGS) -c $(BUILDDIR)/sysfont.c -o $@ SVNVERSION:=$(shell $(TOOLSDIR)/version.sh $(ROOTDIR)) -OLDSVNVERSION:=$(shell grep 'RBVERSION' $(BUILDDIR)/version.h 2>/dev/null|cut -d '"' -f 2 || echo "NOREVISION") +OLDSVNVERSION:=$(shell grep 'RBVERSION' $(BUILDDIR)/rbversion.h 2>/dev/null|cut -d '"' -f 2 || echo "NOREVISION") ifneq ($(SVNVERSION),$(OLDSVNVERSION)) -.PHONY: $(BUILDDIR)/version.h +.PHONY: $(BUILDDIR)/rbversion.h endif -$(BUILDDIR)/version.h: +$(BUILDDIR)/rbversion.h: $(call PRINTS,GEN $(@F))$(TOOLSDIR)/genversion.sh $(BUILDDIR) $(TOOLSDIR)/version.sh $(ROOTDIR) diff --git a/firmware/include/version.h b/firmware/include/version.h new file mode 100644 index 0000000000..e9e291a8c4 --- /dev/null +++ b/firmware/include/version.h @@ -0,0 +1,26 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2010 by Frank Gevaerts + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _RBVERSION_H_ +#define _RBVERSION_H_ + +extern const char rbversion[]; + +#endif /* _RBVERSION_H_ */ diff --git a/tools/genversion.sh b/tools/genversion.sh index 485263d152..bd80ceb597 100755 --- a/tools/genversion.sh +++ b/tools/genversion.sh @@ -8,22 +8,21 @@ # Usage: genversion.sh destination-dir path-to-version.sh [source-root] -# Generate version.h file +# Generate rbversion.h file # XXX DO NOT TWEAK VERSION HERE, EDIT version.sh INSTEAD VERSION=`$2 $3` -cat > "$1/_version.h" << EOF +cat > "$1/_rbversion.h" << EOF /* Generated by genversion.sh */ -extern const char rbversion[]; #define RBVERSION "$VERSION" EOF -if [ -f "$1/version.h" ] - then if diff "$1/_version.h" "$1/version.h" > /dev/null - then rm -f "$1/_version.h" - else mv "$1/_version.h" "$1/version.h" +if [ -f "$1/rbversion.h" ] + then if diff "$1/_rbversion.h" "$1/rbversion.h" > /dev/null + then rm -f "$1/_rbversion.h" + else mv "$1/_rbversion.h" "$1/rbversion.h" fi - else mv "$1/_version.h" "$1/version.h" + else mv "$1/_rbversion.h" "$1/rbversion.h" fi