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.
This commit is contained in:
Christian Helmuth 2014-04-11 13:59:18 +02:00
parent a7bc8bac9a
commit 2c7c814e19
3 changed files with 30 additions and 3 deletions

View File

@ -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 ---");

14
base/src/core/version.cc Normal file
View File

@ -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; }

View File

@ -13,4 +13,14 @@ GENODE_VERSION := $(shell \
|| \
echo "<unknown version>")
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 :