| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: gcc.mk,v 1.117 2012/04/16 05:00:44 sbd Exp $ | | 1 | # $NetBSD: gcc.mk,v 1.118 2012/04/16 05:03:03 sbd Exp $ |
2 | # | | 2 | # |
3 | # This is the compiler definition for the GNU Compiler Collection. | | 3 | # This is the compiler definition for the GNU Compiler Collection. |
4 | # | | 4 | # |
5 | # User-settable variables: | | 5 | # User-settable variables: |
6 | # | | 6 | # |
7 | # USE_NATIVE_GCC | | 7 | # USE_NATIVE_GCC |
8 | # When set to "yes", the native gcc is used, no matter which | | 8 | # When set to "yes", the native gcc is used, no matter which |
9 | # compiler version a package requires. | | 9 | # compiler version a package requires. |
10 | # | | 10 | # |
11 | # USE_PKGSRC_GCC | | 11 | # USE_PKGSRC_GCC |
12 | # Force using the appropriate version of GCC from pkgsrc based on | | 12 | # Force using the appropriate version of GCC from pkgsrc based on |
13 | # GCC_REQD instead of the native compiler. | | 13 | # GCC_REQD instead of the native compiler. |
14 | # | | 14 | # |
| @@ -75,47 +75,51 @@ _DEF_VARS.gcc= \ | | | @@ -75,47 +75,51 @@ _DEF_VARS.gcc= \ |
75 | USE_NATIVE_GCC?= no | | 75 | USE_NATIVE_GCC?= no |
76 | USE_PKGSRC_GCC?= no | | 76 | USE_PKGSRC_GCC?= no |
77 | | | 77 | |
78 | GCC_REQD+= 2.8.0 | | 78 | GCC_REQD+= 2.8.0 |
79 | | | 79 | |
80 | # gcc2 doesn't support c99 and amd64 | | 80 | # gcc2 doesn't support c99 and amd64 |
81 | .if !empty(USE_LANGUAGES:Mc99) || ${MACHINE_ARCH} == "x86_64" | | 81 | .if !empty(USE_LANGUAGES:Mc99) || ${MACHINE_ARCH} == "x86_64" |
82 | GCC_REQD+= 3.0 | | 82 | GCC_REQD+= 3.0 |
83 | .endif | | 83 | .endif |
84 | | | 84 | |
85 | # _GCC_DIST_VERSION is the highest version of GCC installed by the pkgsrc | | 85 | # _GCC_DIST_VERSION is the highest version of GCC installed by the pkgsrc |
86 | # without the PKGREVISIONs. | | 86 | # without the PKGREVISIONs. |
87 | # | | 87 | # |
88 | _GCC_DIST_VERSION= 4.6.3 | | 88 | .include "../../lang/gcc47/version.mk" |
| | | 89 | _GCC_DIST_VERSION:= ${GCC_DIST_VERSION} |
89 | | | 90 | |
90 | # _GCC2_PATTERNS matches N s.t. N <= 2.95.3. | | 91 | # _GCC2_PATTERNS matches N s.t. N <= 2.95.3. |
91 | _GCC2_PATTERNS= [0-1].* 2.[0-9] 2.[0-9].* 2.[1-8][0-9] 2.[1-8][0-9].* \ | | 92 | _GCC2_PATTERNS= [0-1].* 2.[0-9] 2.[0-9].* 2.[1-8][0-9] 2.[1-8][0-9].* \ |
92 | 2.9[0-4] 2.9[0-4].* 2.95 2.95.[0-3] | | 93 | 2.9[0-4] 2.9[0-4].* 2.95 2.95.[0-3] |
93 | | | 94 | |
94 | # _GCC3_PATTERNS matches N s.t. 2.95.3 < N < 3.4. | | 95 | # _GCC3_PATTERNS matches N s.t. 2.95.3 < N < 3.4. |
95 | _GCC3_PATTERNS= 2.95.[4-9]* 2.95.[1-9][0-9]* 2.9[6-9] 2.9[6-9].* \ | | 96 | _GCC3_PATTERNS= 2.95.[4-9]* 2.95.[1-9][0-9]* 2.9[6-9] 2.9[6-9].* \ |
96 | 2.[1-9][0-9][0-9]* 3.[0-3] 3.[0-3].* | | 97 | 2.[1-9][0-9][0-9]* 3.[0-3] 3.[0-3].* |
97 | | | 98 | |
98 | # _GCC34_PATTERNS matches N s.t. 3.4 <= N < 4. | | 99 | # _GCC34_PATTERNS matches N s.t. 3.4 <= N < 4. |
99 | _GCC34_PATTERNS= 3.[4-9] 3.[4-9].* 3.[1-9][0-9]* | | 100 | _GCC34_PATTERNS= 3.[4-9] 3.[4-9].* 3.[1-9][0-9]* |
100 | | | 101 | |
101 | # _GCC44_PATTERNS matches N s.t. 4.4 <= N < 4.5. | | 102 | # _GCC44_PATTERNS matches N s.t. 4.4 <= N < 4.5. |
102 | _GCC44_PATTERNS= 4.4 4.4.* | | 103 | _GCC44_PATTERNS= 4.4 4.4.* |
103 | | | 104 | |
104 | # _GCC45_PATTERNS matches N s.t. 4.5 <= N < 4.6. | | 105 | # _GCC45_PATTERNS matches N s.t. 4.5 <= N < 4.6. |
105 | _GCC45_PATTERNS= 4.5 4.5.* | | 106 | _GCC45_PATTERNS= 4.5 4.5.* |
106 | | | 107 | |
107 | # _GCC46_PATTERNS matches N s.t. 4.6 <= N. | | 108 | # _GCC46_PATTERNS matches N s.t. 4.6 <= N < 4.7. |
108 | _GCC46_PATTERNS= 4.[6-9] 4.[6-9].* 4.[1-9][0-9]* [4-9]* | | 109 | _GCC46_PATTERNS= 4.6 4.6.* |
| | | 110 | |
| | | 111 | # _GCC46_PATTERNS matches N s.t. 4.7 <= N. |
| | | 112 | _GCC47_PATTERNS= 4.[7-9] 4.[7-9].* 4.[1-9][0-9]* [4-9]* |
109 | | | 113 | |
110 | # _CC is the full path to the compiler named by ${CC} if it can be found. | | 114 | # _CC is the full path to the compiler named by ${CC} if it can be found. |
111 | .if !defined(_CC) | | 115 | .if !defined(_CC) |
112 | _CC:= ${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} | | 116 | _CC:= ${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} |
113 | . for _dir_ in ${PATH:C/\:/ /g} | | 117 | . for _dir_ in ${PATH:C/\:/ /g} |
114 | . if empty(_CC:M/*) | | 118 | . if empty(_CC:M/*) |
115 | . if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}) | | 119 | . if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}) |
116 | _CC:= ${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} | | 120 | _CC:= ${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} |
117 | . endif | | 121 | . endif |
118 | . endif | | 122 | . endif |
119 | . endfor | | 123 | . endfor |
120 | MAKEFLAGS+= _CC=${_CC:Q} | | 124 | MAKEFLAGS+= _CC=${_CC:Q} |
121 | .endif | | 125 | .endif |
| @@ -214,46 +218,54 @@ _NEED_GCC44= yes | | | @@ -214,46 +218,54 @@ _NEED_GCC44= yes |
214 | .endfor | | 218 | .endfor |
215 | _NEED_GCC45?= no | | 219 | _NEED_GCC45?= no |
216 | .for _pattern_ in ${_GCC45_PATTERNS} | | 220 | .for _pattern_ in ${_GCC45_PATTERNS} |
217 | . if !empty(_GCC_REQD:M${_pattern_}) | | 221 | . if !empty(_GCC_REQD:M${_pattern_}) |
218 | _NEED_GCC45= yes | | 222 | _NEED_GCC45= yes |
219 | . endif | | 223 | . endif |
220 | .endfor | | 224 | .endfor |
221 | _NEED_GCC46?= no | | 225 | _NEED_GCC46?= no |
222 | .for _pattern_ in ${_GCC46_PATTERNS} | | 226 | .for _pattern_ in ${_GCC46_PATTERNS} |
223 | . if !empty(_GCC_REQD:M${_pattern_}) | | 227 | . if !empty(_GCC_REQD:M${_pattern_}) |
224 | _NEED_GCC46= yes | | 228 | _NEED_GCC46= yes |
225 | . endif | | 229 | . endif |
226 | .endfor | | 230 | .endfor |
| | | 231 | .for _pattern_ in ${_GCC47_PATTERNS} |
| | | 232 | . if !empty(_GCC_REQD:M${_pattern_}) |
| | | 233 | _NEED_GCC47= yes |
| | | 234 | . endif |
| | | 235 | .endfor |
227 | .if !empty(_NEED_GCC2:M[nN][oO]) && !empty(_NEED_GCC3:M[nN][oO]) && \ | | 236 | .if !empty(_NEED_GCC2:M[nN][oO]) && !empty(_NEED_GCC3:M[nN][oO]) && \ |
228 | !empty(_NEED_GCC34:M[nN][oO]) && !empty(_NEED_GCC44:M[nN][oO]) && \ | | 237 | !empty(_NEED_GCC34:M[nN][oO]) && !empty(_NEED_GCC44:M[nN][oO]) && \ |
229 | !empty(_NEED_GCC45:M[nN][oO]) && !empty(_NEED_GCC46:M[nN][oO]) | | 238 | !empty(_NEED_GCC45:M[nN][oO]) && !empty(_NEED_GCC46:M[nN][oO]) && \ |
230 | _NEED_GCC46= yes | | 239 | !empty(_NEED_GCC47:M[nN][oO]) |
| | | 240 | _NEED_GCC47= yes |
231 | .endif | | 241 | .endif |
232 | | | 242 | |
233 | # Assume by default that GCC will only provide a C compiler. | | 243 | # Assume by default that GCC will only provide a C compiler. |
234 | LANGUAGES.gcc?= c | | 244 | LANGUAGES.gcc?= c |
235 | .if !empty(_NEED_GCC2:M[yY][eE][sS]) | | 245 | .if !empty(_NEED_GCC2:M[yY][eE][sS]) |
236 | LANGUAGES.gcc= c c++ fortran fortran77 objc | | 246 | LANGUAGES.gcc= c c++ fortran fortran77 objc |
237 | .elif !empty(_NEED_GCC3:M[yY][eE][sS]) | | 247 | .elif !empty(_NEED_GCC3:M[yY][eE][sS]) |
238 | LANGUAGES.gcc= c c++ fortran fortran77 java objc | | 248 | LANGUAGES.gcc= c c++ fortran fortran77 java objc |
239 | .elif !empty(_NEED_GCC34:M[yY][eE][sS]) | | 249 | .elif !empty(_NEED_GCC34:M[yY][eE][sS]) |
240 | LANGUAGES.gcc= c c++ fortran fortran77 objc | | 250 | LANGUAGES.gcc= c c++ fortran fortran77 objc |
241 | .elif !empty(_NEED_GCC44:M[yY][eE][sS]) | | 251 | .elif !empty(_NEED_GCC44:M[yY][eE][sS]) |
242 | LANGUAGES.gcc= c c++ fortran fortran77 java objc | | 252 | LANGUAGES.gcc= c c++ fortran fortran77 java objc |
243 | .elif !empty(_NEED_GCC45:M[yY][eE][sS]) | | 253 | .elif !empty(_NEED_GCC45:M[yY][eE][sS]) |
244 | LANGUAGES.gcc= c c++ fortran fortran77 java objc | | 254 | LANGUAGES.gcc= c c++ fortran fortran77 java objc |
245 | .elif !empty(_NEED_GCC46:M[yY][eE][sS]) | | 255 | .elif !empty(_NEED_GCC46:M[yY][eE][sS]) |
246 | LANGUAGES.gcc= c c++ fortran fortran77 java objc | | 256 | LANGUAGES.gcc= c c++ fortran fortran77 java objc |
| | | 257 | .elif !empty(_NEED_GCC47:M[yY][eE][sS]) |
| | | 258 | LANGUAGES.gcc= c c++ fortran fortran77 go java objc obj-c++ |
247 | .endif | | 259 | .endif |
248 | _LANGUAGES.gcc= # empty | | 260 | _LANGUAGES.gcc= # empty |
249 | .for _lang_ in ${USE_LANGUAGES} | | 261 | .for _lang_ in ${USE_LANGUAGES} |
250 | _LANGUAGES.gcc+= ${LANGUAGES.gcc:M${_lang_}} | | 262 | _LANGUAGES.gcc+= ${LANGUAGES.gcc:M${_lang_}} |
251 | .endfor | | 263 | .endfor |
252 | | | 264 | |
253 | .if !empty(USE_LANGUAGES:Mc99) | | 265 | .if !empty(USE_LANGUAGES:Mc99) |
254 | _WRAP_EXTRA_ARGS.CC+= -std=gnu99 | | 266 | _WRAP_EXTRA_ARGS.CC+= -std=gnu99 |
255 | .endif | | 267 | .endif |
256 | | | 268 | |
257 | # GCC has this annoying behaviour where it advocates in a multi-line | | 269 | # GCC has this annoying behaviour where it advocates in a multi-line |
258 | # banner the use of "#include" over "#import" when including headers. | | 270 | # banner the use of "#include" over "#import" when including headers. |
259 | # This generates a huge number of warnings when building practically all | | 271 | # This generates a huge number of warnings when building practically all |
| @@ -362,26 +374,47 @@ _GCC_PKGBASE= gcc46 | | | @@ -362,26 +374,47 @@ _GCC_PKGBASE= gcc46 |
362 | _IGNORE_GCC= yes | | 374 | _IGNORE_GCC= yes |
363 | MAKEFLAGS+= _IGNORE_GCC=yes | | 375 | MAKEFLAGS+= _IGNORE_GCC=yes |
364 | . endif | | 376 | . endif |
365 | . if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) | | 377 | . if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) |
366 | _GCC_PKGSRCDIR= ../../lang/gcc46 | | 378 | _GCC_PKGSRCDIR= ../../lang/gcc46 |
367 | _GCC_DEPENDENCY= gcc46>=${_GCC_REQD}:../../lang/gcc46 | | 379 | _GCC_DEPENDENCY= gcc46>=${_GCC_REQD}:../../lang/gcc46 |
368 | . if !empty(_LANGUAGES.gcc:Mc++) || \ | | 380 | . if !empty(_LANGUAGES.gcc:Mc++) || \ |
369 | !empty(_LANGUAGES.gcc:Mfortran) || \ | | 381 | !empty(_LANGUAGES.gcc:Mfortran) || \ |
370 | !empty(_LANGUAGES.gcc:Mfortran77) || \ | | 382 | !empty(_LANGUAGES.gcc:Mfortran77) || \ |
371 | !empty(_LANGUAGES.gcc:Mobjc) | | 383 | !empty(_LANGUAGES.gcc:Mobjc) |
372 | _USE_GCC_SHLIB?= yes | | 384 | _USE_GCC_SHLIB?= yes |
373 | . endif | | 385 | . endif |
374 | . endif | | 386 | . endif |
| | | 387 | .elif !empty(_NEED_GCC47:M[yY][eE][sS]) |
| | | 388 | # |
| | | 389 | # We require gcc-4.7.x in the lang/gcc47 directory. |
| | | 390 | # |
| | | 391 | _GCC_PKGBASE= gcc47 |
| | | 392 | . if !empty(PKGPATH:Mlang/gcc47) |
| | | 393 | _IGNORE_GCC= yes |
| | | 394 | MAKEFLAGS+= _IGNORE_GCC=yes |
| | | 395 | . endif |
| | | 396 | . if !defined(_IGNORE_GCC) && !empty(_LANGUAGES.gcc) |
| | | 397 | _GCC_PKGSRCDIR= ../../lang/gcc47 |
| | | 398 | _GCC_DEPENDENCY= gcc47>=${_GCC_REQD}:../../lang/gcc47 |
| | | 399 | . if !empty(_LANGUAGES.gcc:Mc++) || \ |
| | | 400 | !empty(_LANGUAGES.gcc:Mfortran) || \ |
| | | 401 | !empty(_LANGUAGES.gcc:Mfortran77) || \ |
| | | 402 | !empty(_LANGUAGES.gcc:Mgo) || \ |
| | | 403 | !empty(_LANGUAGES.gcc:Mobjc) || \ |
| | | 404 | !empty(_LANGUAGES.gcc:Mobj-c++) |
| | | 405 | _USE_GCC_SHLIB?= yes |
| | | 406 | . endif |
| | | 407 | . endif |
375 | .endif | | 408 | .endif |
376 | _GCC_DEPENDS= ${_GCC_PKGBASE}>=${_GCC_REQD} | | 409 | _GCC_DEPENDS= ${_GCC_PKGBASE}>=${_GCC_REQD} |
377 | | | 410 | |
378 | .if !empty(_NEED_GCC3:M[yY][eE][sS]) | | 411 | .if !empty(_NEED_GCC3:M[yY][eE][sS]) |
379 | . if !empty(PKGPATH:Mlang/gcc3-c++) | | 412 | . if !empty(PKGPATH:Mlang/gcc3-c++) |
380 | _IGNORE_GCC3CXX= yes | | 413 | _IGNORE_GCC3CXX= yes |
381 | MAKEFLAGS+= _IGNORE_GCC3CXX=yes | | 414 | MAKEFLAGS+= _IGNORE_GCC3CXX=yes |
382 | . endif | | 415 | . endif |
383 | . if !defined(_IGNORE_GCC3CXX) && !empty(_LANGUAGES.gcc:Mc++) | | 416 | . if !defined(_IGNORE_GCC3CXX) && !empty(_LANGUAGES.gcc:Mc++) |
384 | _GCC_PKGSRCDIR+= ../../lang/gcc3-c++ | | 417 | _GCC_PKGSRCDIR+= ../../lang/gcc3-c++ |
385 | _GCC_DEPENDENCY+= gcc3-c++>=${_GCC_REQD}:../../lang/gcc3-c++ | | 418 | _GCC_DEPENDENCY+= gcc3-c++>=${_GCC_REQD}:../../lang/gcc3-c++ |
386 | _USE_GCC_SHLIB?= yes | | 419 | _USE_GCC_SHLIB?= yes |
387 | . endif | | 420 | . endif |