Add files from parent branch HEAD:
[pkgsrc.git] / mk / compiler / sunpro.mk
1 # $NetBSD: sunpro.mk,v 1.44 2008/06/17 11:23:48 sketch Exp $
2 #
3 # This is the compiler definition for the SUNWspro C compiler.
4 #
5 # User-settable variables:
6 #
7 # SUNWSPROBASE
8 #       The base directory where the compiler is installed.
9 #
10 # Keywords: sun sunpro sunwspro
11 #
12
13 .if !defined(COMPILER_SUNPRO_MK)
14 COMPILER_SUNPRO_MK=     defined
15
16 .include "../../mk/bsd.prefs.mk"
17
18 SUNWSPROBASE?=          /opt/SUNWspro
19
20 # common definitions
21 # XXX: should be moved to compiler.mk.
22 _COMPILER_TYPE.c=       CC
23 _COMPILER_TYPE.c++ =    CXX
24 _COMPILER_TYPE.fortran= FC
25
26 # sunpro-specific definitions
27 _COMPILER_LANGS=        c c++ fortran
28 _COMPILER_NAME.c=       cc
29 _COMPILER_NAME.c++ =    CC
30 _COMPILER_NAME.fortran= f77
31
32 # LANGUAGES.<compiler> is the list of supported languages by the
33 # compiler.
34 #
35 LANGUAGES.sunpro=       # empty
36
37 # XXX: Should be moved to compiler.mk.
38 .for l in ${_COMPILER_LANGS}
39 .  for t in ${_COMPILER_TYPE.${l}}
40 .    for n in ${_COMPILER_NAME.${l}}
41 .      if exists(${SUNWSPROBASE}/bin/${n})
42 LANGUAGES.sunpro+=      ${l}
43 _COMPILER_STRIP_VARS+=  ${t}
44 # XXX: What is the ${t}PATH variable used for? And why isn't it
45 # parameterized as usual? This makes searching for it very difficult.
46 # Same for PKG_${t}.
47 ${t}PATH=               ${SUNWSPROBASE}/bin/${n}
48 PKG_${t}:=              ${SUNWSPROBASE}/bin/${n}
49 .      endif
50 .    endfor
51 .  endfor
52 .endfor
53
54 # Turn on C99 support if required
55 # XXX: What if a package needs both -- a c89 and a c99 compiler?
56 #
57 # Solaris SunPro Compiler 11/12 fails on Solaris 8/9 with -xc99
58 # The header files supplied by the OS are not c99 aware, the
59 # manpage suggests the setting: -xc99=all,no_lib
60 # See PR 37200
61 .if !empty(USE_LANGUAGES:Mc99)
62 _WRAP_EXTRA_ARGS.CC+=   -xc99
63 . if !empty(MACHINE_PLATFORM:MSunOS-5.[89]-*)
64 _WRAP_EXTRA_ARGS.CC+=   -xc99=all,no_lib
65 . endif
66 .endif
67
68 # The Solaris linker uses "-R" for rpath directives.
69 # XXX: This shouldn't be here, but in platform/SunOS.mk.
70 _LINKER_RPATH_FLAG=     -R
71
72 # SunPro passes rpath directives to the linker using "-R", however
73 # some packages require the "-Wl," prefix to recognize linker options.
74 # This is transformed by the compiler wrapper to "-R".
75 _COMPILER_RPATH_FLAG=   -Wl,-R
76
77 # XXX: What about the versions of the other compilers? Fortran and C++?
78 # XXX: should be moved to compiler.mk.
79 .if exists(${CCPATH})
80 CC_VERSION_STRING!=     ${CCPATH} -V 2>&1 || ${TRUE}
81 CC_VERSION!=            ${CCPATH} -V 2>&1 | ${GREP} '^cc'
82 .else
83 CC_VERSION_STRING?=     ${CC_VERSION}
84 CC_VERSION?=            cc: Sun C
85 .endif
86
87 # SunPro compiler must be passed certain flags to compile/link 64-bit code.
88 .if !empty(CC_VERSION:M5.9) 
89 _COMPILER_ABI_FLAG.64= -m64
90 .elif ${MACHINE_ARCH} == "sparc"
91 _COMPILER_ABI_FLAG.64=  -xtarget=ultra -xarch=v9
92 .else
93 _COMPILER_ABI_FLAG.64= -xarch=amd64
94 .endif
95
96 # _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the
97 # ones requested by the package in USE_LANGUAGES.
98 #
99 # XXX: should be moved to compiler.mk.
100 _LANGUAGES.sunpro=      # empty
101 .for _lang_ in ${USE_LANGUAGES}
102 _LANGUAGES.sunpro+=     ${LANGUAGES.sunpro:M${_lang_}}
103 .endfor
104
105 .endif  # COMPILER_SUNPRO_MK