Sat Mar 7 15:19:20 2020 UTC ()
Match indentation.


(maya)
diff -r1.12 -r1.13 pkgsrc/mk/compiler/gfortran.mk

cvs diff -r1.12 -r1.13 pkgsrc/mk/compiler/gfortran.mk (switch to unified diff)

--- pkgsrc/mk/compiler/gfortran.mk 2020/03/07 15:18:19 1.12
+++ pkgsrc/mk/compiler/gfortran.mk 2020/03/07 15:19:20 1.13
@@ -1,122 +1,122 @@ @@ -1,122 +1,122 @@
1# $NetBSD: gfortran.mk,v 1.12 2020/03/07 15:18:19 maya Exp $ 1# $NetBSD: gfortran.mk,v 1.13 2020/03/07 15:19:20 maya Exp $
2# 2#
3# Copyright (c) 2005 The NetBSD Foundation, Inc. 3# Copyright (c) 2005 The NetBSD Foundation, Inc.
4# All rights reserved. 4# All rights reserved.
5# 5#
6# This code is derived from software contributed to The NetBSD Foundation 6# This code is derived from software contributed to The NetBSD Foundation
7# by Johnny C. Lam. 7# by Johnny C. Lam.
8# 8#
9# Redistribution and use in source and binary forms, with or without 9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions 10# modification, are permitted provided that the following conditions
11# are met: 11# are met:
12# 1. Redistributions of source code must retain the above copyright 12# 1. Redistributions of source code must retain the above copyright
13# notice, this list of conditions and the following disclaimer. 13# notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright 14# 2. Redistributions in binary form must reproduce the above copyright
15# notice, this list of conditions and the following disclaimer in the 15# notice, this list of conditions and the following disclaimer in the
16# documentation and/or other materials provided with the distribution. 16# documentation and/or other materials provided with the distribution.
17# 17#
18# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28# POSSIBILITY OF SUCH DAMAGE. 28# POSSIBILITY OF SUCH DAMAGE.
29# 29#
30 30
31.if !defined(COMPILER_GFORTRAN_MK) 31.if !defined(COMPILER_GFORTRAN_MK)
32COMPILER_GFORTRAN_MK= defined 32COMPILER_GFORTRAN_MK= defined
33 33
34.include "../../mk/bsd.prefs.mk" 34.include "../../mk/bsd.prefs.mk"
35 35
36# If pkgsrc base compiler is GCC, match the gfortran requirement as closely as 36# If pkgsrc base compiler is GCC, match the gfortran requirement as closely as
37# possible. Otherwise, default to a mainstream version and hope for the best. 37# possible. Otherwise, default to a mainstream version and hope for the best.
38# If base compiler is clang, we really should use flang rather than gfortran. 38# If base compiler is clang, we really should use flang rather than gfortran.
39POSSIBLE_GFORTRAN_VERSION?= ${CC_VERSION:C/.[0-9].[0-9]//:S/gcc-//} 39POSSIBLE_GFORTRAN_VERSION?= ${CC_VERSION:C/.[0-9].[0-9]//:S/gcc-//}
40 40
41.if (${PKGSRC_COMPILER} == gcc) && \ 41.if (${PKGSRC_COMPILER} == gcc) && \
42 exists(${PKGSRCDIR}/lang/gcc${POSSIBLE_GFORTRAN_VERSION}/buildlink3.mk) 42 exists(${PKGSRCDIR}/lang/gcc${POSSIBLE_GFORTRAN_VERSION}/buildlink3.mk)
43GFORTRAN_VERSION?= ${POSSIBLE_GFORTRAN_VERSION} 43GFORTRAN_VERSION?= ${POSSIBLE_GFORTRAN_VERSION}
44.else 44.else
45GFORTRAN_VERSION?= 7 45GFORTRAN_VERSION?= 7
46.endif 46.endif
47 47
48.if !empty(PKGPATH:Mlang/gcc${GFORTRAN_VERSION}) || !empty(PKGPATH:Mdevel/patch) || \ 48.if !empty(PKGPATH:Mlang/gcc${GFORTRAN_VERSION}) || !empty(PKGPATH:Mdevel/patch) || \
49 !empty(PKGPATH:Mdevel/libtool-base) 49 !empty(PKGPATH:Mdevel/libtool-base)
50IGNORE_GFORTRAN= yes 50IGNORE_GFORTRAN= yes
51MAKEFLAGS+= IGNORE_GFORTRAN=yes 51MAKEFLAGS+= IGNORE_GFORTRAN=yes
52.endif 52.endif
53 53
54.if defined(IGNORE_GFORTRAN) 54.if defined(IGNORE_GFORTRAN)
55_USE_GFORTRAN= NO 55_USE_GFORTRAN= NO
56.endif 56.endif
57 57
58# LANGUAGES.<compiler> is the list of supported languages by the compiler. 58# LANGUAGES.<compiler> is the list of supported languages by the compiler.
59# _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the ones 59# _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the ones
60# requested by the package in USE_LANGUAGES. 60# requested by the package in USE_LANGUAGES.
61# 61#
62LANGUAGES.gfortran= fortran fortran77 62LANGUAGES.gfortran= fortran fortran77
63_LANGUAGES.gfortran= # empty 63_LANGUAGES.gfortran= # empty
64.for _lang_ in ${USE_LANGUAGES} 64.for _lang_ in ${USE_LANGUAGES}
65_LANGUAGES.gfortran+= ${LANGUAGES.gfortran:M${_lang_}} 65_LANGUAGES.gfortran+= ${LANGUAGES.gfortran:M${_lang_}}
66.endfor 66.endfor
67.if empty(_LANGUAGES.gfortran) 67.if empty(_LANGUAGES.gfortran)
68_USE_GFORTRAN= NO 68_USE_GFORTRAN= NO
69.endif 69.endif
70 70
71.if !defined(_USE_GFORTRAN) 71.if !defined(_USE_GFORTRAN)
72_USE_GFORTRAN= YES 72_USE_GFORTRAN= YES
73.endif 73.endif
74 74
75.if !empty(_USE_GFORTRAN:M[yY][eE][sS]) 75.if !empty(_USE_GFORTRAN:M[yY][eE][sS])
76_GFORTRANBASE= ${LOCALBASE}/gcc${GFORTRAN_VERSION} 76_GFORTRANBASE= ${LOCALBASE}/gcc${GFORTRAN_VERSION}
77FC= gfortran 77FC= gfortran
78 78
79_GFORTRAN_DIR= ${WRKDIR}/.gfortran 79_GFORTRAN_DIR= ${WRKDIR}/.gfortran
80_GFORTRAN_VARS= # empty 80_GFORTRAN_VARS= # empty
81. if !empty(_LANGUAGES.gfortran:Mfortran) || \ 81. if !empty(_LANGUAGES.gfortran:Mfortran) || \
82 !empty(_LANGUAGES.gfortran:Mfortran77) 82 !empty(_LANGUAGES.gfortran:Mfortran77)
83PKG_FC?= ${FC} 83PKG_FC?= ${FC}
84_GFORTRAN_VARS+= FC 84_GFORTRAN_VARS+= FC
85_GFORTRAN_FC:= ${_GFORTRAN_DIR}/bin/${PKG_FC:T} 85_GFORTRAN_FC:= ${_GFORTRAN_DIR}/bin/${PKG_FC:T}
86_ALIASES.FC+= f77 g77 g95 gfortran 86_ALIASES.FC+= f77 g77 g95 gfortran
87FCPATH= ${_GFORTRANBASE}/bin/gfortran 87FCPATH= ${_GFORTRANBASE}/bin/gfortran
88PKG_FC:= ${_GFORTRAN_FC} 88PKG_FC:= ${_GFORTRAN_FC}
89. endif 89. endif
90 90
91# Prepend the path the to the compiler to the PATH 91# Prepend the path the to the compiler to the PATH
92. if !empty(_LANGUAGES.gfortran) 92. if !empty(_LANGUAGES.gfortran)
93PREPEND_PATH+= ${_GFORTRAN_DIR}/bin 93PREPEND_PATH+= ${_GFORTRAN_DIR}/bin
94. endif 94. endif
95 95
96# Add the dependency on gfortran. 96# Add the dependency on gfortran.
97BUILDLINK_DEPMETHOD.gcc${GFORTRAN_VERSION}= full 97BUILDLINK_DEPMETHOD.gcc${GFORTRAN_VERSION}= full
98. include "../../lang/gcc${GFORTRAN_VERSION}/buildlink3.mk" 98. include "../../lang/gcc${GFORTRAN_VERSION}/buildlink3.mk"
99 99
100. if defined(GFORTRAN_DIR) && !empty(GFORTRAN_DIR) 100. if defined(GFORTRAN_DIR) && !empty(GFORTRAN_DIR)
101PKGSRC_MAKE_ENV+= GFORTRAN_DIR=${GFORTRAN_DIR:Q} 101PKGSRC_MAKE_ENV+= GFORTRAN_DIR=${GFORTRAN_DIR:Q}
102. endif 102. endif
103 103
104# Create symlinks for the compiler into ${WRKDIR}. 104# Create symlinks for the compiler into ${WRKDIR}.
105. for _var_ in ${_GFORTRAN_VARS} 105. for _var_ in ${_GFORTRAN_VARS}
106. if !target(${_GFORTRAN_${_var_}}) 106. if !target(${_GFORTRAN_${_var_}})
107override-tools: ${_GFORTRAN_${_var_}} 107override-tools: ${_GFORTRAN_${_var_}}
108${_GFORTRAN_${_var_}}: 108${_GFORTRAN_${_var_}}:
109 ${RUN}${MKDIR} ${.TARGET:H} 109 ${RUN}${MKDIR} ${.TARGET:H}
110 ${RUN} \ 110 ${RUN} \
111 ${LN} -fs ${_GFORTRANBASE}/bin/gfortran ${.TARGET} 111 ${LN} -fs ${_GFORTRANBASE}/bin/gfortran ${.TARGET}
112. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//} 112. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
113 ${RUN} \ 113 ${RUN} \
114 if [ ! -x "${_alias_}" ]; then \ 114 if [ ! -x "${_alias_}" ]; then \
115 ${LN} -fs ${_GFORTRANBASE}/bin/gfortran ${_alias_}; \ 115 ${LN} -fs ${_GFORTRANBASE}/bin/gfortran ${_alias_}; \
116 fi 116 fi
117. endfor 117. endfor
118. endif 118. endif
119. endfor 119. endfor
120.endif # _USE_GFORTRAN == "yes" 120.endif # _USE_GFORTRAN == "yes"
121 121
122.endif # COMPILER_GFORTRAN_MK 122.endif # COMPILER_GFORTRAN_MK