aboutsummaryrefslogtreecommitdiffstats
path: root/math/mumps/Makefile
blob: 28ca338a6a4cc0a8a5e4fb22d326c625103050a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# New ports collection makefile for:    MUMPS
# Date created:     5 Mar 2006
# Whom:         Pedro Giffuni
#
# $FreeBSD$
#

PORTNAME=   mumps
PORTVERSION=    4.6.3
PORTREVISION=   1
CATEGORIES= math
MASTER_SITES=   http://www.enseeiht.fr/apo/MUMPS/   \
        http://www.enseeiht.fr/irit/apo/MUMPS/  \
        http://graal.ens-lyon.fr/MUMPS/
DISTNAME=   MUMPS_${PORTVERSION}

MAINTAINER= ports@FreeBSD.org
COMMENT=    MUltifrontal Massively Parallel sparse direct Solver

#-----------------------------------------------------------------------

# WARNING: Non-serviceable parts inside, can break other ports
# You may define these options/knobs:
#
# FFLAGS: Fortran compiler flags for gfortran
# WITH_OPTIMIZED_FLAGS:Try to use agressive (non-CPU) FFLAGS
# BLAS_LIBS: specify other version of BLAS
# WITH_ATLAS: Use ATLAS instead of the regular BLAS
# WITH_GFC_BLAS: BLAS was generated with gfortran, not g77
# WITH_METIS: Add METIS ordering
# WITH_MPI: Use mpich for the parallel version
#-----------------------------------------------------------------------

USE_GCC=    4.1+
WITH_FORTRAN=   yes

.if defined(WITH_OPTIMIZED_FLAGS)
FFLAGS+=    -O3 -ffast-math
.endif

.ifndef WITH_GFC_BLAS   # g77 compatibility
MAKE_ENV+=  CDEFS=-DAdd__
FCFLAGS=    -ff2c ${FFLAGS}
.else
FCFLAGS?=   ${FFLAGS}
.endif

.ifdef WITH_ATLAS
LIB_DEPENDS+=   atlas.1:${PORTSDIR}/math/atlas
BLAS_LIBS=  -lptf77blas -latlas_r
.else
LIB_DEPENDS+=   blas.1:${PORTSDIR}/math/blas
BLAS_LIBS?= -lblas
.endif

.ifdef WITH_METIS
BUILD_DEPENDS+= ${LOCALBASE}/lib/libmetis.a:${PORTSDIR}/math/metis
MAKE_ENV+=  ORDERINGSF=-Dmetis
.endif

PLIST_SUB+= MUMPSVERSION=${PORTVERSION}

.include <bsd.port.pre.mk>

.if exists(${LOCALBASE}/mpich2/bin/mpicc) && !defined(WITHOUT_MPI)
WITH_MPI=   yes
.endif
.ifdef WITH_MPI
PKGNAMESUFFIX+=     -mpich
BUILD_DEPENDS+= ${LOCALBASE}/mpich2/include/mpif.h:${PORTSDIR}/net/mpich2 \
        ${LOCALBASE}/lib/libblacs.a:${PORTSDIR}/math/blacs \
        ${LOCALBASE}/lib/libscalapack.a:${PORTSDIR}/math/scalapack
# Note: -l?mumps still requires to be linked with -lblacs + -lscalapack
RUN_DEPENDS+=   ${LOCALBASE}/mpich2/bin/mpirun:${PORTSDIR}/net/mpich2 \
        ${LOCALBASE}/lib/libblacs.a:${PORTSDIR}/math/blacs \
        ${LOCALBASE}/lib/libscalapack.a:${PORTSDIR}/math/scalapack
CONFLICTS=  mumps-4*
.else
CONFLICTS=  mumps-mpich-4*
.endif

.ifndef WITH_MPI
PLIST_SUB+= WITH_LIBSEQ=""
.else
PLIST_SUB+= WITH_LIBSEQ="@comment "
.endif

post-patch:
.ifdef WITH_MPI
    @${INSTALL_DATA} ${WRKSRC}/Make.inc/Makefile.inc.generic \
        ${WRKSRC}/Makefile.inc
.else
    @${INSTALL_DATA} ${WRKSRC}/Make.inc/Makefile.inc.generic.SEQ \
        ${WRKSRC}/Makefile.inc
.endif

pre-build:
    @${REINPLACE_CMD} -e 's+@CC@+${CC}+g ; s+@FC@+${FC}+g ; \
    s+@CFLAGS@+${CFLAGS}+g; \
    s+@FCFLAGS@+${FCFLAGS}+g; \
    s+@PTHREAD_LIBS@+${PTHREAD_LIBS}+g; \
    s+@BLAS_LIBS@+${BLAS_LIBS}+ ; \
    s+@LOCALBASE@+${LOCALBASE}+g;' \
        ${WRKSRC}/Makefile.inc
.ifdef WITH_METIS
    @${REINPLACE_CMD} -e 's+#LMETIS+LMETIS+' ${WRKSRC}/Makefile.inc
.endif

do-install:
    ${INSTALL_DATA} ${WRKSRC}/include/*.h ${PREFIX}/include
    ${INSTALL_DATA} ${WRKSRC}/lib/lib*.a ${PREFIX}/lib
.ifndef WITH_MPI
    ${INSTALL_DATA} ${WRKSRC}/libseq/libmpiseq.a ${PREFIX}/lib
.endif
.ifndef NOPORTDOCS
    @${MKDIR} ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/doc/userguide_${PORTVERSION}.pdf ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/doc/userguide_${PORTVERSION}.ps ${DOCSDIR}
    ${GZIP_CMD} ${DOCSDIR}/userguide_${PORTVERSION}.ps
.endif

.if defined(MAINTAINER_MODE)
regression-test:
. if defined (WITH_MPI)
.  if !exists(${HOME}/.mpd.conf)
    @${ECHO_CMD} "MPD_SECRETWORD=change_on_install" > ${HOME}/.mpd.conf
    ${CHMOD} go-r ${HOME}/.mpd.conf
    @${ECHO_MSG} "${HOME}/.mpd.conf has been generated - please change the secret word!"
.  endif
    ${LOCALBASE}/mpich2/bin/mpd &
    (cd ${WRKSRC}/test &&   \
    ${LOCALBASE}/mpich2/bin/mpirun -np 2 ./ssimpletest < input_simpletest_real ;    \
    ${LOCALBASE}/mpich2/bin/mpirun -np 2 ./dsimpletest < input_simpletest_real ;    \
    ${LOCALBASE}/mpich2/bin/mpirun -np 2 ./csimpletest < input_simpletest_cmplx ;   \
    ${LOCALBASE}/mpich2/bin/mpirun -np 2 ./zsimpletest < input_simpletest_cmplx ;   \
    ${ECHO_MSG} "The solution should be (1,2,3,4,5)" ;  \
    ${LOCALBASE}/mpich2/bin/mpirun -np 3 ./c_example ;  \
    ${ECHO_MSG} "The solution should be (1,2)")
    ${LOCALBASE}/mpich2/bin/mpdallexit
. else
    (cd ${WRKSRC}/test &&   \
    ./ssimpletest < input_simpletest_real ;         \
    ./dsimpletest < input_simpletest_real ;         \
    ./csimpletest < input_simpletest_cmplx ;        \
    ./zsimpletest < input_simpletest_cmplx ;        \
    ${ECHO_MSG} "The solution should be (1,2,3,4,5)" ;  \
    ./c_example ;                       \
    ${ECHO_MSG} "The solution should be (1,2)")
. endif
.endif

.include <bsd.port.post.mk>