From 0a1a66ecb96d3b2729328e9b34a454a9c86d3828 Mon Sep 17 00:00:00 2001
From: mattijs <mattijs@hunt.opencfd.co.uk>
Date: Wed, 17 Dec 2008 12:36:29 +0000
Subject: [PATCH] git describe in header

---
 src/Allwmake                                  |  6 ++
 src/OpenFOAM/Make/files                       |  3 +-
 src/OpenFOAM/global/global.C                  | 78 +++++++++++++++++++
 .../global/{global.Cver => global_raw.C}      |  5 +-
 wmake/rules/General/standard                  |  2 -
 wmake/rules/General/version                   |  6 --
 6 files changed, 88 insertions(+), 12 deletions(-)
 rename src/OpenFOAM/global/{global.Cver => global_raw.C} (94%)
 delete mode 100644 wmake/rules/General/version

diff --git a/src/Allwmake b/src/Allwmake
index 35b8f55b886..f6e7907e327 100755
--- a/src/Allwmake
+++ b/src/Allwmake
@@ -2,6 +2,12 @@
 cd ${0%/*} || exit 1    # run from this directory
 set -x
 
+# update version string if under Git
+git describe 2> /dev/null | \
+(read project_string \
+   && sed -e 's/WM_PROJECT_VERSION/\"'"${project_string}"'"/' \
+   OpenFOAM/global/global_raw.C >OpenFOAM/global/global.C)
+
 wmakeLnInclude -f OpenFOAM
 wmakeLnInclude -f OSspecific/$WM_OS
 Pstream/Allwmake
diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files
index e24fd6b5ec4..a9708a3c307 100644
--- a/src/OpenFOAM/Make/files
+++ b/src/OpenFOAM/Make/files
@@ -1,4 +1,5 @@
-global/global.Cver
+global/global.C
+
 global/dimensionedConstants/dimensionedConstants.C
 global/argList/argList.C
 global/clock/clock.C
diff --git a/src/OpenFOAM/global/global.C b/src/OpenFOAM/global/global.C
index e69de29bb2d..38f900ef4ef 100644
--- a/src/OpenFOAM/global/global.C
+++ b/src/OpenFOAM/global/global.C
@@ -0,0 +1,78 @@
+/*-------------------------------*- C++ -*-----------------------------------*\
+  =========                 |
+  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+   \\    /   O peration     |
+    \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
+     \\/     M anipulation  |
+-------------------------------------------------------------------------------
+License
+    This file is part of OpenFOAM.
+
+    OpenFOAM 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.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM; if not, write to the Free Software Foundation,
+    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.
+
+    This file gets preprocessed by the Allwmake script to replace
+    PROJECT_VERSION with the appropriate version number string.
+
+\*---------------------------------------------------------------------------*/
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+#include "foamVersion.H"
+
+const char* const Foam::FOAMversion = "dev_2008-10-29-197-gc1bfee3";
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Setup an error handler for the global new operator
+
+#include "new.C"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Global IO streams
+
+#include "IOstreams.C"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "JobInfo.H"
+bool Foam::JobInfo::constructed = false;
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Global error definitions (initialised by construction)
+
+#include "messageStream.C"
+#include "error.C"
+#include "IOerror.C"
+#include "token.C"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Read the debug and info switches
+
+#include "debug.C"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Read and set cell models
+
+#include "globalCellModeller.C"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// Create the jobInfo file in the $FOAM_JOB_DIR/runningJobs directory
+
+#include "JobInfo.C"
+
+// ************************************************************************* //
diff --git a/src/OpenFOAM/global/global.Cver b/src/OpenFOAM/global/global_raw.C
similarity index 94%
rename from src/OpenFOAM/global/global.Cver
rename to src/OpenFOAM/global/global_raw.C
index e67b67b22a8..29c67cf3e0b 100644
--- a/src/OpenFOAM/global/global.Cver
+++ b/src/OpenFOAM/global/global_raw.C
@@ -27,9 +27,8 @@ Description
     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 gets preprocessed by the Allwmake script to replace
+    PROJECT_VERSION with the appropriate version number string.
 
 \*---------------------------------------------------------------------------*/
 
diff --git a/wmake/rules/General/standard b/wmake/rules/General/standard
index 8e5e436d32a..82d2a6c11eb 100644
--- a/wmake/rules/General/standard
+++ b/wmake/rules/General/standard
@@ -1,5 +1,3 @@
-include $(GENERAL_RULES)/version
-
 include $(GENERAL_RULES)/sourceToDep
 
 include $(GENERAL_RULES)/java
diff --git a/wmake/rules/General/version b/wmake/rules/General/version
deleted file mode 100644
index 805eb585613..00000000000
--- a/wmake/rules/General/version
+++ /dev/null
@@ -1,6 +0,0 @@
-.SUFFIXES: .Cver
-
-Cvertoo = sed s/WM_PROJECT_VERSION/\"$(WM_PROJECT_VERSION)\"/ $$SOURCE > $*.C ; $(CC) $(c++FLAGS) -c $*.C -o $@ 
-
-.Cver.dep:
-	$(MAKE_DEP)
-- 
GitLab