From d49b3add397147f414f19a2cb4324df2b52d9755 Mon Sep 17 00:00:00 2001 From: jlam Date: Tue, 30 Nov 2004 14:50:37 +0000 Subject: 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. --- mk/compiler/gcc.mk | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'mk/compiler/gcc.mk') 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 -- cgit v1.2.3