summaryrefslogtreecommitdiff
path: root/mk/compiler
diff options
context:
space:
mode:
authorgrant <grant@pkgsrc.org>2004-10-06 09:49:53 +0000
committergrant <grant@pkgsrc.org>2004-10-06 09:49:53 +0000
commitb761a1f88584a309b34d5a8e2efe03b2dadadc83 (patch)
tree4b26f3cb130461689143842f824311bc77841416 /mk/compiler
parente06560d0bf43daa613d7b6c6a4765231f8dad634 (diff)
downloadpkgsrc-b761a1f88584a309b34d5a8e2efe03b2dadadc83.tar.gz
add initial support for IBM's XL C/C++ compiler. tested with version
6.0 on Mac OS X 10.3.5. to use XL C, set PKGSRC_COMPILER=xlc in mk.conf. XLCBASE defaults to /opt/ibmcmp/vacpp/6.0 (the default installation location on OS X), this can be overridden in mk.conf too. this is a work in progress - some simple packages can be built, but there are still lots of issues that need to be worked through.
Diffstat (limited to 'mk/compiler')
-rw-r--r--mk/compiler/xlc.mk62
1 files changed, 62 insertions, 0 deletions
diff --git a/mk/compiler/xlc.mk b/mk/compiler/xlc.mk
new file mode 100644
index 00000000000..b4ab75dd3c6
--- /dev/null
+++ b/mk/compiler/xlc.mk
@@ -0,0 +1,62 @@
+# $NetBSD: xlc.mk,v 1.1 2004/10/06 09:49:53 grant Exp $
+
+.if !defined(COMPILER_XLC_MK)
+COMPILER_XLC_MK= defined
+
+.include "../../mk/bsd.prefs.mk"
+
+XLCBASE?= /opt/ibmcmp/vacpp/6.0
+
+# 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.xlc= c c++
+_LANGUAGES.xlc= # empty
+.for _lang_ in ${USE_LANGUAGES}
+_LANGUAGES.xlc+= ${LANGUAGES.xlc:M${_lang_}}
+.endfor
+
+_XLC_DIR= ${WRKDIR}/.xlc
+_XLC_LINKS= # empty
+.if exists(${XLCBASE}/bin/cc)
+_XLC_CC= ${_XLC_DIR}/bin/cc
+_XLC_LINKS+= _XLC_CC
+PKG_CC= ${_XLC_CC}
+CC= ${PKG_CC:T}
+.endif
+.if exists(${XLCBASE}/bin/xlc++)
+_XLC_CXX= ${_XLC_DIR}/bin/xlc++
+_XLC_LINKS+= _XLC_CXX
+PKG_CXX= ${_XLC_CXX}
+CXX= ${PKG_CXX:T}
+.endif
+
+.if exists(${XLCBASE}/bin/cc)
+CC_VERSION_STRING!= ${XLCBASE}/bin/cc -V 2>&1 | ${GREP} 'IBM XL C.*for' | ${SED} -e 's/^ *//' || ${TRUE}
+CC_VERSION= ${CC_VERSION_STRING}
+.else
+CC_VERSION_STRING?= ${CC_VERSION}
+CC_VERSION?= IBM XL C
+.endif
+
+# Prepend the path to the compiler to the PATH.
+.if !empty(_LANGUAGES.xlc)
+PREPEND_PATH+= ${_XLC_DIR}/bin
+.endif
+
+# Create compiler driver scripts in ${WRKDIR}.
+.for _target_ in ${_XLC_LINKS}
+. if !target(${${_target_}})
+override-tools: ${${_target_}}
+${${_target_}}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ (${ECHO} '#!${TOOLS_SHELL}'; \
+ ${ECHO} 'exec ${XLCBASE}/bin/${${_target_}:T} "$$@"'; \
+ ) > ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+. endif
+.endfor
+
+.endif # COMPILER_XLC_MK