diff options
Diffstat (limited to 'math/atlas/Makefile')
-rw-r--r-- | math/atlas/Makefile | 159 |
1 files changed, 111 insertions, 48 deletions
diff --git a/math/atlas/Makefile b/math/atlas/Makefile index 3d35f739ee52..07179df4cd19 100644 --- a/math/atlas/Makefile +++ b/math/atlas/Makefile @@ -6,10 +6,10 @@ # # NOTE: This port purposely ignores the CC and CFLAGS settings. -# Program and compiler flags are finetuned to gcc 2.95/3.1. +# Program and compiler flags are finetuned to gcc. PORTNAME= atlas -PORTVERSION= 3.5.5 +PORTVERSION= 3.6.0 PORTEPOCH= 1 CATEGORIES= math MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} @@ -19,18 +19,29 @@ DISTNAME= ${PORTNAME}${PORTVERSION} MAINTAINER= maho@FreeBSD.org COMMENT= Automatically Tuned Linear Algebra Software (ATLAS) -BUILD_DEPENDS= ${LOCALBASE}/lib/liblapack.a:${PORTSDIR}/math/lapack - USE_BZIP2= yes WRKSRC= ${WRKDIR}/ATLAS INSTALLS_SHLIB= yes USE_REINPLACE= yes -.if (${MACHINE_ARCH} == "alpha") -USE_GCC= 3.1 +.include <bsd.port.pre.mk> + +.if ${OSVERSION} < 501000 && ${MACHINE_ARCH} == "alpha" +USE_GCC=3.3 +.endif + +# only affects for lapack sub project +.if defined(WITH_OPTIMIZED_FLAGS) +FFLAGS+= -pipe -O3 -ffast-math -finline-functions -fstrength-reduce -funroll-loops -fexpensive-optimizations +.if (${MACHINE_ARCH} == "i386" && !${MACHINE_ARCH} == "amd64" ) +FFLAGS+= -mfancy-math-387 -mpreferred-stack-boundary=3 -malign-double +.endif # i386 .endif post-patch: +.if !defined(WITH_OPTIMIZED_FLAGS) + @${ECHO_CMD} "You can optimize lapack sub project by setting WITH_OPTIMIZED_FLAGS=yes." +.endif @${REINPLACE_CMD} -e 's+%%PTHREAD_CFLAGS%%+ ${PTHREAD_CFLAGS}+' \ ${WRKSRC}/config.c @${REINPLACE_CMD} -e 's+%%PTHREAD_LIBS%%+ ${PTHREAD_LIBS}+' \ @@ -39,68 +50,120 @@ post-patch: @(cd ${WRKSRC}; ${PATCH} < ${FILESDIR}/alpha-patch) .endif -do-configure: - @(cd ${WRKSRC}; ${PATCH} < ${FILESDIR}/non-thread-patch) - @(cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} config < ${FILESDIR}/answer) - @(cd ${WRKSRC}; ${PATCH} < ${FILESDIR}/thread-patch) - @(cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} config < ${FILESDIR}/answer) - -NON_THREADED_ATLAS=`cat ${WRKSRC}/ARCHNAME-NON-THREADED` -THREADED_ATLAS=`cat ${WRKSRC}/ARCHNAME-THREADED` -ATLAS_LIBS1=libatlas libcblas libf77blas libtstatlas libalapack -ATLAS_LIBS2=libptcblas libptf77blas +.if !defined(PICFLAG) +.if ${MACHINE_ARCH} == "sparc64" +PICFLAG=-fPIC +.else +PICFLAG=-fpic +.endif +.endif + +ANSWER_i386?= ${PRINTF} "\n\n\n\n\n\n\n\n\n\n" +ANSWER_ia64?= ${PRINTF} "\n\n\n2\n\n\n\n\nf77\n-O2 -static\n\n" -post-configure: -.if (${MACHINE_ARCH} == "alpha") || defined(USE_GCC) - @${REINPLACE_CMD} -e 's|/usr/bin/gcc|${CC}|g;' ${WRKSRC}/Make.${NON_THREADED_ATLAS} - @${REINPLACE_CMD} -e 's|/usr/bin/gcc|${CC}|g;' ${WRKSRC}/Make.${THREADED_ATLAS} +.if !defined(ANSWER_${ARCH}) +ANSWER= ${ANSWER_i386} +.else +ANSWER= ${ANSWER_${ARCH}} .endif +do-configure: + @(cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} xconfig && \ + ${ANSWER} | ./xconfig -N 1 -c ${CC} -f ${FC} -a NON_THREADED && \ + ${ANSWER} | ./xconfig -N 1 -c ${CC} -f ${FC} -a NON_THREADED_PIC \ + -F c '${PICFLAG} -DPIC' -F f '${PICFLAG} -DPIC' \ + -F m '${PICFLAG} -DPIC' -F x '${PICFLAG} -DPIC') + @(cd ${WRKSRC}; ${PATCH} < ${FILESDIR}/thread-patch && \ + ${MAKE_ENV} ${MAKE} xconfig && \ + ${ANSWER} | ./xconfig -c ${CC} -f ${FC} -a THREADED && \ + ${ANSWER} | ./xconfig -c ${CC} -f ${FC} -a THREADED_PIC \ + -F c '${PICFLAG} -DPIC' -F f '${PICFLAG} -DPIC' \ + -F m '${PICFLAG} -DPIC' -F x '${PICFLAG} -DPIC' ) + +ATLAS_LIBS1=libalapack libatlas libcblas libf77blas libtstatlas +ATLAS_LIBS2=libptcblas libptf77blas + do-build: -# non thread version - (cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} install arch=${NON_THREADED_ATLAS}) -# (cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} sanity_test arch=${NON_THREADED_ATLAS}) - (cd ${WRKSRC}; ${MKDIR} tmp ; \ - ${CP} ${LOCALBASE}/lib/liblapack.a tmp ;\ - cd tmp ;\ +# make lapack +.if ! exists(${WRKDIR}/lapack/Makefile) + @${ECHO_MSG} "===> Extracting lapack sub project" + @${MKDIR} ${WRKDIR}/lapack + @${CP} -r ${PORTSDIR}/math/lapack/files ${WRKDIR}/lapack + @${CP} -r ${PORTSDIR}/math/lapack/scripts ${WRKDIR}/lapack + @${CP} ${PORTSDIR}/math/lapack/Makefile ${WRKDIR}/lapack + @${CP} ${PORTSDIR}/math/lapack/distinfo ${WRKDIR}/lapack + @${CP} ${PORTSDIR}/math/lapack/pkg-descr ${WRKDIR}/lapack + @cd ${WRKDIR}/lapack ; ${MAKE} "FFLAGS=${FFLAGS}" FC="${FC}" build WRKDIRPREFIX="" +.endif + @(cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} install arch=NON_THREADED) + @(cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} install arch=NON_THREADED_PIC) + @(cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} install arch=THREADED) + @(cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} install arch=THREADED_PIC) +# make atlas enhanced lapack (static ver) + (cd ${WRKSRC}; ${MKDIR} tmp1 ; \ + ${CP} ${WRKDIR}/lapack/work/LAPACK/SRC/liblapack.a tmp1 ;\ + cd tmp1 ;\ ar x liblapack.a ;\ - ar x ../lib/${NON_THREADED_ATLAS}/liblapack.a ;\ - ar r ../lib/${NON_THREADED_ATLAS}/libalapack.a *.o ;\ - ranlib ../lib/${NON_THREADED_ATLAS}/libalapack.a ) + ar x ../lib/NON_THREADED/liblapack.a ;\ + ar r ../lib/NON_THREADED/libalapack.a *.o ;\ + ranlib ../lib/NON_THREADED/libalapack.a ) +# make atlas enhanced lapack (static and thread safe ver) + (cd ${WRKSRC}; ${MKDIR} tmp2 ; \ + ${CP} ${WRKDIR}/lapack/work/LAPACK/SRC/liblapack.a tmp2 ;\ + cd tmp2 ;\ + ar x liblapack.a ;\ + ar x ../lib/THREADED/liblapack.a ;\ + ar r ../lib/THREADED/libalapack.a *.o ;\ + ranlib ../lib/THREADED/libalapack.a ) +# make atlas enhanced lapack (shared ver) + ( cd ${WRKSRC}; ${MKDIR} tmp3 ;\ + ${TAR} --exclude "*.f" --exclude "*.po" --exclude "*.o" -cf - -C ${WRKDIR}/lapack/work/LAPACK/SRC . | ${TAR} xf - -C tmp3 ;\ + for object in `${FIND} tmp3 -name "*.So"` ; do \ + n=`${ECHO_CMD} $${object}|${SED} -e 's#.So##'` ; \ + ${MV} $$n.So $$n.o ; \ + done ; \ + cd tmp3 ;\ + ar x ../lib/NON_THREADED_PIC/liblapack.a ;\ + ar r ../lib/NON_THREADED_PIC/libalapack.a *.o ;\ + ranlib ../lib/NON_THREADED_PIC/libalapack.a ) +# make atlas enhanced lapack (shared and thread safe ver) + ( cd ${WRKSRC}; ${MKDIR} tmp4 ;\ + ${TAR} --exclude "*.f" --exclude "*.po" --exclude "*.o" -cf - -C ${WRKDIR}/lapack/work/LAPACK/SRC . | ${TAR} xf - -C tmp4 ;\ + for object in `${FIND} tmp4 -name "*.So"` ; do \ + n=`${ECHO_CMD} $${object}|${SED} -e 's#.So##'` ; \ + ${MV} $$n.So $$n.o ; \ + done ; \ + cd tmp4 ;\ + ar x ../lib/THREADED_PIC/liblapack.a ;\ + ar r ../lib/THREADED_PIC/libalapack.a *.o ;\ + ranlib ../lib/THREADED_PIC/libalapack.a ) + +# make atlas shared library .for i in ${ATLAS_LIBS1} - ( cd ${WRKSRC}/lib/${NON_THREADED_ATLAS}/ ; \ + ( cd ${WRKSRC}/lib/NON_THREADED_PIC/ ; \ ld -Bshareable -o ${i}.so.1 -x -soname ${i}.so.1 --whole-archive ${i}.a ) .endfor -# thread version - (cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} install arch=${THREADED_ATLAS}) -# (cd ${WRKSRC}; ${MAKE_ENV} ${MAKE} sanity_test arch=${THREADED_ATLAS}) - (cd ${WRKSRC}; ${MKDIR} tmp2 ; \ - ${CP} ${LOCALBASE}/lib/liblapack.a tmp2 ;\ - cd tmp2 ;\ - ar x liblapack.a ;\ - ar x ../lib/${THREADED_ATLAS}/liblapack.a ;\ - ar r ../lib/${THREADED_ATLAS}/libalapack.a *.o ;\ - ranlib ../lib/${THREADED_ATLAS}/libalapack.a ) +# make atlas shared (thread safe) library .for i in ${ATLAS_LIBS1} ${ATLAS_LIBS2} - ( cd ${WRKSRC}/lib/${THREADED_ATLAS}/ ; \ + ( cd ${WRKSRC}/lib/THREADED_PIC/ ; \ ld -Bshareable -o ${i}.so.1 -x -soname ${i}.so.1 --whole-archive ${i}.a ) .endfor do-install: .for i in ${ATLAS_LIBS1} - @${INSTALL_DATA} ${WRKSRC}/lib/${NON_THREADED_ATLAS}/${i}.a ${PREFIX}/lib - @${INSTALL_DATA} ${WRKSRC}/lib/${NON_THREADED_ATLAS}/${i}.so.1 ${PREFIX}/lib + @${INSTALL_DATA} ${WRKSRC}/lib/NON_THREADED/${i}.a ${PREFIX}/lib + @${INSTALL_DATA} ${WRKSRC}/lib/NON_THREADED_PIC/${i}.so.1 ${PREFIX}/lib @${LN} -sf ${i}.so.1 ${PREFIX}/lib/${i}.so .endfor .for i in ${ATLAS_LIBS1} - @${INSTALL_DATA} ${WRKSRC}/lib/${THREADED_ATLAS}/${i}.a ${PREFIX}/lib/${i}_r.a - @${INSTALL_DATA} ${WRKSRC}/lib/${THREADED_ATLAS}/${i}.so.1 ${PREFIX}/lib/${i}_r.so.1 + @${INSTALL_DATA} ${WRKSRC}/lib/THREADED/${i}.a ${PREFIX}/lib/${i}_r.a + @${INSTALL_DATA} ${WRKSRC}/lib/THREADED_PIC/${i}.so.1 ${PREFIX}/lib/${i}_r.so.1 @${LN} -sf ${i}_r.so.1 ${PREFIX}/lib/${i}_r.so .endfor .for i in ${ATLAS_LIBS2} - @${INSTALL_DATA} ${WRKSRC}/lib/${THREADED_ATLAS}/${i}.a ${PREFIX}/lib - @${INSTALL_DATA} ${WRKSRC}/lib/${THREADED_ATLAS}/${i}.so.1 ${PREFIX}/lib + @${INSTALL_DATA} ${WRKSRC}/lib/THREADED/${i}.a ${PREFIX}/lib + @${INSTALL_DATA} ${WRKSRC}/lib/THREADED_PIC/${i}.so.1 ${PREFIX}/lib @${LN} -sf ${i}.so.1 ${PREFIX}/lib/${i}.so .endfor @${INSTALL_DATA} ${WRKSRC}/include/cblas.h ${PREFIX}/include @@ -112,4 +175,4 @@ do-install: ${INSTALL_DATA} ${WRKSRC}/doc/* ${DOCSDIR} .endif -.include <bsd.port.mk> +.include <bsd.port.post.mk> |