summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorasau <asau>2010-05-16 11:07:39 +0000
committerasau <asau>2010-05-16 11:07:39 +0000
commit5676a6f60b7e564a772ed0780c10c86d187c2db3 (patch)
tree413f1376cc04267973bfb6f3990eaf0311594644 /mk
parent6749fe109e26d0a343d599e4b661a69385548a83 (diff)
downloadpkgsrc-5676a6f60b7e564a772ed0780c10c86d187c2db3.tar.gz
Introduce common point to depend on MPI:
- detect and use already installed MPI package; - use MPI_TYPE to determine which MPI package to use. Support MPICH2 and OpenMPI.
Diffstat (limited to 'mk')
-rw-r--r--mk/mpi.buildlink3.mk39
1 files changed, 39 insertions, 0 deletions
diff --git a/mk/mpi.buildlink3.mk b/mk/mpi.buildlink3.mk
new file mode 100644
index 00000000000..6c360f417ea
--- /dev/null
+++ b/mk/mpi.buildlink3.mk
@@ -0,0 +1,39 @@
+# $NetBSD: mpi.buildlink3.mk,v 1.1 2010/05/16 11:07:39 asau Exp $
+#
+# This Makefile fragment is meant to be included by packages
+# that use any MPI implementation instead of one particular one.
+# The available MPI implementations are "mpich" and "openmpi".
+#
+# === User-settable variables ===
+#
+# MPI_TYPE
+# This value represents the type of MPI we wish to use on the system.
+#
+# Possible: mpich, openmpi
+# Default: mpich
+
+.if !defined(MPI_BUILDLINK3_MK)
+MPI_BUILDLINK3_MK= # define it
+
+.include "../../mk/bsd.prefs.mk"
+
+# Try to find if we have anything installed already
+.if exists($(LOCALBASE)/bin/mpicc)
+_MPI_PACKAGE!= $(PKG_INFO) -Q PKGPATH -F $(LOCALBASE)/bin/mpicc
+MPI_TYPE?= $(_MPI_PACKAGE:T)
+.else
+
+MPI_TYPE?= mpich # default to MPICH due to backward compatibility
+.if $(MPI_TYPE) == "mpich"
+_MPI_PACKAGE= parallel/mpi-ch
+.elif $(MPI_TYPE) == "openmpi"
+_MPI_PACKAGE= parallel/openmpi
+.else # invalid or unimplemented type
+PKG_FAIL_REASON= \
+ "${MPI_TYPE} is not an acceptable MPI type for ${PKGNAME}."
+.endif
+.endif
+
+.include "../../$(_MPI_PACKAGE)/buildlink3.mk"
+
+.endif # MPI_BUILDLINK3_MK