summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam>2004-02-07 02:58:10 +0000
committerjlam <jlam>2004-02-07 02:58:10 +0000
commit805a899c6a8ef20f3fa78bfab58bbc6d9523accc (patch)
tree829dfc35628809250d2da262cd9d904ead559348 /mk
parenta3cad2e6d8c627a9ca87a46cfc1765f3823c8267 (diff)
downloadpkgsrc-805a899c6a8ef20f3fa78bfab58bbc6d9523accc.tar.gz
Symlink the compiler into ${WRKDIR} so that there's a consistent path to
the compiler and that it's behind .tools/bin and .buildlink/bin, regardless of whether or not we're using gcc3-c or not, or whether it's been installed yet in the process of satisfying dependencies, etc.
Diffstat (limited to 'mk')
-rw-r--r--mk/compiler/ccache.mk17
-rw-r--r--mk/compiler/distcc.mk18
-rw-r--r--mk/compiler/gcc.mk77
-rw-r--r--mk/compiler/mipspro.mk35
-rw-r--r--mk/compiler/sunpro.mk35
5 files changed, 121 insertions, 61 deletions
diff --git a/mk/compiler/ccache.mk b/mk/compiler/ccache.mk
index e636c0b7d6d..b4f94070624 100644
--- a/mk/compiler/ccache.mk
+++ b/mk/compiler/ccache.mk
@@ -1,4 +1,4 @@
-# $NetBSD: ccache.mk,v 1.10 2004/02/06 04:37:02 jlam Exp $
+# $NetBSD: ccache.mk,v 1.11 2004/02/07 02:58:10 jlam Exp $
.if !defined(COMPILER_CCACHE_MK)
COMPILER_CCACHE_MK= one
@@ -38,12 +38,14 @@ _CCACHEBASE?= ${LOCALBASE}
_CCACHE_DIR= ${WRKDIR}/.ccache
_CCACHE_LINKS= # empty
. if !empty(_LANGUAGES.ccache:Mc)
-CC:= ${_CCACHE_DIR}/bin/${CC:T}
-_CCACHE_LINKS+= CC
+_CCACHE_CC:= ${_CCACHE_DIR}/bin/${CC:T}
+_CCACHE_LINKS+= _CCACHE_CC
+CC= ${_CCACHE_CC}
. endif
. if !empty(_LANGUAGES.ccache:Mc++)
-CXX:= ${_CCACHE_DIR}/bin/${CXX:T}
-_CCACHE_LINKS+= CXX
+_CCACHE_CXX:= ${_CCACHE_DIR}/bin/${CXX:T}
+_CCACHE_LINKS+= _CCACHE_CXX
+CXX= ${_CCACHE_CXX}
. endif
. endif
. endif
@@ -56,6 +58,7 @@ _CCACHE_LINKS+= CXX
. if empty(COMPILER_CCACHE_MK:Mtwo)
COMPILER_CCACHE_MK+= two
+# Prepend the path the to the compiler to the PATH
. if !empty(_USE_CCACHE:M[yY][eE][sS])
. if !empty(_LANGUAGES.ccache)
. if empty(PREPEND_PATH:M${_CCACHE_DIR}/bin)
@@ -64,15 +67,19 @@ PATH:= ${_CCACHE_DIR}/bin:${PATH}
. endif
. endif
+# Add the dependency on ccache.
BUILD_DEPENDS+= ccache-[0-9]*:../../devel/ccache
+# Create symlinks for the compiler into ${WRKDIR}.
. if exists(${_CCACHEBASE}/bin/ccache)
. for _target_ in ${_CCACHE_LINKS}
+. if !target(${${_target_}})
override-tools: ${${_target_}}
${${_target_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
${LN} -fs ${_CCACHEBASE}/bin/ccache ${.TARGET}
+. endif
. endfor
. endif
. endif
diff --git a/mk/compiler/distcc.mk b/mk/compiler/distcc.mk
index b256179d4ce..fbac7e071a4 100644
--- a/mk/compiler/distcc.mk
+++ b/mk/compiler/distcc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: distcc.mk,v 1.13 2004/02/06 04:37:02 jlam Exp $
+# $NetBSD: distcc.mk,v 1.14 2004/02/07 02:58:10 jlam Exp $
.if !defined(COMPILER_DISTCC_MK)
COMPILER_DISTCC_MK= one
@@ -38,12 +38,14 @@ _DISTCCBASE?= ${LOCALBASE}
_DISTCC_DIR= ${WRKDIR}/.distcc
_DISTCC_LINKS= # empty
. if !empty(_LANGUAGES.distcc:Mc)
-CC:= ${_DISTCC_DIR}/bin/${CC:T}
-_DISTCC_LINKS+= CC
+_DISTCC_CC:= ${_DISTCC_DIR}/bin/${CC:T}
+_DISTCC_LINKS+= _DISTCC_CC
+CC= ${_DISTCC_CC}
. endif
. if !empty(_LANGUAGES.distcc:Mc++)
-CXX:= ${_DISTCC_DIR}/bin/${CXX:T}
-_DISTCC_LINKS+= CXX
+_DISTCC_CXX:= ${_DISTCC_DIR}/bin/${CXX:T}
+_DISTCC_LINKS+= _DISTCC_CXX
+CXX= ${_DISTCC_CXX}
. endif
. endif
. endif
@@ -56,6 +58,7 @@ _DISTCC_LINKS+= CXX
. if empty(COMPILER_DISTCC_MK:Mtwo)
COMPILER_DISTCC_MK+= two
+# Prepend the path to the compiler to the PATH.
. if !empty(_USE_DISTCC:M[yY][eE][sS])
. if !empty(_LANGUAGES.distcc)
. if empty(PREPEND_PATH:M${_DISTCC_DIR}/bin)
@@ -63,17 +66,20 @@ PREPEND_PATH+= ${_DISTCC_DIR}/bin
PATH:= ${_DISTCC_DIR}/bin:${PATH}
. endif
. endif
-. endif
+# Add the dependency on distcc.
BUILD_DEPENDS+= distcc-[0-9]*:../../devel/distcc
+# Create symlinks for the compiler into ${WRKDIR}.
. if exists(${_DISTCCBASE}/bin/distcc)
. for _target_ in ${_DISTCC_LINKS}
+. if !target(${${_target_}})
override-tools: ${${_target_}}
${${_target_}}:
${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
${_PKG_SILENT}${_PKG_DEBUG} \
${LN} -fs ${_DISTCCBASE}/bin/distcc ${.TARGET}
+. endif
. endfor
. endif
. endif
diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk
index 595bbd6a121..18806733ed7 100644
--- a/mk/compiler/gcc.mk
+++ b/mk/compiler/gcc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.mk,v 1.43 2004/02/06 20:15:49 jlam Exp $
+# $NetBSD: gcc.mk,v 1.44 2004/02/07 02:58:10 jlam Exp $
.if !defined(COMPILER_GCC_MK)
COMPILER_GCC_MK= one
@@ -27,9 +27,7 @@ _CC:= ${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
. endif
. endif
. endfor
-. if !empty(_CC:M/*)
MAKEFLAGS+= _CC=${_CC:Q}
-. endif
. endif
. if !defined(_GCC_VERSION)
@@ -249,20 +247,34 @@ LDFLAGS+= ${_GCC_LDFLAGS}
# Point the variables that specify the compiler to the installed
# GCC executables.
#
+_GCC_DIR= ${WRKDIR}/.gcc
+_GCC_LINKS= # empty
+
. if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])
-. if exists(${_GCC_PREFIX}bin/gcc) && !empty(_LANGUAGES.gcc:Mc)
-CC= ${_GCC_PREFIX}bin/gcc
-. endif
-. if exists(${_GCC_PREFIX}bin/cpp) && !empty(_LANGUAGES.gcc:Mc)
-CPP= ${_GCC_PREFIX}bin/cpp
-. endif
-. if exists(${_GCC_PREFIX}bin/g++) && !empty(_LANGUAGES.gcc:Mc++)
-CXX= ${_GCC_PREFIX}bin/g++
-. endif
-. if exists(${_GCC_PREFIX}bin/g77) && !empty(_LANGUAGES.gcc:Mfortran)
-F77= ${_GCC_PREFIX}bin/g77
+_GCCBINDIR= ${_GCC_PREFIX}bin
+. elif !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
+_GCCBINDIR= ${_CC:H}
+. endif
+. if exists(${_GCCBINDIR}/gcc) && !empty(_LANGUAGES.gcc:Mc)
+_GCC_CC= ${_GCC_DIR}/bin/gcc
+_GCC_LINKS+= _GCC_CC
+CC= ${_GCC_CC}
+. endif
+. if exists(${_GCCBINDIR}/cpp) && !empty(_LANGUAGES.gcc:Mc)
+_GCC_CPP= ${_GCC_DIR}/bin/cpp
+_GCC_LINKS+= _GCC_CPP
+CPP= ${_GCC_CPP}
+. endif
+. if exists(${_GCCBINDIR}/g++) && !empty(_LANGUAGES.gcc:Mc++)
+_GCC_CXX= ${_GCC_DIR}/bin/g++
+_GCC_LINKS+= _GCC_CXX
+CXX= ${_GCC_CXX}
+. endif
+. if exists(${_GCCBINDIR}/g77) && !empty(_LANGUAGES.gcc:Mfortran)
+_GCC_F77= ${_GCC_DIR}/bin/g77
+_GCC_LINKS+= _GCC_F77
+F77= ${_GCC_F77}
PKG_FC:= ${F77}
-. endif
. endif
# GCC passes flags to the linker using "-Wl,".
@@ -274,9 +286,9 @@ IMAKEOPTS+= -DHasGcc2=YES -DHasGcc2ForCplusplus=YES
. endif
. if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])
-. if exists(${CC})
-CC_VERSION!= if ${CC} -dumpversion > /dev/null 2>&1; then \
- ${ECHO} "gcc-`${CC} -dumpversion`"; \
+. if exists(${_GCCBINDIR}/gcc)
+CC_VERSION!= if ${_GCCBINDIR}/gcc -dumpversion > /dev/null 2>&1; then \
+ ${ECHO} "gcc-`${_GCCBINDIR}/gcc -dumpversion`"; \
else \
${ECHO} "gcc-${_GCC_REQD}"; \
fi
@@ -296,20 +308,10 @@ CC_VERSION= ${_GCC_PKG}
COMPILER_GCC_MK+= two
# Prepend the path to the compiler to the PATH.
-. if !empty(_USE_PKGSRC_GCC:M[yY][eE][sS])
-. if exists(${_GCC_PREFIX}bin/gcc) && !empty(_LANGUAGES.gcc)
-. if empty(PREPEND_PATH:M${_GCC_PREFIX}bin)
-PREPEND_PATH+= ${_GCC_PREFIX}bin
-PATH:= ${_GCC_PREFIX}bin:${PATH}
-. endif
-. endif
-. elif !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
-_CC_DIRPATH= ${_CC:H}
-. if !empty(_CC_DIRPATH:M/*)
-. if empty(PREPEND_PATH:M${_CC_DIRPATH})
-PREPEND_PATH+= ${_CC_DIRPATH}
-PATH:= ${_CC_DIRPATH}:${PATH}
-. endif
+. if !empty(_LANGUAGES.gcc)
+. if empty(PREPEND_PATH:M${_GCC_DIR}/bin)
+PREPEND_PATH+= ${_GCC_DIR}/bin
+PATH:= ${_GCC_DIR}/bin:${PATH}
. endif
. endif
@@ -331,5 +333,16 @@ BUILD_DEPENDS+= ${_GCC_DEPENDENCY}
. endif
. endif
. endif
+
+# Create symlinks for the compiler into ${WRKDIR}.
+. for _target_ in ${_GCC_LINKS}
+. if !target(${${_target_}})
+override-tools: ${${_target_}}
+${${_target_}}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${LN} -fs ${_GCCBINDIR}/${${_target_}:T} ${.TARGET}
+. endif
+. endfor
. endif # COMPILER_GCC_MK
.endif # BSD_PREFS_MK
diff --git a/mk/compiler/mipspro.mk b/mk/compiler/mipspro.mk
index 22d72b26c5e..186ac74b027 100644
--- a/mk/compiler/mipspro.mk
+++ b/mk/compiler/mipspro.mk
@@ -1,4 +1,4 @@
-# $NetBSD: mipspro.mk,v 1.13 2004/02/06 04:37:02 jlam Exp $
+# $NetBSD: mipspro.mk,v 1.14 2004/02/07 02:58:10 jlam Exp $
.if !defined(COMPILER_MIPSPRO_MK)
COMPILER_MIPSPRO_MK= one
@@ -15,17 +15,23 @@ _LANGUAGES.mipspro= # empty
_LANGUAGES.mipspro+= ${LANGUAGES.mipspro:M${_lang_}}
. endfor
+_MIPSPRO_DIR= ${WRKDIR}/.mipspro
+_MIPSPRO_LINKS= # empty
. if !empty(_LANGUAGES.mipspro:Mc)
-CC= ${MIPSPROBASE}/bin/cc
-CPP= ${MIPSPROBASE}/bin/cc -E
+_MIPSPRO_CC= ${_MIPSPRO_DIR}/bin/cc
+_MIPSPRO_LINKS+= _MIPSPRO_CC
+CC= ${_MIPSPRO_CC}
+CPP= ${_MIPSPRO_CC} -E
. endif
. if !empty(_LANGUAGES.mipspro:Mc++)
-CXX= ${MIPSPROBASE}/bin/CC
+_MIPSPRO_CXX= ${_MIPSPRO_DIR}/bin/CC
+_MIPSPRO_LINKS+= _MIPSPRO_CXX
+CXX= ${_MIPSPRO_CXX}
. endif
-. if exists(${CC})
+. if exists(${MIPSPROBASE}/bin/cc)
# MIPSpro Compilers: Version 7.3.1.2m
-CC_VERSION!= ${CC} -version 2>&1 | ${GREP} '^MIPSpro'
+CC_VERSION!= ${MIPSPROBASE}/bin/cc -version 2>&1 | ${GREP} '^MIPSpro'
. else
CC_VERSION= MIPSpro
. endif
@@ -40,10 +46,21 @@ COMPILER_MIPSPRO_MK+= two
# Prepend the path to the compiler to the PATH.
. if !empty(_LANGUAGES.mipspro)
-. if empty(PREPEND_PATH:M${MIPSPROBASE}/bin)
-PREPEND_PATH+= ${MIPSPROBASE}/bin
-PATH:= ${MIPSPROBASE}/bin:${PATH}
+. if empty(PREPEND_PATH:M${_MIPSPRO_DIR}/bin)
+PREPEND_PATH+= ${_MIPSPRO_DIR}/bin
+PATH:= ${_MIPSPRO_DIR}/bin:${PATH}
. endif
. endif
+
+# Create symlinks for the compiler into ${WRKDIR}.
+. for _target_ in ${_MIPSPRO_LINKS}
+. if !target(${${_target_}})
+override-tools: ${${_target_}}
+${${_target_}}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${LN} -fs ${MIPSPROBASE}/bin/${${_target_}:T} ${.TARGET}
+. endif
+. endfor
. endif # COMPILER_MIPSPRO_MK
.endif # BSD_PREFS_MK
diff --git a/mk/compiler/sunpro.mk b/mk/compiler/sunpro.mk
index b15d4eb0ec0..162d06cbfb7 100644
--- a/mk/compiler/sunpro.mk
+++ b/mk/compiler/sunpro.mk
@@ -1,4 +1,4 @@
-# $NetBSD: sunpro.mk,v 1.10 2004/02/06 04:37:02 jlam Exp $
+# $NetBSD: sunpro.mk,v 1.11 2004/02/07 02:58:10 jlam Exp $
.if !defined(COMPILER_SUNPRO_MK)
COMPILER_SUNPRO_MK= one
@@ -15,18 +15,24 @@ _LANGUAGES.sunpro= # empty
_LANGUAGES.sunpro+= ${LANGUAGES.sunpro:M${_lang_}}
. endfor
+_SUNPRO_DIR= ${WRKDIR}/.sunpro
+_SUNPRO_LINKS= # empty
. if !empty(_LANGUAGES.sunpro:Mc)
-CC= ${SUNWSPROBASE}/bin/cc
-CPP= ${SUNWSPROBASE}/bin/cc -E
+_SUNPRO_CC= ${_SUNPRO_DIR}/bin/cc
+_SUNPRO_LINKS+= _SUNPRO_CC
+CC= ${_SUNPRO_CC}
+CPP= ${_SUNPRO_CC} -E
. endif
. if !empty(_LANGUAGES.sunpro:Mc++)
-CXX= ${SUNWSPROBASE}/bin/CC
+_SUNPRO_CXX= ${_SUNPRO_DIR}/bin/CC
+_SUNPRO_LINKS+= _SUNPRO_CXX
+CXX= ${_SUNPRO_CXX}
. endif
_COMPILER_LD_FLAG= # empty
-. if exists(${CC})
-CC_VERSION!= ${CC} -V 2>&1 | ${GREP} '^cc'
+. if exists(${SUNWSPROBASE}/bin/cc)
+CC_VERSION!= ${SUNWSPROBASE}/bin/cc -V 2>&1 | ${GREP} '^cc'
. else
CC_VERSION= sunpro
. endif
@@ -41,10 +47,21 @@ COMPILER_SUNPRO_MK+= two
# Prepend the path to the compiler to the PATH.
. if !empty(_LANGUAGES.sunpro)
-. if empty(PREPEND_PATH:M${SUNWSPROBASE}/bin)
-PREPEND_PATH+= ${SUNWSPROBASE}/bin
-PATH:= ${SUNWSPROBASE}/bin:${PATH}
+. if empty(PREPEND_PATH:M${_SUNPRO_DIR}/bin)
+PREPEND_PATH+= ${_SUNPRO_DIR}/bin
+PATH:= ${_SUNPRO_DIR}/bin:${PATH}
. endif
. endif
+
+# Create symlinks for the compiler into ${WRKDIR}.
+. for _target_ in ${_SUNPRO_LINKS}
+. if !target(${${_target_}})
+override-tools: ${${_target_}}
+${${_target_}}:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${LN} -fs ${SUNWSPROBASE}/bin/${${_target_}:T} ${.TARGET}
+. endif
+. endfor
. endif # COMPILER_SUNPRO_MK
.endif # BSD_PREFS_MK