From 0d28e3f96720c6fccf39b261cbea6c5fa008df17 Mon Sep 17 00:00:00 2001
From: mark <mark@opencfd>
Date: Fri, 10 Feb 2017 20:30:15 +0100
Subject: [PATCH] ENH: build into build/ directory instead of platforms/ (issue
 #312)

- makes it slightly easier when packaging various binaries, or when
  building packages for installation via modules etc.
---
 bin/tools/foamListSourceFiles   |  1 +
 src/Pstream/Allwmake            |  2 +-
 src/parallel/decompose/Allwmake |  2 +-
 wmake/scripts/wmakeFunctions    | 14 +++++++-------
 wmake/wclean                    |  2 +-
 wmake/wmake                     |  4 ++--
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/bin/tools/foamListSourceFiles b/bin/tools/foamListSourceFiles
index 0f02cc99b7..4cc449980e 100755
--- a/bin/tools/foamListSourceFiles
+++ b/bin/tools/foamListSourceFiles
@@ -78,6 +78,7 @@ find -H $packDir                                                               \
 | sed                                                                          \
  -e '\@/\.git/@d'                                                              \
  -e '\@/\.tags/@d'                                                             \
+ -e '\@/build/@d'                                                              \
  -e '\@/platforms/@d'                                                          \
  -e '\@/t/@d'                                                                  \
  -e '\@/Make[.A-Za-z]*/[^/]*/@d'                                               \
diff --git a/src/Pstream/Allwmake b/src/Pstream/Allwmake
index c752d8220f..e69310f341 100755
--- a/src/Pstream/Allwmake
+++ b/src/Pstream/Allwmake
@@ -15,7 +15,7 @@ wmakeMpiLib()
     do
     (
         WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
-        objectsDir="$WM_PROJECT_DIR/platforms/$WM_OPTIONS/src/Pstream/$libName"
+        objectsDir="$WM_PROJECT_DIR/build/$WM_OPTIONS/src/Pstream/$libName"
         whichmpi="$objectsDir/using:$FOAM_MPI"
         [ -e "$whichmpi" ] || wclean $libName
         echo "wmake $targetType $libName"
diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake
index 82e965e79c..4c61250b6a 100755
--- a/src/parallel/decompose/Allwmake
+++ b/src/parallel/decompose/Allwmake
@@ -132,7 +132,7 @@ wmakeMpiLib()
     do
     (
         WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
-        objectsDir="$WM_PROJECT_DIR/platforms/$WM_OPTIONS/src/parallel/decompose/$libName"
+        objectsDir="$WM_PROJECT_DIR/build/$WM_OPTIONS/src/parallel/decompose/$libName"
         whichmpi="$objectsDir/using:$FOAM_MPI"
         whichdecomp="$objectsDir/using:$decompName"
         [ -e "$whichmpi" -a -e "$whichdecomp" ] || wclean $libName
diff --git a/wmake/scripts/wmakeFunctions b/wmake/scripts/wmakeFunctions
index ee9a2067bd..827fda9885 100644
--- a/wmake/scripts/wmakeFunctions
+++ b/wmake/scripts/wmakeFunctions
@@ -160,7 +160,7 @@ findObjectDir()
 
     case "$exPath" in
     ("$wmpdir"/*)
-        local buildPath=$WM_PROJECT_DIR/platforms/${WM_OPTIONS}
+        local buildPath=$WM_PROJECT_DIR/build/${WM_OPTIONS}
         objectsDir=$buildPath$(echo $exPath | sed s%$wmpdir%% )
         ;;
     (*)
@@ -208,8 +208,8 @@ then
     depToSource()
     {
         local sourceFile=${1%.dep}
-        sourceFile="${sourceFile/platforms\/${WM_OPTIONS}\//}"
-        sourceFile="${sourceFile/platforms\/${WM_OPTIONS}${WM_MPLIB}\//}"
+        sourceFile="${sourceFile/build\/${WM_OPTIONS}\//}"
+        sourceFile="${sourceFile/build\/${WM_OPTIONS}${WM_MPLIB}\//}"
         sourceFile="${sourceFile/Make\/${WM_OPTIONS}\//}"
         sourceFile="${sourceFile/Make\/${WM_OPTIONS}${WM_MPLIB}\//}"
 
@@ -218,10 +218,10 @@ then
 else
     depToSource()
     {
-        local sourceFile=$(echo ${1%.dep} |                 \
-            sed -e s%platforms/${WM_OPTIONS}/%%             \
-                -e s%platforms/${WM_OPTIONS}${WM_MPLIB}/%%  \
-                -e s%Make/${WM_OPTIONS}/%%                  \
+        local sourceFile=$(echo ${1%.dep} |             \
+            sed -e s%build/${WM_OPTIONS}/%%             \
+                -e s%build/${WM_OPTIONS}${WM_MPLIB}/%%  \
+                -e s%Make/${WM_OPTIONS}/%%              \
                 -e s%Make/${WM_OPTIONS}${WM_MPLIB}/%% )
 
         echo "$sourceFile"
diff --git a/wmake/wclean b/wmake/wclean
index c41f82c2b6..71c8cd096a 100755
--- a/wmake/wclean
+++ b/wmake/wclean
@@ -256,7 +256,7 @@ then
     objectsDir=$MakeDir/$WM_OPTIONS
     case "$PWD" in
     ("$WM_PROJECT_DIR"/*)
-        buildPath=$WM_PROJECT_DIR/platforms/${WM_OPTIONS}
+        buildPath=$WM_PROJECT_DIR/build/${WM_OPTIONS}
         objectsDir=$buildPath$(echo $PWD | sed s%$WM_PROJECT_DIR%% )
         ;;
     esac
diff --git a/wmake/wmake b/wmake/wmake
index 219bbf454e..11dd888968 100755
--- a/wmake/wmake
+++ b/wmake/wmake
@@ -340,7 +340,7 @@ then
     [ "$update" = true ] || wmakeLnIncludeAll $parOpt
 
     (
-        export WM_COLLECT_DIR=$WM_PROJECT_DIR/platforms/${WM_OPTIONS}/${PWD////_}
+        export WM_COLLECT_DIR=$WM_PROJECT_DIR/build/${WM_OPTIONS}/${PWD////_}
         export WM_SCHEDULER=wmakeCollect
         trap '$WM_SCHEDULER -kill' TERM INT
         $WM_SCHEDULER -clean                                                   \
@@ -390,7 +390,7 @@ fi
 objectsDir=$MakeDir/$WM_OPTIONS
 case "$PWD" in
 ("$WM_PROJECT_DIR"/*)
-    buildPath=$WM_PROJECT_DIR/platforms/${WM_OPTIONS}
+    buildPath=$WM_PROJECT_DIR/build/${WM_OPTIONS}
     objectsDir=$buildPath$(echo $PWD | sed s%$WM_PROJECT_DIR%% )
     ;;
 esac
-- 
GitLab