summaryrefslogtreecommitdiff
path: root/mk/compiler/sunpro.mk
blob: 1ad96a3c362d4189bd5d9e80e9b593228d952588 (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
# $NetBSD: sunpro.mk,v 1.23 2004/11/23 00:46:26 dmcmahill Exp $

.if !defined(COMPILER_SUNPRO_MK)
COMPILER_SUNPRO_MK=	defined

.include "../../mk/bsd.prefs.mk"

SUNWSPROBASE?=	/opt/SUNWspro

# LANGUAGES.<compiler> is the list of supported languages by the compiler.
# _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the ones
# requested by the package in USE_LANGUAGES.
#
LANGUAGES.sunpro=	c c++
_LANGUAGES.sunpro=	# empty
.for _lang_ in ${USE_LANGUAGES}
_LANGUAGES.sunpro+=	${LANGUAGES.sunpro:M${_lang_}}
.endfor

_SUNPRO_DIR=	${WRKDIR}/.sunpro
_SUNPRO_LINKS=	# empty
.if exists(${SUNWSPROBASE}/bin/cc)
_SUNPRO_CC=	${_SUNPRO_DIR}/bin/cc
_SUNPRO_LINKS+=	_SUNPRO_CC
PKG_CC=		${_SUNPRO_CC}
CC=		${PKG_CC:T}
CCPATH=		${SUNWSPROBASE}/bin/cc
.endif
.if exists(${SUNWSPROBASE}/bin/CC)
_SUNPRO_CXX=	${_SUNPRO_DIR}/bin/CC
_SUNPRO_LINKS+=	_SUNPRO_CXX
PKG_CXX=	${_SUNPRO_CXX}
CXX=		${PKG_CXX:T}
CXXPATH=	${SUNWSPROBASE}/bin/CC
.endif

# SunPro passes rpath directives to the linker using "-R".
_LINKER_RPATH_FLAG=	-R

# SunPro passes rpath directives to the linker using "-R".
_COMPILER_RPATH_FLAG=	-R

# SunPro compiler must be passed certain flags to compile/link 64-bit code.
_COMPILER_ABI_FLAG.64=	-xtarget=ultra -xarch=v9

.if exists(${SUNWSPROBASE}/bin/cc)
CC_VERSION_STRING!=	${SUNWSPROBASE}/bin/cc -V 2>&1 || ${TRUE}
CC_VERSION!=		${SUNWSPROBASE}/bin/cc -V 2>&1 | ${GREP} '^cc'
.else
CC_VERSION_STRING?=	${CC_VERSION}
CC_VERSION?=		cc: Sun C
.endif

# Prepend the path to the compiler to the PATH.
.if !empty(_LANGUAGES.sunpro)
PREPEND_PATH+=	${_SUNPRO_DIR}/bin
.endif

# Create compiler driver scripts in ${WRKDIR}.
.for _target_ in ${_SUNPRO_LINKS}
.  if !target(${${_target_}})
override-tools: ${${_target_}}        
${${_target_}}:
	${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
	${_PKG_SILENT}${_PKG_DEBUG}					\
	(${ECHO} '#!${TOOLS_SHELL}';					\
	 ${ECHO} 'exec ${SUNWSPROBASE}/bin/${${_target_}:T} "$$@"';	\
	) > ${.TARGET}
	${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
.  endif
.endfor

.endif	# COMPILER_SUNPRO_MK