pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Modify the way that the toolchain variables, e.g. C...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/187a1414c135
branches:  trunk
changeset: 484854:187a1414c135
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Nov 30 14:50:37 2004 +0000

description:
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:

 mk/buildlink3/bsd.buildlink3.mk |   6 +-
 mk/compiler.mk                  |  18 ++++---
 mk/compiler/ccache.mk           |  28 ++++++++----
 mk/compiler/ccc.mk              |  40 +++++++++++------
 mk/compiler/distcc.mk           |  28 ++++++++----
 mk/compiler/gcc.mk              |  49 ++++++++++++---------
 mk/compiler/mipspro.mk          |  39 +++++++++++-----
 mk/compiler/sunpro.mk           |  39 +++++++++++-----
 mk/compiler/xlc.mk              |  39 +++++++++++-----
 mk/wrapper/bsd.wrapper.mk       |  90 +++++++++++++++++++++-------------------
 10 files changed, 228 insertions(+), 148 deletions(-)

diffs (truncated from 737 to 300 lines):

diff -r 817342b6590a -r 187a1414c135 mk/buildlink3/bsd.buildlink3.mk
--- a/mk/buildlink3/bsd.buildlink3.mk   Tue Nov 30 14:41:19 2004 +0000
+++ b/mk/buildlink3/bsd.buildlink3.mk   Tue Nov 30 14:50:37 2004 +0000
@@ -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 @@
 # building software.
 #
 .if defined(USE_LIBTOOL)
-_WRAPPEES+=            LIBTOOL
-_WRAPPEES+=            SHLIBTOOL
+WRAPPEES+=             LIBTOOL
+WRAPPEES+=             SHLIBTOOL
 _LIBTOOL=              ${WRAPPER_LIBTOOL}
 _SHLIBTOOL=            ${WRAPPER_SHLIBTOOL}
 .endif
diff -r 817342b6590a -r 187a1414c135 mk/compiler.mk
--- a/mk/compiler.mk    Tue Nov 30 14:41:19 2004 +0000
+++ b/mk/compiler.mk    Tue Nov 30 14:50:37 2004 +0000
@@ -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 @@
 .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 -r 817342b6590a -r 187a1414c135 mk/compiler/ccache.mk
--- a/mk/compiler/ccache.mk     Tue Nov 30 14:41:19 2004 +0000
+++ b/mk/compiler/ccache.mk     Tue Nov 30 14:50:37 2004 +0000
@@ -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?=          ${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 @@
 .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 -r 817342b6590a -r 187a1414c135 mk/compiler/ccc.mk
--- a/mk/compiler/ccc.mk        Tue Nov 30 14:41:19 2004 +0000
+++ b/mk/compiler/ccc.mk        Tue Nov 30 14:50:37 2004 +0000
@@ -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 @@
 .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 @@
 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 -r 817342b6590a -r 187a1414c135 mk/compiler/distcc.mk
--- a/mk/compiler/distcc.mk     Tue Nov 30 14:41:19 2004 +0000
+++ b/mk/compiler/distcc.mk     Tue Nov 30 14:50:37 2004 +0000
@@ -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?=          ${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 @@
 .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 -r 817342b6590a -r 187a1414c135 mk/compiler/gcc.mk
--- a/mk/compiler/gcc.mk        Tue Nov 30 14:41:19 2004 +0000
+++ b/mk/compiler/gcc.mk        Tue Nov 30 14:50:37 2004 +0000
@@ -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 @@
 # 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=    ${_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



Home | Main Index | Thread Index | Old Index