diff --git a/src/OpenFOAM/global/global.Cver b/src/OpenFOAM/global/global.Cver index e67b67b22a8352e2c27cb78564f6505f461cbb83..e2f411603eef4a7fc527b7f53d56731ac0b959e3 100644 --- a/src/OpenFOAM/global/global.Cver +++ b/src/OpenFOAM/global/global.Cver @@ -23,20 +23,19 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Description - Define the globals used in the FOAM library. It is important that these - are constructed in the appropriate order to avoid the use of unconstructed - data in the global namespace. + Define the globals used in the OpenFOAM library. + It is important that these are constructed in the appropriate order to + avoid the use of unconstructed data in the global namespace. - This file has the extension .ver to force it to be parsed by the script - which converts WM_PROJECT_VERSION into the appropriate version number - string. + This file has the extension .Cver to trigger a Makefile rule that converts + WM_PROJECT_VERSION into the appropriate version string. \*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "foamVersion.H" -const char* const Foam::FOAMversion = WM_PROJECT_VERSION; +const char* const Foam::FOAMversion = "WM_PROJECT_VERSION"; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Setup an error handler for the global new operator @@ -51,7 +50,7 @@ const char* const Foam::FOAMversion = WM_PROJECT_VERSION; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "JobInfo.H" -bool Foam::JobInfo::constructed = false; +bool Foam::JobInfo::constructed(false); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Global error definitions (initialised by construction) diff --git a/wmake/rules/General/version b/wmake/rules/General/version index 3584779c67b8bcc7f7e9b056fda9349b0d8233d8..64f272ed088a902d615f7d771bac5c432bc2c625 100644 --- a/wmake/rules/General/version +++ b/wmake/rules/General/version @@ -4,7 +4,7 @@ # update version string in C++ file and in $WM_PROJECT_DIR/.build file # Cvertoo = \ - sed s/WM_PROJECT_VERSION/\"$(shell wmakePrintBuild -update)\"/ $$SOURCE > $*.C; \ + sed 's/WM_PROJECT_VERSION/$(shell wmakePrintBuild -update)/' $$SOURCE > $*.C; \ $(CC) $(c++FLAGS) -c $*.C -o $@ .Cver.dep: diff --git a/wmake/wmakePrintBuild b/wmake/wmakePrintBuild index 3232727163e495ffa83c5c4bbd5a29ab3fb7d769..868357fe58c4fded9d6ed54dba9269cd1845d2d6 100755 --- a/wmake/wmakePrintBuild +++ b/wmake/wmakePrintBuild @@ -37,13 +37,13 @@ usage() { cat<<USAGE usage: $Script [OPTION] options: - -check check git description vs. \$WM_PROJECT_DIR/.build + -check check the git head commit vs. \$WM_PROJECT_DIR/.build (exit code 0 for no changes) - -update update the \$WM_PROJECT_DIR/.build from the git description + -update update the \$WM_PROJECT_DIR/.build from the git information -version VER specify an alternative version Print the version used when building the project, in this order of precedence: - * git description + * the git head commit (prefixed with \$WM_PROJECT_VERSION) * \$WM_PROJECT_DIR/.build * \$WM_PROJECT_VERSION @@ -88,15 +88,20 @@ done build="$WM_PROJECT_DIR/.build" previous=$(tail -1 $build 2>/dev/null) -# specified a version if [ -n "$version" ] then # specified a version - no error possible rc=0 else - # building under git (could use --abbrev=32 for maximum resolution) - version=$(git describe --always --tags 2>/dev/null) + # building under git (get the head SHA1) + version=$(git show-ref --hash=12 --head HEAD 2>/dev/null) rc=$? + + # prefix with WM_PROJECT_VERSION + if [ $rc -eq 0 ] + then + version="${WM_PROJECT_VERSION}-$version" + fi fi @@ -130,17 +135,16 @@ then fi - if [ $rc -eq 0 ] then - # output the git description or -version version + # output the git information or the -version version echo $version elif [ -n "$previous" ] then # use previous build tag echo $previous else - # fallback to WM_PROJECT_VERSION + # fallback to WM_PROJECT_VERSION alone echo ${WM_PROJECT_VERSION:-unknown} fi