blob: 51d9c6bb61e3c08ac942e8d10d61cfe5ddc42bc0 (
plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# $NetBSD: compiler.mk,v 1.5 2003/09/12 20:10:17 grant Exp $
# This Makefile fragment implements handling for supported
# C/C++/fortran compilers.
#
# The following variables are used:
#
# USE_GCC2
# Use pkgsrc gcc2 from lang/gcc.
#
# USE_GCC3
# Use pkgsrc gcc3 from lang/gcc3.
#
# USE_GCC_SHLIB
# Indicates that a package uses GCC shared libraries, so we
# register a runtime dependency on the compiler package.
#
# The following variables are reserved for future use:
#
# USE_MIPSPRO
# Use the Silicon Graphics, Inc. MIPSpro compiler.
#
# USE_SUNPRO
# Use the Sun Microsystems Inc. WorkShop/Forte/Sun ONE Studio
# compiler collection.
#
.if !defined(COMPILER_MK)
COMPILER_MK= # defined
.include "../../mk/bsd.prefs.mk"
.if defined(USE_GCC2) && empty(PKGPATH:Mlang/gcc) && empty(_PKGSRC_DEPS:Mgcc-2*)
GCC_REQD?= 2.95.3
# we need to define these early, as they are used by gcc/buildlink2.mk.
_GCC_SUBPREFIX= gcc-2.95.3/
_GCC_ARCHDIR= ${_GCC_PREFIX}${_GCC_ARCHSUBDIR}
_GCC_ARCHSUBDIR= lib/gcc-lib/${MACHINE_GNU_PLATFORM}/2.95.3
. if empty(USE_BUILDLINK2:M[nN][oO])
. include "../lang/gcc/buildlink2.mk"
. else
_GCC_PREFIX= ${LOCALBASE}/${_GCC_SUBPREFIX}
# Packages that link against gcc shared libraries need a full
# dependency.
. if defined(USE_GCC_SHLIB)
DEPENDS+= gcc>=${GCC_REQD}:../../lang/gcc
. else
BUILD_DEPENDS+= gcc>=${GCC_REQD}:../../lang/gcc
. endif
. endif # buildlink2
PATH:= ${_GCC_PREFIX}bin:${PATH}
CC= ${_GCC_PREFIX}bin/gcc
CPP= ${_GCC_PREFIX}bin/cpp
CXX= ${_GCC_PREFIX}bin/g++
F77= ${_GCC_PREFIX}bin/g77
PKG_FC= ${F77}
.elif defined(USE_GCC3) && empty(PKGPATH:Mlang/gcc3) && empty(_PKGSRC_DEPS:Mgcc-3*)
GCC_REQD?= 3.3
# we need to define these early, as they are used by gcc3/buildlink2.mk.
_GCC_SUBPREFIX= gcc-3.3/
_GCC_ARCHDIR= ${_GCC_PREFIX}${_GCC_ARCHSUBDIR}
. if empty(USE_BUILDLINK2:M[nN][oO])
. include "../lang/gcc3/buildlink2.mk"
. else
_GCC_PREFIX= ${LOCALBASE}/${_GCC_SUBPREFIX}
_GCC_LIBGCCDIR!= \
dirname `${_GCC_PREFIX}bin/gcc --print-libgcc-file-name`
_GCC_ARCHSUBDIR= \
${_GCC_LIBGCCDIR:S|^${LOCALBASE}/${_GCC_SUBPREFIX}||}
# Packages that link against gcc shared libraries need a full
# dependency.
. if defined(USE_GCC_SHLIB)
DEPENDS+= gcc3>=${GCC_REQD}:../../lang/gcc3
. else
BUILD_DEPENDS+= gcc3>=${GCC_REQD}:../../lang/gcc3
. endif
. endif # buildlink2
PATH:= ${_GCC_PREFIX}bin:${PATH}
CC= ${_GCC_PREFIX}bin/gcc
CPP= ${_GCC_PREFIX}bin/cpp
CXX= ${_GCC_PREFIX}bin/g++
F77= ${_GCC_PREFIX}bin/g77
PKG_FC= ${F77}
.endif # USE_GCC3
# Ensure that the correct rpath is passed to the linker if we need to
# link against gcc shared libs.
.if (defined(USE_GCC2) || defined(USE_GCC3)) && defined(USE_GCC_SHLIB)
_GCC_LDFLAGS= -L${_GCC_ARCHDIR} -Wl,${RPATH_FLAG}${_GCC_ARCHDIR} -L${_GCC_PREFIX}lib -Wl,${RPATH_FLAG}${_GCC_PREFIX}lib
LDFLAGS+= ${_GCC_LDFLAGS}
.endif
# The SunPro C++ compiler doesn't support passing linker flags with
# -Wl to CC, so we make buildlink2 perform the required magic.
#
.if defined(USE_SUNPRO)
_COMPILER_LD_FLAG= # SunPro compiler
.else
_COMPILER_LD_FLAG= -Wl, # GCC and others
.endif
.endif # COMPILER_MK
|