summaryrefslogtreecommitdiff
path: root/mk/compiler/xlc.mk
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/xlc.mk
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/xlc.mk')
-rw-r--r--mk/compiler/xlc.mk39
1 files changed, 26 insertions, 13 deletions
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