From d5260b18d7ba38fdc7112030329e4dba01c1d441 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Tue, 15 Dec 2020 21:45:59 +0100
Subject: [PATCH] ENH: add wmake -show-mpi-compile, -show-mpi-link options

- useful for diagnosing which MPI paths and flags are being used
  when setting up for a new MPI configuration.
---
 wmake/makefiles/info | 18 ++++++++++++++----
 wmake/wmake          |  7 ++++++-
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/wmake/makefiles/info b/wmake/makefiles/info
index 302a864dd85..5985f48a789 100644
--- a/wmake/makefiles/info
+++ b/wmake/makefiles/info
@@ -5,11 +5,10 @@
 #   \\  /    A nd           | www.openfoam.com
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
-#     Copyright (C) 2019 OpenCFD Ltd.
+#     Copyright (C) 2019-2020 OpenCFD Ltd.
 #------------------------------------------------------------------------------
 # License
-#     This file is part of OpenFOAM, licensed under GNU General Public License
-#     <http://www.gnu.org/licenses/>.
+#     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
 #
 # File
 #     wmake/makefiles/info
@@ -46,6 +45,7 @@ EXT_SO  = .so
 
 GENERAL_RULES = $(WM_DIR)/rules/General
 include $(GENERAL_RULES)/general
+include $(GENERAL_RULES)/mpi-rules
 
 # Commands
 COMPILE_C    := $(strip $(cc) $(cFLAGS))
@@ -95,4 +95,14 @@ cflags-arch:
 cxxflags-arch:
 	@echo "$(strip $(c++ARCH))"
 
-#----------------------------- vim: set ft=make: ------------------------------
+# Like openmpi mpicc --showme:compile
+.PHONY: mpi-compile
+mpi-compile:
+	@echo "$(strip $(PINC))"
+
+# Like openmpi mpicc --showme:link
+.PHONY: mpi-link
+mpi-link:
+	@echo "$(strip $(PLIBS))"
+
+#------------------------------------------------------------------------------
diff --git a/wmake/wmake b/wmake/wmake
index 367f447e98b..1892932ef5f 100755
--- a/wmake/wmake
+++ b/wmake/wmake
@@ -86,6 +86,7 @@ cat<<HELP_FULL
   -module-prefix=TYPE   Specify FOAM_MODULE_PREFIX as predefined type
                         (u,user | g,group | o,openfoam)
   -no-scheduler     Disable scheduled parallel compilation
+
   -show-api         Print api value (from Make rules)
   -show-ext-so      Print shared library extension (with '.' separator)
   -show-c           Print C compiler value
@@ -98,6 +99,9 @@ cat<<HELP_FULL
   -show-compile-cxx Same as '-show-cxx -show-cxxflags'
   -show-path-c      Print path to C compiler
   -show-path-cxx    Print path to C++ compiler
+  -show-mpi-compile Print mpi-related flags used when compiling
+  -show-mpi-link    Print mpi-related flags used when linking
+
 HELP_FULL
 fi
 
@@ -263,7 +267,8 @@ do
 
         -show-api | -show-ext-so | \
         -show-compile-c   | -show-c   | -show-cflags   | -show-cflags-arch | \
-        -show-compile-cxx | -show-cxx | -show-cxxflags | -show-cxxflags-arch )
+        -show-compile-cxx | -show-cxx | -show-cxxflags | -show-cxxflags-arch | \
+        -show-mpi-compile | -show-mpi-link )
             printInfo "${1#-show-}"
             optShow=true
             ;;
-- 
GitLab