summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam>2004-11-30 14:50:37 +0000
committerjlam <jlam>2004-11-30 14:50:37 +0000
commite0816cd38aa2ae18161632428746d5be7aaa3a3f (patch)
treefe0208b86b0f4fd875482f1d22c775959c8becd5 /mk
parent7c1706f998521d0013716738556e9998544afcfa (diff)
downloadpkgsrc-e0816cd38aa2ae18161632428746d5be7aaa3a3f.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')
-rw-r--r--mk/buildlink3/bsd.buildlink3.mk6
-rw-r--r--mk/compiler.mk18
-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
-rw-r--r--mk/wrapper/bsd.wrapper.mk90
10 files changed, 228 insertions, 148 deletions
diff --git a/mk/buildlink3/bsd.buildlink3.mk b/mk/buildlink3/bsd.buildlink3.mk
index b629bc7ac7b..34d7ac51da5 100644
--- a/mk/buildlink3/bsd.buildlink3.mk
+++ b/mk/buildlink3/bsd.buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.164 2004/11/28 19:19:52 jlam Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.165 2004/11/30 14:50:37 jlam Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -990,8 +990,8 @@ WRAPPER_TRANSFORM_CMDS+= ${_BLNK_TRANSFORM}
# building software.
#
.if defined(USE_LIBTOOL)
-_WRAPPEES+= LIBTOOL
-_WRAPPEES+= SHLIBTOOL
+WRAPPEES+= LIBTOOL
+WRAPPEES+= SHLIBTOOL
_LIBTOOL= ${WRAPPER_LIBTOOL}
_SHLIBTOOL= ${WRAPPER_SHLIBTOOL}
.endif
diff --git a/mk/compiler.mk b/mk/compiler.mk
index e71cebda1da..8d52e1a9a52 100644
--- a/mk/compiler.mk
+++ b/mk/compiler.mk
@@ -1,4 +1,4 @@
-# $NetBSD: compiler.mk,v 1.39 2004/11/28 21:32:47 jlam Exp $
+# $NetBSD: compiler.mk,v 1.40 2004/11/30 14:50:37 jlam Exp $
#
# This Makefile fragment implements handling for supported C/C++/Fortran
# compilers.
@@ -117,17 +117,19 @@ _PKGSRC_COMPILER:= ${_compiler_} ${_PKGSRC_COMPILER}
.endfor
_PKGSRC_COMPILER:= ${_COMPILER} ${_PKGSRC_COMPILER}
-# Set initial values for PKG_{CC,CPP,CXX,FC} which are used within the
-# ${compiler}.mk files to discover the short names of the compilers.
-#
-PKG_CC:= ${CC}
-PKG_CPP:= ${CPP}
-PKG_CXX:= ${CXX}
-PKG_FC:= ${FC}
+_COMPILER_STRIP_VARS= # empty
.for _compiler_ in ${_PKGSRC_COMPILER}
. include "../../mk/compiler/${_compiler_}.mk"
.endfor
+.undef _compiler_
+
+# Strip the leading paths from the toolchain variables since we manipulate
+# the PATH to use the correct executable.
+#
+.for _var_ in ${_COMPILER_STRIP_VARS}
+${_var_}:= ${${_var_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//:T} ${${_var_}:C/^/_asdf_/1:N_asdf_*}
+.endfor
.if defined(ABI) && !empty(ABI)
_WRAP_EXTRA_ARGS.CC+= ${_COMPILER_ABI_FLAG.${ABI}}
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
diff --git a/mk/wrapper/bsd.wrapper.mk b/mk/wrapper/bsd.wrapper.mk
index 8020eda8b29..8a9c9918039 100644
--- a/mk/wrapper/bsd.wrapper.mk
+++ b/mk/wrapper/bsd.wrapper.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.wrapper.mk,v 1.12 2004/11/20 04:37:08 grant Exp $
+# $NetBSD: bsd.wrapper.mk,v 1.13 2004/11/30 14:50:37 jlam Exp $
#
# Copyright (c) 2004 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -130,11 +130,7 @@ WRAPPER_VARS+= _WRAP_PATH
#
WRAPPEES+= AS
WRAPPEES+= CC
-# XXX The following is a workaround until I can find time to fix this
-# XXX more completely (jlam).
-.if ${CPP:N-*} != ${CC}
WRAPPEES+= CPP
-.endif
WRAPPEES+= CXX
WRAPPEES+= FC
.if defined(USE_X11)
@@ -143,9 +139,28 @@ WRAPPEES+= IMAKE
.endif
WRAPPEES+= LD
+_WRAPPEE_UNIQUE_CMDS= # empty
.for _wrappee_ in ${WRAPPEES}
-_WRAPPEES+= ${_wrappee_}
-.endfor
+_WRAPPEES+= ${_wrappee_}
+_WRAPPEE_${_wrappee_}= ${${_wrappee_}:T:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
+. if empty(_WRAPPEE_UNIQUE_CMDS:M${_WRAPPEE_${_wrappee_}})
+_WRAPPEE_UNIQUE_CMDS+= ${_WRAPPEE_${_wrappee_}}
+_WRAPPEES_UNIQUE+= ${_wrappee_}
+. endif
+.endfor # WRAPPEES
+
+.for _wrappee_ in ${_WRAPPEES}
+#
+# Strip the leading paths from the toolchain variables since we manipulate
+# the PATH to use the correct executable.
+#
+${_wrappee_}:= ${${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//:T} ${${_wrappee_}:C/^/_asdf_/1:N_asdf_*}
+#
+# WRAPPER_<wrappee> is the full path to the wrapper script, plus any
+# trailing arguments to <wrappee>.
+#
+WRAPPER_${_wrappee_}= ${WRAPPER_BINDIR}/${${_wrappee_}}
+.endfor # _WRAPPEES
_WRAP_ALIASES.AS= as
_WRAP_ALIASES.CC= cc gcc
@@ -211,7 +226,7 @@ _WRAP_SKIP_TRANSFORM.${_wrappee_}?= no
. else
_WRAP_SKIP_TRANSFORM.${_wrappee_}?= ${_WRAP_SKIP_TRANSFORM}
. endif
-.endfor
+.endfor # _WRAPPEES
.if !empty(PKGSRC_COMPILER:Maix-xlc)
_WRAP_CMD_SINK.CC= ${WRAPPER_TMPDIR}/cmd-sink-aix-xlc
@@ -294,16 +309,6 @@ _WRAP_SUBST_SED= \
-e "s|@_WRAP_SHELL_LIB@|${_WRAP_SHELL_LIB:Q}|g"
.for _wrappee_ in ${_WRAPPEES}
-. if defined(PKG_${_wrappee_})
-_WRAP_PKG_${_wrappee_}= ${PKG_${_wrappee_}}
-. else
-_WRAP_PKG_${_wrappee_}= ${${_wrappee_}}
-. endif
-
-WRAPPER_${_wrappee_}= \
- ${WRAPPER_BINDIR}/${_WRAP_PKG_${_wrappee_}:T:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
-${_wrappee_}:= ${WRAPPER_${_wrappee_}:T}
-
_WRAP_SUBST_SED.${_wrappee_}= \
-e "s|@_WRAP_ENV@|${_WRAP_ENV.${_wrappee_}:Q}|g" \
-e "s|@_WRAP_EXTRA_ARGS@|${_WRAP_EXTRA_ARGS.${_wrappee_}:Q}|g" \
@@ -326,7 +331,10 @@ _WRAP_SUBST_SED.${_wrappee_}= \
${_WRAP_SUBST_SED}
_WRAP_COOKIE.${_wrappee_}= ${WRAPPER_DIR}/.wrapper_${_wrappee_}_done
+.endfor # _WRAPPEES
+.for _wrappee_ in ${_WRAPPEES_UNIQUE}
+PKG_${_wrappee_}?= ${${_wrappee_}}
do-wrapper: ${_WRAP_COOKIE.${_wrappee_}}
${_WRAP_COOKIE.${_wrappee_}}: \
${_WRAPPER_SH.${_wrappee_}} \
@@ -340,49 +348,44 @@ ${_WRAP_COOKIE.${_wrappee_}}: \
${_WRAP_SCAN.${_wrappee_}} \
${_WRAP_SHELL_LIB} \
${_WRAP_TRANSFORM.${_wrappee_}}
- ${_PKG_SILENT}${_PKG_DEBUG}${ECHO_WRAPPER_MSG} \
- "=> Creating wrapper: ${WRAPPER_${_wrappee_}}"
${_PKG_SILENT}${_PKG_DEBUG} \
- wrappee="${_WRAP_PKG_${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \
+ wrapper="${WRAPPER_${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \
+ ${ECHO_WRAPPER_MSG} "=> Creating ${_wrappee_} wrapper: $$wrapper"; \
gen_wrapper=yes; \
- case $${wrappee} in \
- /*) \
- absdir=; \
- ;; \
- *) \
- save_IFS="$$IFS"; \
+ wrappee="${PKG_${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \
+ case $$wrappee in \
+ /*) ;; \
+ *) save_IFS="$$IFS"; \
IFS=":"; \
for dir in $${PATH}; do \
case $${dir} in \
- *${BUILDLINK_DIR}*) \
+ *${WRAPPER_DIR}*) \
;; \
*) \
- if [ -f $${dir}/$${wrappee} ] || \
- [ -h $${dir}/$${wrappee} ] && \
- [ -x $${dir}/$${wrappee} ]; then \
- absdir=$${dir}/; \
- wrappee=$${absdir}$${wrappee}; \
+ if ${TEST} -f $${dir}/$$wrappee -o \
+ -h $${dir}/$$wrappee; then \
+ wrappee=$${dir}/$$wrappee; \
break; \
fi; \
;; \
esac; \
done; \
IFS="$$save_IFS"; \
- if [ ! -x "$${wrappee}" ]; then \
+ if ${TEST} ! -x "$$wrappee"; then \
gen_wrapper=no; \
- ${ECHO_WRAPPER_MSG} "Warning: unable to create \`$${wrappee}' wrapper script"; \
+ ${ECHO_WRAPPER_MSG} "Warning: unable to create ${_wrappee_} wrapper script: \`$$wrappee'"; \
fi; \
;; \
esac; \
case $$gen_wrapper in \
yes) \
- ${MKDIR} ${WRAPPER_${_wrappee_}:H}; \
+ ${MKDIR} `${DIRNAME} $$wrapper`; \
${CAT} ${_WRAPPER_SH.${_wrappee_}} | \
${SED} ${_WRAP_SUBST_SED.${_wrappee_}} \
- -e "s|@WRAPPEE@|$${absdir}${_WRAP_PKG_${_wrappee_}:Q}|g" | \
+ -e "s|@WRAPPEE@|$$wrappee|g" | \
${_WRAP_SH_CRUNCH_FILTER} \
- > ${WRAPPER_${_wrappee_}}; \
- ${CHMOD} +x ${WRAPPER_${_wrappee_}}; \
+ > $$wrapper; \
+ ${CHMOD} +x $$wrapper; \
;; \
esac
${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
@@ -392,13 +395,14 @@ ${_WRAP_COOKIE.${_wrappee_}}: \
do-wrapper: ${_alias_}
${_alias_}: ${_WRAP_COOKIE.${_wrappee_}}
${_PKG_SILENT}${_PKG_DEBUG} \
- if [ ! -x ${_alias_} -a -x ${WRAPPER_${_wrappee_}} ]; then \
- ${ECHO_WRAPPER_MSG} "=> Linking wrapper: ${_alias_}"; \
- ${LN} -f ${WRAPPER_${_wrappee_}} ${_alias_}; \
+ wrapper="${WRAPPER_${_wrappee_}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"; \
+ if [ ! -x ${.TARGET} -a -x $$wrapper ]; then \
+ ${ECHO_WRAPPER_MSG} "=> Linking ${_wrappee_} wrapper: ${.TARGET}"; \
+ ${LN} -f $$wrapper ${.TARGET}; \
fi
. endif
. endfor
-.endfor # _WRAPPEES
+.endfor # _WRAPPEES_UNIQUE
.for _target_ in ${WRAPPER_TARGETS}
do-wrapper: ${_target_}