freebsd-ports/Mk/Uses/fortran.mk
Tijl Coosemans fe837ee6c6 Change the way USES is handled:
- Loop over USES twice, once to define all *_ARGS variables and once to
  include Uses/*.mk.  This allows all Uses/*.mk to examine arguments given
  to other USES entries.
- Always define *_ARGS (possibly empty) and replace commas with spaces.

Similar for _USES_POST.

Adjust all Uses/*.mk:
- defined(u_ARGS) becomes !empty(u_ARGS)
- Eliminate helper variables like _*_ARGS=${*_ARGS:C/,/ /g}
- Some Uses/*.mk used ":" as argument separator instead of ",", but no port
  used this form
- Uses/cran.mk: remove unused variable VALID_ARGS and USES+=fortran which
  has no effect
- Uses/twisted.mk: simplify handling of the case where neither "build" nor
  "run" arguments have been specified

PR:		193931
Exp-run by:	antoine
Approved by:	portmgr (antoine)
2014-09-28 16:36:31 +00:00

47 lines
1.4 KiB
Makefile

# $FreeBSD$
#
# Fortran support
#
# Feature: fortran
# Usage: USES=fortran
# Valid ARGS: gcc (default), ifort
#
# MAINTAINER: fortran@FreeBSD.org
.if !defined(_INCLUDE_USES_FORTRAN_MK)
_INCLUDE_USES_FORTRAN_MK= yes
.if empty(fortran_ARGS)
fortran_ARGS= gcc
.endif
.if ${fortran_ARGS} == gcc
.include "${PORTSDIR}/Mk/bsd.default-versions.mk"
_GCC_VER= ${GCC_DEFAULT:S/.//}
.if ${_GCC_VER} == 48
BUILD_DEPENDS+= gfortran${_GCC_VER}:${PORTSDIR}/lang/gcc
RUN_DEPENDS+= gfortran${_GCC_VER}:${PORTSDIR}/lang/gcc
.else
BUILD_DEPENDS+= gfortran${_GCC_VER}:${PORTSDIR}/lang/gcc${_GCC_VER}
RUN_DEPENDS+= gfortran${_GCC_VER}:${PORTSDIR}/lang/gcc${_GCC_VER}
.endif
USE_BINUTILS= yes
F77= gfortran${_GCC_VER}
FC= gfortran${_GCC_VER}
FFLAGS+= -Wl,-rpath=${LOCALBASE}/lib/gcc${_GCC_VER}
FCFLAGS+= -Wl,-rpath=${LOCALBASE}/lib/gcc${_GCC_VER}
LDFLAGS+= -Wl,-rpath=${LOCALBASE}/lib/gcc${_GCC_VER} \
-L${LOCALBASE}/lib/gcc${_GCC_VER} -B${LOCALBASE}/bin
.elif ${fortran_ARGS} == ifort
BUILD_DEPENDS+= ${LOCALBASE}/intel_fc_80/bin/ifort:${PORTSDIR}/lang/ifc
RUN_DEPENDS+= ${LOCALBASE}/intel_fc_80/bin/ifort:${PORTSDIR}/lang/ifc
F77= ${LOCALBASE}/intel_fc_80/bin/ifort
FC= ${LOCALBASE}/intel_fc_80/bin/ifort
.else
IGNORE= USES=fortran: invalid arguments: ${fortran_ARGS}
.endif
CONFIGURE_ENV+= F77="${F77}" FC="${FC}" FFLAGS="${FFLAGS}" FCFLAGS="${FCFLAGS}"
MAKE_ENV+= F77="${F77}" FC="${FC}" FFLAGS="${FFLAGS}" FCFLAGS="${FCFLAGS}"
.endif