diff options
-rw-r--r-- | mk/compiler.mk | 5 | ||||
-rw-r--r-- | mk/compiler/xlc.mk | 62 | ||||
-rw-r--r-- | mk/defs.Darwin.mk | 4 | ||||
-rw-r--r-- | mk/wrapper/bsd.wrapper.mk | 16 | ||||
-rw-r--r-- | mk/wrapper/transform-xlc-cc | 60 |
5 files changed, 143 insertions, 4 deletions
diff --git a/mk/compiler.mk b/mk/compiler.mk index 58708537b3b..cb147f8e914 100644 --- a/mk/compiler.mk +++ b/mk/compiler.mk @@ -1,4 +1,4 @@ -# $NetBSD: compiler.mk,v 1.35 2004/09/21 15:01:39 jlam Exp $ +# $NetBSD: compiler.mk,v 1.36 2004/10/06 09:49:53 grant Exp $ # # This Makefile fragment implements handling for supported C/C++/Fortran # compilers. @@ -17,6 +17,7 @@ # mipspro-ucode Silicon Graphics, Inc. MIPSpro (o32) # sunpro Sun Microsystems, Inc. WorkShip/Forte/Sun # ONE Studio +# xlc IBM's XL C/C++ compiler suite # # The default is "gcc". You can use ccache and/or distcc with an # appropriate PKGSRC_COMPILER setting, e.g. "ccache distcc gcc". @@ -88,7 +89,7 @@ PKGSRC_COMPILER?= gcc _USE_PKGSRC_GCC= yes .endif -_COMPILERS= gcc mipspro mipspro-ucode sunpro +_COMPILERS= gcc mipspro mipspro-ucode sunpro xlc _PSEUDO_COMPILERS= ccache distcc .if defined(NOT_FOR_COMPILER) && !empty(NOT_FOR_COMPILER) 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 diff --git a/mk/defs.Darwin.mk b/mk/defs.Darwin.mk index ad603f0acf8..4d55b38558e 100644 --- a/mk/defs.Darwin.mk +++ b/mk/defs.Darwin.mk @@ -1,4 +1,4 @@ -# $NetBSD: defs.Darwin.mk,v 1.81 2004/10/03 00:13:01 tv Exp $ +# $NetBSD: defs.Darwin.mk,v 1.82 2004/10/06 09:49:53 grant Exp $ # # Variable definitions for the Darwin operating system. @@ -84,7 +84,9 @@ TYPE?= type # Shell builtin WC?= /usr/bin/wc XARGS?= /usr/bin/xargs +.if !defined(PKGSRC_COMPILER) || !empty(PKGSRC_COMPILER:Mgcc) CPP_PRECOMP_FLAGS?= -no-cpp-precomp # use the GNU cpp, not the OS X cpp +.endif DEF_UMASK?= 0022 DEFAULT_SERIAL_DEVICE?= /dev/null EXPORT_SYMBOLS_LDFLAGS?= # Don't add symbols to the dynamic symbol table diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk index c7a7fa02ae0..c2bb31e986e 100644 --- a/mk/wrapper/bsd.wrapper.mk +++ b/mk/wrapper/bsd.wrapper.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.wrapper.mk,v 1.6 2004/10/04 20:28:30 jlam Exp $ +# $NetBSD: bsd.wrapper.mk,v 1.7 2004/10/06 09:49:53 grant Exp $ # # Copyright (c) 2004 The NetBSD Foundation, Inc. # All rights reserved. @@ -240,6 +240,13 @@ _WRAP_CACHE_BODY.CXX= ${_WRAP_CACHE_BODY.CC} _WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC} .endif +.if !empty(PKGSRC_COMPILER:Mxlc) +_WRAP_CACHE_BODY.CC= ${WRAPPER_TMPDIR}/cache-body-xlc-cc +_WRAP_TRANSFORM.CC= ${WRAPPER_TMPDIR}/transform-xlc-cc +_WRAP_CACHE_BODY.CXX= ${_WRAP_CACHE_BODY.CC} +_WRAP_TRANSFORM.CXX= ${_WRAP_TRANSFORM.CC} +.endif + _WRAP_CMD_SINK.LD= ${WRAPPER_TMPDIR}/cmd-sink-ld _WRAP_TRANSFORM_SED.IMAKE= # empty @@ -423,6 +430,13 @@ ${WRAPPER_TMPDIR}/transform-sunpro-cc: \ ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} +${WRAPPER_TMPDIR}/transform-xlc-cc: \ + ${WRAPPER_SRCDIR}/transform-xlc-cc + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC} \ + | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET} + + .if !target(${_WRAP_GEN_REORDER}) ${_WRAP_GEN_REORDER}: \ ${_WRAP_SHELL_LIB} \ diff --git a/mk/wrapper/transform-xlc-cc b/mk/wrapper/transform-xlc-cc new file mode 100644 index 00000000000..6643a780c32 --- /dev/null +++ b/mk/wrapper/transform-xlc-cc @@ -0,0 +1,60 @@ +# $NetBSD: transform-xlc-cc,v 1.1 2004/10/06 09:49:53 grant Exp $ +# +# Copyright (c) 2004 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Johnny C. Lam. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the NetBSD +# Foundation, Inc. and its contributors. +# 4. Neither the name of The NetBSD Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +case $arg in +###################################################################### +# Leave -Wl,-R unchanged. +###################################################################### +-Wl,-R*) + ;; +###################################################################### +# XL C doens't understand many -W* arguments, so just silently ignore +# them all. +###################################################################### +-W*) + arg= + msg_log $wrapperlog " (transform-xlc-cc) to: $arg" + addtocache=yes + ;; +###################################################################### +# Ignore some flags that are unnecessary for XL C. +###################################################################### +-pipe|-ansi|-fno-common|-fno-gnu-keywords|-fstrict-prototypes|-no-cpp-precomp|-pedantic) + arg= + msg_log $wrapperlog " (transform-xlc-cc) to: $arg" + addtocache=yes + ;; +esac |