From 5dc6f8082c037c2de413cf818b26836b3999a51f Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Fri, 5 Jun 2020 15:35:41 +0200
Subject: [PATCH] CONFIG: install to FOAM_MODULE_LIBBIN (defaults to
 FOAM_SITE_LIBBIN)

- normally not defined, but can be used to define an alternative
  installation location. More refinements in the future, pending
  changes in OpenFOAM.
---
 src/petsc4Foam/Allwmake     |  5 +++--
 src/petsc4Foam/Make/files   |  2 +-
 src/petsc4Foam/Make/options | 10 +++++++++-
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/petsc4Foam/Allwmake b/src/petsc4Foam/Allwmake
index d3db18e..c07c393 100755
--- a/src/petsc4Foam/Allwmake
+++ b/src/petsc4Foam/Allwmake
@@ -1,7 +1,8 @@
 #!/bin/sh
 cd ${0%/*} || exit 1                         # Run from this directory
-. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
-. $WM_PROJECT_DIR/wmake/scripts/have_petsc
+targetType=libso
+. "${WM_PROJECT_DIR:?}"/wmake/scripts/AllwmakeParseArguments
+. "${WM_PROJECT_DIR:?}"/wmake/scripts/have_petsc
 
 #------------------------------------------------------------------------------
 
diff --git a/src/petsc4Foam/Make/files b/src/petsc4Foam/Make/files
index 0fd0f76..eee14d3 100644
--- a/src/petsc4Foam/Make/files
+++ b/src/petsc4Foam/Make/files
@@ -4,4 +4,4 @@ utils/petscControls.C
 utils/petscLinearSolverContexts.C
 utils/petscCacheManager.C
 
-LIB = $(FOAM_SITE_LIBBIN)/libpetscFoam
+LIB = $(FOAM_MODULE_LIBBIN)/libpetscFoam
diff --git a/src/petsc4Foam/Make/options b/src/petsc4Foam/Make/options
index 3ac2dfd..41ef566 100644
--- a/src/petsc4Foam/Make/options
+++ b/src/petsc4Foam/Make/options
@@ -1,6 +1,13 @@
 sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
 sinclude $(RULES)/mplib$(WM_MPLIB)
 
+sinclude $(GENERAL_RULES)/module-group-path
+
+/* Failsafe - default to group location */
+ifeq (,$(strip $(FOAM_MODULE_LIBBIN)))
+    FOAM_MODULE_LIBBIN = $(FOAM_SITE_LIBBIN)
+endif
+
 EXE_INC = \
     $(PFLAGS) $(PINC) \
     -Wno-old-style-cast \
@@ -11,4 +18,5 @@ EXE_INC = \
 
 LIB_LIBS = \
     -lfiniteVolume \
-    -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) -L${PETSC_LIB_DIR} -lpetsc
+    -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) \
+    -L${PETSC_LIB_DIR} -lpetsc
-- 
GitLab