summaryrefslogtreecommitdiff
path: root/mk/compiler
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-11-30 14:50:37 +0000
committerjlam <jlam@pkgsrc.org>2004-11-30 14:50:37 +0000
commiteb9034727a3c852536168fbc70313810d2e699b8 (patch)
treefe0208b86b0f4fd875482f1d22c775959c8becd5 /mk/compiler
parent96abea24a92e1217158cec37e0984afa162a0dba (diff)
downloadpkgsrc-eb9034727a3c852536168fbc70313810d2e699b8.tar.gz
Modify the way that the toolchain variables, e.g. CC, CPP, CXX, LD, etc.,
are handled. The idea now is to simply remove the paths in the values of these variables, leaving behind only the basename plus any arguments, e.g.: CC= /usr/local/bin/gcc becomes CC= gcc CPP= /usr/local/bin/gcc -E becomes CPP= gcc -E The wrapper scripts are generated for every unique executable mentioned by the toolchain variables, so for the example above, only a "gcc" wrapper script is generated for ${CC} and ${CPP}. PKG_{CC,CPP,CXX,etc.} are the paths to the executables wrapped by the wrapper scripts. Note that it's now possible to set "CC" to something more than just the path to the compiler, e.g. CC= cc -ffast-math -funroll-loops -fomit-frame-pointer and the full value of ${CC} will be passed through via CONFIGURE_ENV and MAKE_ENV.
Diffstat (limited to 'mk/compiler')
-rw-r--r--mk/compiler/ccache.mk28
-rw-r--r--mk/compiler/ccc.mk40
-rw-r--r--mk/compiler/distcc.mk28
-rw-r--r--mk/compiler/gcc.mk49
-rw-r--r--mk/compiler/mipspro.mk39
-rw-r--r--mk/compiler/sunpro.mk39
-rw-r--r--mk/compiler/xlc.mk39
7 files changed, 168 insertions, 94 deletions
diff --git a/mk/compiler/ccache.mk b/mk/compiler/ccache.mk
index 1fac6383bef..755fc213616 100644
--- a/mk/compiler/ccache.mk
+++ b/mk/compiler/ccache.mk
@@ -1,4 +1,4 @@
-# $NetBSD: ccache.mk,v 1.20 2004/11/17 17:18:33 tv Exp $
+# $NetBSD: ccache.mk,v 1.21 2004/11/30 14:50:37 jlam Exp $
.if !defined(COMPILER_CCACHE_MK)
COMPILER_CCACHE_MK= defined
@@ -37,18 +37,20 @@ _CCACHEBASE_DEFAULT= ${LOCALBASE}
_CCACHEBASE?= ${LOCALBASE}
_CCACHE_DIR= ${WRKDIR}/.ccache
-_CCACHE_LINKS= # empty
+_CCACHE_VARS= # empty
. if !empty(_LANGUAGES.ccache:Mc)
+PKG_CC?= ${CC}
+_CCACHE_VARS+= CC
_CCACHE_CC:= ${_CCACHE_DIR}/bin/${PKG_CC:T}
-_CCACHE_LINKS+= _CCACHE_CC
+_ALIASES.CC?= cc
PKG_CC:= ${_CCACHE_CC}
-CC= ${PKG_CC:T}
. endif
. if !empty(_LANGUAGES.ccache:Mc++)
+PKG_CXX?= ${CXX}
+_CCACHE_VARS+= CXX
_CCACHE_CXX:= ${_CCACHE_DIR}/bin/${PKG_CXX:T}
-_CCACHE_LINKS+= _CCACHE_CXX
+_ALIASES.CXX?= c++
PKG_CXX:= ${_CCACHE_CXX}
-CXX= ${PKG_CXX:T}
. endif
# Prepend the path the to the compiler to the PATH
@@ -69,13 +71,19 @@ BUILD_ENV+= CCACHE_DIR=${CCACHE_DIR:Q}
.endif
# Create symlinks for the compiler into ${WRKDIR}.
-. for _target_ in ${_CCACHE_LINKS}
-. if !target(${${_target_}})
-override-tools: ${${_target_}}
-${${_target_}}:
+. for _var_ in ${_CCACHE_VARS}
+. if !target(${_CCACHE_${_var_}})
+override-tools: ${_CCACHE_${_var_}}
+${_CCACHE_${_var_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
${LN} -fs ${_CCACHEBASE}/bin/ccache ${.TARGET}
+. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -x "${_alias_}" ]; then \
+ ${LN} -fs ${_CCACHEBASE}/bin/ccache ${_alias_}; \
+ fi
+. endfor
. endif
. endfor
.endif # _USE_CCACHE == "yes"
diff --git a/mk/compiler/ccc.mk b/mk/compiler/ccc.mk
index 388c1005f6f..395e74f9cec 100644
--- a/mk/compiler/ccc.mk
+++ b/mk/compiler/ccc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: ccc.mk,v 1.5 2004/11/23 05:32:22 jlam Exp $
+# $NetBSD: ccc.mk,v 1.6 2004/11/30 14:50:37 jlam Exp $
.if !defined(COMPILER_CCC_MK)
COMPILER_CCC_MK= defined
@@ -20,22 +20,28 @@ _LANGUAGES.ccc+= ${LANGUAGES.ccc:M${_lang_}}
.endfor
_CCC_DIR= ${WRKDIR}/.ccc
-_CCC_LINKS= # empty
+_CCC_VARS= # empty
.if exists(/usr/bin/cc)
+_CCC_VARS+= CC
_CCC_CC= ${_CCC_DIR}/cc
-_CCC_LINKS+= _CCC_CC
-PKG_CC= ${_CCC_CC}
-CC= ${PKG_CC:T}
+_ALIASES.CC= cc
CCPATH= /usr/bin/cc
+PKG_CC:= ${_CCC_CC}
+. if !empty(CC:M*gcc)
+CC:= ${PKG_CC:T} # ${CC} should be named "cc".
+. endif
.endif
-
.if exists(/usr/bin/cxx)
+_CCC_VARS+= CXX
_CCC_CXX= ${_CCC_DIR}/cxx
-_CCC_LINKS+= _CCC_CXX
-PKG_CXX= ${_CCC_CXX}
-CXX= ${PKG_CXX:T}
+_ALIASES.CXX= c++ cxx
CXXPATH= /usr/bin/cxx
+PKG_CXX:= ${_CCC_CXX}
+. if !empty(CXX:M*g++)
+CXX:= ${PKG_CXX:T} # ${CXX} should be named "cxx"
+. endif
.endif
+_COMPILER_STRIP_VARS+= ${_CCC_VARS}
.if exists(${CCPATH}) && !defined(CC_VERSION_STRING)
CC_VERSION_STRING!= ${CCPATH} -V 2>&1 | awk '{print; exit(0);}'
@@ -59,16 +65,22 @@ CFLAGS+=-ieee
CXXFLAGS+=-ieee
# Create compiler driver scripts in ${WRKDIR}.
-.for _target_ in ${_CCC_LINKS}
-. if !target(${${_target_}})
-override-tools: ${${_target_}}
-${${_target_}}:
+.for _var_ in ${_CCC_VARS}
+. if !target(${_CCC_${_var_}})
+override-tools: ${_CCC_${_var_}}
+${_CCC_${_var_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
(${ECHO} '#!${TOOLS_SHELL}'; \
- ${ECHO} 'exec /usr/bin/${${_target_}:T} "$$@"'; \
+ ${ECHO} 'exec /usr/bin/${.TARGET:T} "$$@"'; \
) > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -x "${_alias_}" ]; then \
+ ${LN} -f ${.TARGET} ${_alias_}; \
+ fi
+. endfor
. endif
.endfor
diff --git a/mk/compiler/distcc.mk b/mk/compiler/distcc.mk
index 00e7c34e71a..538bbf7b8e9 100644
--- a/mk/compiler/distcc.mk
+++ b/mk/compiler/distcc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: distcc.mk,v 1.21 2004/11/17 17:18:33 tv Exp $
+# $NetBSD: distcc.mk,v 1.22 2004/11/30 14:50:37 jlam Exp $
.if !defined(COMPILER_DISTCC_MK)
COMPILER_DISTCC_MK= defined
@@ -37,18 +37,20 @@ _DISTCCBASE_DEFAULT= ${LOCALBASE}
_DISTCCBASE?= ${LOCALBASE}
_DISTCC_DIR= ${WRKDIR}/.distcc
-_DISTCC_LINKS= # empty
+_DISTCC_VARS= # empty
. if !empty(_LANGUAGES.distcc:Mc)
+PKG_CC?= ${CC}
+_DISTCC_VARS+= CC
_DISTCC_CC:= ${_DISTCC_DIR}/bin/${PKG_CC:T}
-_DISTCC_LINKS+= _DISTCC_CC
+_ALIASES.CC?= cc
PKG_CC:= ${_DISTCC_CC}
-CC= ${PKG_CC:T}
. endif
. if !empty(_LANGUAGES.distcc:Mc++)
+PKG_CXX?= ${CXX}
+_DISTCC_VARS+= CXX
_DISTCC_CXX:= ${_DISTCC_DIR}/bin/${PKG_CXX:T}
-_DISTCC_LINKS+= _DISTCC_CXX
+_ALIASES.CXX?= c++
PKG_CXX:= ${_DISTCC_CXX}
-CXX= ${PKG_CXX:T}
. endif
# Prepend the path to the compiler to the PATH.
@@ -70,13 +72,19 @@ BUILD_ENV+= DISTCC_VERBOSE=${DISTCC_VERBOSE:Q}
.endif
# Create symlinks for the compiler into ${WRKDIR}.
-. for _target_ in ${_DISTCC_LINKS}
-. if !target(${${_target_}})
-override-tools: ${${_target_}}
-${${_target_}}:
+. for _var_ in ${_DISTCC_VARS}
+. if !target(${_DISTCC_${_var_}})
+override-tools: ${_DISTCC_${_var_}}
+${_DISTCC_${_var_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
${LN} -fs ${_DISTCCBASE}/bin/distcc ${.TARGET}
+. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -x "${_alias_}" ]; then \
+ ${LN} -fs ${_DISTCCBASE}/bin/distcc ${_alias_}; \
+ fi
+. endfor
. endif
. endfor
.endif # _USE_DISTCC == "yes"
diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk
index 0af3292b316..4099063f6bf 100644
--- a/mk/compiler/gcc.mk
+++ b/mk/compiler/gcc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.mk,v 1.76 2004/11/23 05:32:22 jlam Exp $
+# $NetBSD: gcc.mk,v 1.77 2004/11/30 14:50:37 jlam Exp $
.if !defined(COMPILER_GCC_MK)
COMPILER_GCC_MK= defined
@@ -334,7 +334,7 @@ LDFLAGS+= ${_GCC_LDFLAGS}
# GCC executables.
#
_GCC_DIR= ${WRKDIR}/.gcc
-_GCC_LINKS= # empty
+_GCC_VARS= # empty
.if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])
_GCCBINDIR= ${_GCC_PREFIX}bin
@@ -342,34 +342,35 @@ _GCCBINDIR= ${_GCC_PREFIX}bin
_GCCBINDIR= ${_CC:H}
.endif
.if exists(${_GCCBINDIR}/gcc)
+_GCC_VARS+= CC
_GCC_CC= ${_GCC_DIR}/bin/gcc
-_GCC_LINKS+= _GCC_CC
-PKG_CC= ${_GCC_CC}
-CC= ${PKG_CC:T}
+_ALIASES.CC= cc gcc
CCPATH= ${_GCCBINDIR}/gcc
+PKG_CC:= ${_GCC_CC}
.endif
-.if exists(${_GCCBINDIR}/cpp) && ${OPSYS} != "Darwin"
+.if exists(${_GCCBINDIR}/cpp)
+_GCC_VARS+= CPP
_GCC_CPP= ${_GCC_DIR}/bin/cpp
-_GCC_LINKS+= _GCC_CPP
-PKG_CPP= ${_GCC_CPP}
-CPP= ${PKG_CPP:T}
+_ALIASES.CPP= cpp
+CPPPATH= ${_GCCBINDIR}/cpp
+PKG_CPP:= ${_GCC_CPP}
.endif
.if exists(${_GCCBINDIR}/g++)
+_GCC_VARS+= CXX
_GCC_CXX= ${_GCC_DIR}/bin/g++
-_GCC_LINKS+= _GCC_CXX
-PKG_CXX= ${_GCC_CXX}
-CXX= ${PKG_CXX:T}
+_ALIASES.CXX= c++ g++
CXXPATH= ${_GCCBINDIR}/g++
+PKG_CXX:= ${_GCC_CXX}
.endif
.if exists(${_GCCBINDIR}/g77)
+_GCC_VARS+= FC
_GCC_FC= ${_GCC_DIR}/bin/g77
-_GCC_LINKS+= _GCC_FC
-PKG_FC= ${_GCC_FC}
-FC= ${PKG_FC:T}
-F77= ${PKG_FC:T}
+_ALIASES.FC= f77 g77
FCPATH= ${_GCCBINDIR}/g77
F77PATH= ${_GCCBINDIR}/g77
+PKG_FC:= ${_GCC_FC}
.endif
+_COMPILER_STRIP_VARS+= ${_GCC_VARS}
# Pass the required flags to imake to tell it we're using gcc on Solaris.
.if ${OPSYS} == "SunOS"
@@ -416,16 +417,22 @@ BUILD_DEPENDS+= ${_GCC_DEPENDENCY}
.endif
# Create compiler driver scripts in ${WRKDIR}.
-.for _target_ in ${_GCC_LINKS}
-. if !target(${${_target_}})
-override-tools: ${${_target_}}
-${${_target_}}:
+.for _var_ in ${_GCC_VARS}
+. if !target(${_GCC_${_var_}})
+override-tools: ${_GCC_${_var_}}
+${_GCC_${_var_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
(${ECHO} '#!${TOOLS_SHELL}'; \
- ${ECHO} 'exec ${_GCCBINDIR}/${${_target_}:T} "$$@"'; \
+ ${ECHO} 'exec ${_GCCBINDIR}/${.TARGET:T} "$$@"'; \
) > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -x "${_alias_}" ]; then \
+ ${LN} -f ${.TARGET} ${_alias_}; \
+ fi
+. endfor
. endif
.endfor
diff --git a/mk/compiler/mipspro.mk b/mk/compiler/mipspro.mk
index ede75b5c689..694a66c7544 100644
--- a/mk/compiler/mipspro.mk
+++ b/mk/compiler/mipspro.mk
@@ -1,4 +1,4 @@
-# $NetBSD: mipspro.mk,v 1.28 2004/11/23 05:32:22 jlam Exp $
+# $NetBSD: mipspro.mk,v 1.29 2004/11/30 14:50:37 jlam Exp $
.if !defined(COMPILER_MIPSPRO_MK)
COMPILER_MIPSPRO_MK= defined
@@ -18,21 +18,28 @@ _LANGUAGES.mipspro+= ${LANGUAGES.mipspro:M${_lang_}}
.endfor
_MIPSPRO_DIR= ${WRKDIR}/.mipspro
-_MIPSPRO_LINKS= # empty
+_MIPSPRO_VARS= # empty
.if exists(${MIPSPROBASE}/bin/cc)
+_MIPSPRO_VARS+= CC
_MIPSPRO_CC= ${_MIPSPRO_DIR}/bin/cc
-_MIPSPRO_LINKS+= _MIPSPRO_CC
-PKG_CC= ${_MIPSPRO_CC}
-CC= ${PKG_CC:T}
+_ALIASES.CC= cc
CCPATH= ${MIPSPROBASE}/bin/cc
+PKG_CC:= ${_MIPSPRO_CC}
+. if !empty(CC:M*gcc)
+CC:= ${PKG_CC:T} # ${CC} should be named "cc".
+. endif
.endif
.if exists(${MIPSPROBASE}/bin/CC)
+_MIPSPRO_VARS+= CXX
_MIPSPRO_CXX= ${_MIPSPRO_DIR}/bin/CC
-_MIPSPRO_LINKS+= _MIPSPRO_CXX
-PKG_CXX= ${_MIPSPRO_CXX}
-CXX= ${PKG_CXX:T}
+_ALIASES.CXX= CC c++
CXXPATH= ${MIPSPROBASE}/bin/CC
+PKG_CXX:= ${_MIPSPRO_CXX}
+. if !empty(CXX:M*g++)
+CXX:= ${PKG_CXX:T} # ${CXX} should be named "CC"
+. endif
.endif
+_COMPILER_STRIP_VARS+= ${_MIPSPRO_VARS}
.if exists(${CCPATH})
# MIPSpro Compilers: Version 7.3.1.2m
@@ -63,16 +70,22 @@ PREPEND_PATH+= ${_MIPSPRO_DIR}/bin
.endif
# Create compiler driver scripts in ${WRKDIR}.
-.for _target_ in ${_MIPSPRO_LINKS}
-. if !target(${${_target_}})
-override-tools: ${${_target_}}
-${${_target_}}:
+.for _var_ in ${_MIPSPRO_VARS}
+. if !target(${_MIPSPRO_${_var_}})
+override-tools: ${_MIPSPRO_${_var_}}
+${_MIPSPRO_${_var_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
(${ECHO} '#!${TOOLS_SHELL}'; \
- ${ECHO} 'exec ${MIPSPROBASE}/bin/${${_target_}:T} "$$@"'; \
+ ${ECHO} 'exec ${MIPSPROBASE}/bin/${.TARGET:T} "$$@"'; \
) > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -x "${_alias_}" ]; then \
+ ${LN} -f ${.TARGET} ${_alias_}; \
+ fi
+. endfor
. endif
.endfor
diff --git a/mk/compiler/sunpro.mk b/mk/compiler/sunpro.mk
index 79fbb65c42e..85b0a0306d7 100644
--- a/mk/compiler/sunpro.mk
+++ b/mk/compiler/sunpro.mk
@@ -1,4 +1,4 @@
-# $NetBSD: sunpro.mk,v 1.24 2004/11/23 05:32:22 jlam Exp $
+# $NetBSD: sunpro.mk,v 1.25 2004/11/30 14:50:37 jlam Exp $
.if !defined(COMPILER_SUNPRO_MK)
COMPILER_SUNPRO_MK= defined
@@ -18,21 +18,28 @@ _LANGUAGES.sunpro+= ${LANGUAGES.sunpro:M${_lang_}}
.endfor
_SUNPRO_DIR= ${WRKDIR}/.sunpro
-_SUNPRO_LINKS= # empty
+_SUNPRO_VARS= # empty
.if exists(${SUNWSPROBASE}/bin/cc)
+_SUNPRO_VARS+= CC
_SUNPRO_CC= ${_SUNPRO_DIR}/bin/cc
-_SUNPRO_LINKS+= _SUNPRO_CC
-PKG_CC= ${_SUNPRO_CC}
-CC= ${PKG_CC:T}
+_ALIASES.CC= cc
CCPATH= ${SUNWSPROBASE}/bin/cc
+PKG_CC:= ${_SUNPRO_CC}
+. if !empty(CC:M*gcc)
+CC:= ${PKG_CC:T} # ${CC} should be named "cc".
+. endif
.endif
.if exists(${SUNWSPROBASE}/bin/CC)
+_SUNPRO_VARS+= CXX
_SUNPRO_CXX= ${_SUNPRO_DIR}/bin/CC
-_SUNPRO_LINKS+= _SUNPRO_CXX
-PKG_CXX= ${_SUNPRO_CXX}
-CXX= ${PKG_CXX:T}
+_ALIASES.CXX= CC c++
CXXPATH= ${SUNWSPROBASE}/bin/CC
+PKG_CXX:= ${_SUNPRO_CXX}
+. if !empty(CXX:M*g++)
+CXX:= ${PKG_CXX:T} # ${CXX} should be named "CC".
+. endif
.endif
+_COMPILER_STRIP_VARS+= ${_SUNPRO_VARS}
# SunPro passes rpath directives to the linker using "-R".
_LINKER_RPATH_FLAG= -R
@@ -57,16 +64,22 @@ PREPEND_PATH+= ${_SUNPRO_DIR}/bin
.endif
# Create compiler driver scripts in ${WRKDIR}.
-.for _target_ in ${_SUNPRO_LINKS}
-. if !target(${${_target_}})
-override-tools: ${${_target_}}
-${${_target_}}:
+.for _var_ in ${_SUNPRO_VARS}
+. if !target(${_SUNPRO_${_var_}})
+override-tools: ${_SUNPRO_${_var_}}
+${_SUNPRO_${_var_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
(${ECHO} '#!${TOOLS_SHELL}'; \
- ${ECHO} 'exec ${SUNWSPROBASE}/bin/${${_target_}:T} "$$@"'; \
+ ${ECHO} 'exec ${SUNWSPROBASE}/bin/${.TARGET:T} "$$@"'; \
) > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -x "${_alias_}" ]; then \
+ ${LN} -f ${.TARGET} ${_alias_}; \
+ fi
+. endfor
. endif
.endfor
diff --git a/mk/compiler/xlc.mk b/mk/compiler/xlc.mk
index 87b011049c9..f23546f8606 100644
--- a/mk/compiler/xlc.mk
+++ b/mk/compiler/xlc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: xlc.mk,v 1.6 2004/11/27 15:28:34 grant Exp $
+# $NetBSD: xlc.mk,v 1.7 2004/11/30 14:50:37 jlam Exp $
.if !defined(COMPILER_XLC_MK)
COMPILER_XLC_MK= defined
@@ -18,21 +18,28 @@ _LANGUAGES.xlc+= ${LANGUAGES.xlc:M${_lang_}}
.endfor
_XLC_DIR= ${WRKDIR}/.xlc
-_XLC_LINKS= # empty
+_XLC_VARS= # empty
.if exists(${XLCBASE}/bin/xlc)
+_XLC_VARS+= CC
_XLC_CC= ${_XLC_DIR}/bin/xlc
-_XLC_LINKS+= _XLC_CC
-PKG_CC= ${_XLC_CC}
-CC= ${PKG_CC:T}
+_ALIASES.CC= cc xlc
CCPATH= ${XLCBASE}/bin/xlc
+PKG_CC:= ${_XLC_CC}
+. if !empty(CC:M*gcc)
+CC:= ${PKG_CC:T} # ${CC} should be named "xlc".
+. endif
.endif
.if exists(${XLCBASE}/bin/xlc++)
+_XLC_VARS+= CXX
_XLC_CXX= ${_XLC_DIR}/bin/xlc++
-_XLC_LINKS+= _XLC_CXX
-PKG_CXX= ${_XLC_CXX}
-CXX= ${PKG_CXX:T}
+_ALIASES.CXX= c++ xlc++
CXXPATH= ${XLCBASE}/bin/xlc++
+PKG_CXX:= ${_XLC_CXX}
+. if !empty(CXX:M*g++)
+CXX:= ${PKG_CXX:T} # ${CXX} should be named "xlc++".
+. endif
.endif
+_COMPILER_STRIP_VARS+= ${_XLC_VARS}
.if exists(${CCPATH})
CC_VERSION_STRING!= ${CCPATH} -V 2>&1 | ${GREP} 'IBM XL C.*for' | ${SED} -e 's/^ *//' || ${TRUE}
@@ -52,16 +59,22 @@ PREPEND_PATH+= ${_XLC_DIR}/bin
CFLAGS+=-ma
# Create compiler driver scripts in ${WRKDIR}.
-.for _target_ in ${_XLC_LINKS}
-. if !target(${${_target_}})
-override-tools: ${${_target_}}
-${${_target_}}:
+.for _var_ in ${_XLC_VARS}
+. if !target(${_XLC_${_var_}})
+override-tools: ${_XLC_${_var_}}
+${_XLC_${_var_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
(${ECHO} '#!${TOOLS_SHELL}'; \
- ${ECHO} 'exec ${XLCBASE}/bin/${${_target_}:T} "$$@"'; \
+ ${ECHO} 'exec ${XLCBASE}/bin/${.TARGET:T} "$$@"'; \
) > ${.TARGET}
${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+. for _alias_ in ${_ALIASES.${_var_}:S/^/${.TARGET:H}\//}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ if [ ! -x "${_alias_}" ]; then \
+ ${LN} -f ${.TARGET} ${_alias_}; \
+ fi
+. endfor
. endif
.endfor