From 2c7c814e195701ea2d8295a1da8ff2bc7913adc9 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Fri, 11 Apr 2014 13:59:18 +0200 Subject: [PATCH] Generate Genode version string on each build The version string was generated when core/main.cc was rebuilt, which happens on changes in the file itself or in a header file it includes. But, the version should reflect if the Genode repository was changed at any place. Therefore, I moved the version string to its own version.cc which is forcedly rebuilt any time core is examined by the build system. @nfeske what do you think about it? Core is now relinked on any build. Fixes #551. --- base/src/core/main.cc | 7 +++++-- base/src/core/version.cc | 14 ++++++++++++++ base/src/core/version.inc | 12 +++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 base/src/core/version.cc diff --git a/base/src/core/main.cc b/base/src/core/main.cc index f032ec404..98088475c 100644 --- a/base/src/core/main.cc +++ b/base/src/core/main.cc @@ -172,7 +172,10 @@ class Core_child : public Child_policy ** Core main ** ***************/ -namespace Genode { extern bool inhibit_tracing; } +namespace Genode { + extern bool inhibit_tracing; + extern char const *version_string; +} int main() { @@ -181,7 +184,7 @@ int main() */ inhibit_tracing = true; - PINF("Genode " GENODE_VERSION); + PINF("Genode %s", Genode::version_string); PDBG("--- create local services ---"); diff --git a/base/src/core/version.cc b/base/src/core/version.cc new file mode 100644 index 000000000..fa3db8db2 --- /dev/null +++ b/base/src/core/version.cc @@ -0,0 +1,14 @@ +/* + * \brief Provide version informaion (core-only) + * \author Christian Helmuth + * \date 2014-04-11 + */ + +/* + * Copyright (C) 2014 Genode Labs GmbH + * + * This file is part of the Genode OS framework, which is distributed + * under the terms of the GNU General Public License version 2. + */ + +namespace Genode { char const *version_string = GENODE_VERSION; } diff --git a/base/src/core/version.inc b/base/src/core/version.inc index e75f69332..3bb3e9989 100644 --- a/base/src/core/version.inc +++ b/base/src/core/version.inc @@ -13,4 +13,14 @@ GENODE_VERSION := $(shell \ || \ echo "") -CC_OPT_main += -DGENODE_VERSION="\"$(GENODE_VERSION)\"" +CC_OPT_version += -DGENODE_VERSION="\"$(GENODE_VERSION)\"" + +SRC_CC += version.cc + +vpath version.cc $(BASE_DIR)/src/core + +version.o: force_version_compilation + +force_version_compilation: + +# vi: set ft=make :