aboutsummaryrefslogtreecommitdiff
path: root/science/dft++/Makefile
blob: 145136a5eae8b5e3a716ac124dffe8ff58a65d6d (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
# New ports collection makefile for:   dft++
# Date Created:                18 March 2004
# Whom:                        NAKATA Maho <maho@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=	dft++
PORTVERSION=	3.0
CATEGORIES=	science
MASTER_SITES=	http://dft.physics.cornell.edu/src/ \
		http://dft.physics.cornell.edu/example/:example
DISTFILES=	${PORTNAME}.v${PORTVERSION}.tar.gz
.if !defined(NOPORTDOCS)
DISTFILES+=	dft.in:example si_psp.tar:example output:example
.endif
DIST_SUBDIR=	dft++
EXTRACT_ONLY=	${PORTNAME}.v${PORTVERSION}.tar.gz

MAINTAINER=	maho@FreeBSD.org
COMMENT=	DFT++, A density functional software

LIB_DEPENDS=	atlas:${PORTSDIR}/math/atlas\
		fftw.2:${PORTSDIR}/math/fftw

WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
USE_GMAKE=	yes
USE_REINPLACE=	yes
LAPACK=		-lalapack -lcblas -lf77blas -lg2c -latlas
FFTW=		-lfftw

.if defined(WITH_OPTIMIZED_FLAGS)
OPTIMIZED_FLAGS+=	-O3 -ffast-math -finline-functions -fomit-frame-pointer -funroll-loops -fexpensive-optimizations -malign-double
.if (${ARCH} == "i386")
OPTIMIZED_FLAGS+=	-mcpu=i686 -march=i686 -mfancy-math-387 -mpreferred-stack-boundary=3
.endif # i386
.endif

pre-patch:
	${CP} ${WRKSRC}/makefile ${WRKSRC}/makefile-pw
	${CP} ${WRKSRC}/makefile ${WRKSRC}/makefile-wl

pre-configure:
	@${ECHO} "You can optimize by setting WITH_OPTIMIZED_FLAGS=yes."
	@${REINPLACE_CMD} -e ' s|%%FC%%|${FC}|g ; \
			      s|%%CC%%|${CC}|g ; \
			      s|%%CXX%%|${CXX}|g ; \
			      s|%%OPTIMIZED_FLAGS%%|${OPTIMIZED_FLAGS}|g ; \
			      s|%%LAPACK%%|${LAPACK}|g ; \
			      s|%%FFTW%%|${FFTW}|g ; \
			      s|%%LOCALBASE%%|${LOCALBASE}|g ; \
			      s|%%FFLAGS%%|${FFLAGS}|g ; \
			      s|%%CFLAGS%%|${CFLAGS}|g ; \
			      s|%%CXXFLAGS%%|${CXXFLAGS}|g ;' ${WRKSRC}/makefile.local-pw
	@${REINPLACE_CMD} -e ' s|%%FC%%|${FC}|g ; \
			      s|%%CC%%|${CC}|g ; \
			      s|%%CXX%%|${CXX}|g ; \
			      s|%%LAPACK%%|${LAPACK}|g ; \
			      s|%%FFTW%%|${FFTW}|g ; \
			      s|%%OPTIMIZED_FLAGS%%|${OPTIMIZED_FLAGS}|g ; \
			      s|%%FFLAGS%%|${FFLAGS}|g ; \
			      s|%%CFLAGS%%|${CFLAGS}|g ; \
			      s|%%LOCALBASE%%|${LOCALBASE}|g ; \
			      s|%%CXXFLAGS%%|${CXXFLAGS}|g ;' ${WRKSRC}/makefile.local-wl

do-build:
	@cd ${WRKSRC} ; ${GMAKE}	-f makefile-pw dft-pw
	@cd ${WRKSRC} ; ${GMAKE}	-f makefile-pw clean
	@cd ${WRKSRC} ; ${GMAKE}	-f makefile-wl dft-wl

do-install:
	@${INSTALL_PROGRAM} ${WRKSRC}/dft-pw ${PREFIX}/bin
	@${INSTALL_PROGRAM} ${WRKSRC}/dft-wl ${PREFIX}/bin
.if !defined(NOPORTDOCS)
	@${MKDIR} ${EXAMPLESDIR}
	@${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/dft.in     ${EXAMPLESDIR}
	@${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/output     ${EXAMPLESDIR}
	@${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/si_psp.tar ${EXAMPLESDIR}
	@${TAR} xf ${DISTDIR}/${DIST_SUBDIR}/si_psp.tar -C    ${EXAMPLESDIR}
	@${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${EXAMPLESDIR}
.endif

.include <bsd.port.mk>