aboutsummaryrefslogtreecommitdiffstats
path: root/math/gotoblas/Makefile
blob: 05fdbf54c2bb686a2ddbc41ca042ca3f9e5cad06 (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
# Ports collection makefile for: gotoblas
# Date created:         20070203
# Whom:         Sato Hiroki <hrs@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=   gotoblas
PORTVERSION=    2.${GOTOBLAS2VER}
CATEGORIES= math
MASTER_SITES=   ftp://ftp.netlib.org/lapack/:lapack ftp://ftp.netlib.org/lapack/timing/:lapack_tmg
DISTFILES=  GotoBLAS2-${GOTOBLAS2VER}.tar.gz lapack-3.1.1.tgz:lapack large.tgz:lapack_tmg timing.tgz:lapack_tmg
EXTRACT_ONLY=   ${GOTOBLAS2_SRCFILE}

MAINTAINER= maho@FreeBSD.org
COMMENT=    A fast implementation of Basic Linear Algebra Subprograms

DIST_SUBDIR=    gotoblas
GOTOBLAS2VER=   1.13
GOTOBLAS2_SRCFILE=  GotoBLAS2-${GOTOBLAS2VER}.tar.gz
LAPACK_SRCFILE= lapack-3.1.1.tgz
LARGE_FILE= large.tgz
TIMING_FILE=    timing.tgz
USE_GMAKE=  yes
USE_LDCONFIG=   yes
RESTRICTED= Redistribution not permitted
MANUAL_PACKAGE_BUILD=   Please obtain the source code manyally from http://www.tacc.utexas.edu/tacc-projects/
WRKSRC=     ${WRKDIR}/GotoBLAS2

USE_PERL5_BUILD=    yes
USE_FORTRAN=   yes
BUILD_DEPENDS+= ${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
GOTOLIBS=   libgoto2 libgoto2p
GOTOFILES=  ${GOTOLIBS:S|$|.so|} ${GOTOLIBS:S|$|.so.1|} ${GOTOLIBS:S|$|.a|}
PLIST_FILES=    ${GOTOFILES:S|^|lib/|}

.include <bsd.port.pre.mk>

BUILD_DEPENDS+= ${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils

.if ${ARCH} == "amd64" || ${ARCH} == "alpha" || ${ARCH} == "sparc64" || ${ARCH} == "ia64"
MAKE_FLAGS+=    BINARY64=1
.else
MAKE_FLAGS+=    BINARY32=1
.endif

.if defined(WITH_INTERFACE64)
MAKE_FLAGS+=    INTERFACE64=1
.endif

.if defined(WITH_GFORTRAN)
MAKE_FLAGS+=    F_COMPILER=GFORTRAN
.elif defined(WITH_G77)
MAKE_FLAGS+=    F_COMPILER=G77
.elif defined(WITH_G95)
MAKE_FLAGS+=    F_COMPILER=G95
.elif defined(WITH_IFORT)
MAKE_FLAGS+=    F_COMPILER=INTEL
.elif defined(WITH_PGF77)
MAKE_FLAGS+=    F_COMPILER=PGI
.elif defined(WITH_PATHF90)
MAKE_FLAGS+=    F_COMPILER=PATHF90
.elif defined(WITH_XLF)
MAKE_FLAGS+=    F_COMPILER=IBM
.endif

.if !defined(PACKAGE_BUILDING) && !exists(${DISTDIR}/${DIST_SUBDIR}/${GOTOBLAS2_SRCFILE})
do-fetch:
    @${ECHO_CMD} "You need to fetch ${GOTOBLAS2_SRCFILE} from:"
    @${ECHO_CMD} "http://www.tacc.utexas.edu/tacc-projects/"
    @${ECHO_CMD} "and put it in ${DISTDIR}."
.endif

pre-build::
    @${ECHO_CMD} "****"
    @${ECHO_CMD} "You can choose FORTRAN compiler" \
        "by using the following knobs:"
    @${ECHO_CMD} "   WITH_GFORTRAN=yes (gfortran; default)"
    @${ECHO_CMD} "   WITH_G77=yes (g77)"
    @${ECHO_CMD} "   WITH_G95=yes (g95)"
    @${ECHO_CMD} "   WITH_IFORT=yes (ifort)"
    @${ECHO_CMD} "   WITH_PGF77=yes (pgf77)"
    @${ECHO_CMD} "   WITH_PATHF90=yes (pathf90)"
    @${ECHO_CMD} "   WITH_XLF=yes (xlf)"
    @${ECHO_CMD} "   WITH_INTERFACE64=yes (for using 64-bit integer interface)"
    @${ECHO_CMD} "- Note that if the specified compiler does not exist" \
        "on your system, build will fail."
    @${ECHO_CMD} "- None is specified, gfortran will be used."
    @${ECHO_CMD} "****"

post-patch:
    @${REINPLACE_CMD} -e "s+%%FC%%+${FC}+" -e "s+%%CC%%+${CC}+" ${WRKSRC}/Makefile.rule

do-build:
    ${CP} ${DISTDIR}/${DIST_SUBDIR}/${LAPACK_SRCFILE} ${WRKSRC}
    ${CP} ${DISTDIR}/${DIST_SUBDIR}/${LARGE_FILE} ${WRKSRC}
    ${CP} ${DISTDIR}/${DIST_SUBDIR}/${TIMING_FILE} ${WRKSRC}
    ${MKDIR} ${WRKDIR}/lib
    cd ${WRKSRC} && ${GMAKE} ${MAKE_FLAGS} USE_THREAD=1 #DYNAMIC_ARCH=1
    cd ${WRKSRC}/exports && ${GMAKE} ${MAKE_FLAGS} USE_THREAD=1 #DYNAMIC_ARCH=1
    ${INSTALL_DATA} ${WRKSRC}/libgoto2.a ${WRKDIR}/lib/libgoto2p.a
    ${INSTALL_DATA} ${WRKSRC}/libgoto2.so ${WRKDIR}/lib/libgoto2p.so

    cd ${WRKSRC} && ${GMAKE} clean
    cd ${WRKSRC}/exports && ${GMAKE} clean
    cd ${WRKSRC} && ${GMAKE} ${MAKE_FLAGS} USE_THREAD=0 #DYNAMIC_ARCH=0
    cd ${WRKSRC}/exports && ${GMAKE} ${MAKE_FLAGS} USE_THREAD=0 #DYNAMIC_ARCH=0
    ${INSTALL_DATA} ${WRKSRC}/libgoto2.a ${WRKDIR}/lib/libgoto2.a
    ${INSTALL_DATA} ${WRKSRC}/libgoto2.so ${WRKDIR}/lib/libgoto2.so

benchmark:
    cd ${WRKSRC}/ && \
        ${GMAKE} ${MAKE_FLAGS} hpl
    cd ${WRKSRC}/benchmark && \
        ${GMAKE} ${MAKE_FLAGS} dlinpack.goto

do-install:
    cd ${WRKDIR}/lib/ && \
    ${INSTALL_DATA} ${GOTOLIBS:S|$|.a|} ${PREFIX}/lib/ && \
    ${INSTALL_DATA} ${GOTOLIBS:S|$|.so|} ${PREFIX}/lib/
    cd ${PREFIX}/lib/ && \
    for i in ${GOTOLIBS:S|$|.so|}; do \
        ${LN} -sf $$i $$i.1;done

.include <bsd.port.post.mk>