summaryrefslogtreecommitdiff
path: root/mk/compiler
diff options
context:
space:
mode:
authorjlam <jlam>2004-02-06 03:04:50 +0000
committerjlam <jlam>2004-02-06 03:04:50 +0000
commitd446ccd672bee0419a7fe14c5a48da4d9057d5b9 (patch)
tree429ebb5ed1cad414f69277d63bfae94e1170955a /mk/compiler
parent8f09416c8a3e46929130c54844cab505f73727bc (diff)
downloadpkgsrc-d446ccd672bee0419a7fe14c5a48da4d9057d5b9.tar.gz
We only prepend a directory to the PATH if we haven't already done so
(by checking PREPEND_PATH) and only for those phases of the build that care about the PATH (buildlink or later). We also pass the PATH to those same phases of the build so that executing ${CC} will work correctly from custom {pre,do,post}-* targets that occur at buildlink time or later.
Diffstat (limited to 'mk/compiler')
-rw-r--r--mk/compiler/ccache.mk8
-rw-r--r--mk/compiler/distcc.mk9
-rw-r--r--mk/compiler/gcc.mk32
-rw-r--r--mk/compiler/mipspro.mk8
-rw-r--r--mk/compiler/sunpro.mk8
5 files changed, 47 insertions, 18 deletions
diff --git a/mk/compiler/ccache.mk b/mk/compiler/ccache.mk
index 1b07936060b..22ce3a7e6ab 100644
--- a/mk/compiler/ccache.mk
+++ b/mk/compiler/ccache.mk
@@ -1,4 +1,4 @@
-# $NetBSD: ccache.mk,v 1.8 2004/02/05 03:39:17 jlam Exp $
+# $NetBSD: ccache.mk,v 1.9 2004/02/06 03:04:50 jlam Exp $
.if !defined(COMPILER_CCACHE_MK)
COMPILER_CCACHE_MK= one
@@ -58,7 +58,11 @@ COMPILER_CCACHE_MK+= two
. if !empty(_USE_CCACHE:M[yY][eE][sS])
. if !empty(_LANGUAGES.ccache)
-PATH:= ${_CCACHE_DIR}/bin:${PATH}
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${_CCACHE_DIR}/bin)
+PREPEND_PATH+= ${_CCACHE_DIR}/bin
+PATH:= ${_CCACHE_DIR}/bin:${PATH}
+. endif
. endif
BUILD_DEPENDS+= ccache-[0-9]*:../../devel/ccache
diff --git a/mk/compiler/distcc.mk b/mk/compiler/distcc.mk
index 603b2932094..c93040344d8 100644
--- a/mk/compiler/distcc.mk
+++ b/mk/compiler/distcc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: distcc.mk,v 1.11 2004/02/05 03:39:17 jlam Exp $
+# $NetBSD: distcc.mk,v 1.12 2004/02/06 03:04:50 jlam Exp $
.if !defined(COMPILER_DISTCC_MK)
COMPILER_DISTCC_MK= one
@@ -58,8 +58,13 @@ COMPILER_DISTCC_MK+= two
. if !empty(_USE_DISTCC:M[yY][eE][sS])
. if !empty(_LANGUAGES.distcc)
-PATH:= ${_DISTCC_DIR}/bin:${PATH}
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${_DISTCC_DIR}/bin)
+PREPEND_PATH+= ${_DISTCC_DIR}/bin
+PATH:= ${_DISTCC_DIR}/bin:${PATH}
+. endif
. endif
+. endif
BUILD_DEPENDS+= distcc-[0-9]*:../../devel/distcc
diff --git a/mk/compiler/gcc.mk b/mk/compiler/gcc.mk
index 948cf73ac6b..b3295ed0333 100644
--- a/mk/compiler/gcc.mk
+++ b/mk/compiler/gcc.mk
@@ -1,4 +1,4 @@
-# $NetBSD: gcc.mk,v 1.37 2004/02/05 04:12:28 jlam Exp $
+# $NetBSD: gcc.mk,v 1.38 2004/02/06 03:04:50 jlam Exp $
.if !defined(COMPILER_GCC_MK)
COMPILER_GCC_MK= one
@@ -18,14 +18,19 @@ _GCC2_PATTERNS= 2.8 2.8.* 2.9 2.9.* 2.[1-8][0-9] 2.[1-8][0-9].* \
_GCC3_PATTERNS= 2.95.[4-9]* 2.95.[1-9][0-9]* 2.9[6-9] 2.9[6-9].* \
2.[1-9][0-9][0-9]* 3.* [4-9]*
+. if !defined(_CC)
_CC:= ${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
-. for _dir_ in ${PATH:C/\:/ /g}
-. if empty(_CC:M/*)
-. if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//})
+. for _dir_ in ${PATH:C/\:/ /g}
+. if empty(_CC:M/*)
+. if exists(${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//})
_CC:= ${_dir_}/${CC:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
+. endif
. endif
+. endfor
+. if !empty(_CC:M/*)
+MAKEFLAGS+= _CC="${_CC}"
. endif
-. endfor
+. endif
. if !defined(_GCC_VERSION)
_GCC_VERSION_STRING!= \
@@ -293,12 +298,19 @@ 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)
-PATH:= ${_GCC_PREFIX}bin:${PATH}
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${_GCC_PREFIX}bin)
+PREPEND_PATH+= ${GCC_PREFIX}bin
+PATH:= ${_GCC_PREFIX}bin:${PATH}
+. endif
. endif
-. else
-. if !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
-. if !empty(_CC:M/*)
-PATH:= ${_CC:H}:${PATH}
+. elif !empty(_IS_BUILTIN_GCC:M[yY][eE][sS])
+_CC_DIRPATH= ${_CC:H}
+. if !empty(_CC_DIRPATH:M/*)
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${_CC_DIRPATH})
+PREPEND_PATH+= ${_CC_DIRPATH}
+PATH:= ${_CC_DIRPATH}:${PATH}
. endif
. endif
. endif
diff --git a/mk/compiler/mipspro.mk b/mk/compiler/mipspro.mk
index 6da479e238a..0868c146c13 100644
--- a/mk/compiler/mipspro.mk
+++ b/mk/compiler/mipspro.mk
@@ -1,4 +1,4 @@
-# $NetBSD: mipspro.mk,v 1.11 2004/02/05 22:05:42 jlam Exp $
+# $NetBSD: mipspro.mk,v 1.12 2004/02/06 03:04:50 jlam Exp $
.if !defined(COMPILER_MIPSPRO_MK)
COMPILER_MIPSPRO_MK= one
@@ -40,7 +40,11 @@ COMPILER_MIPSPRO_MK+= two
# Prepend the path to the compiler to the PATH.
. if !empty(_LANGUAGES.mipspro)
-PATH:= ${MIPSPROBASE}/bin:${PATH}
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${MIPSPROBASE}/bin)
+PREPEND_PATH+= ${MIPSPROBASE}/bin
+PATH:= ${MIPSPROBASE}/bin:${PATH}
+. endif
. endif
. endif # COMPILER_MIPSPRO_MK
.endif # BSD_PREFS_MK
diff --git a/mk/compiler/sunpro.mk b/mk/compiler/sunpro.mk
index e624e908ded..827eb990edc 100644
--- a/mk/compiler/sunpro.mk
+++ b/mk/compiler/sunpro.mk
@@ -1,4 +1,4 @@
-# $NetBSD: sunpro.mk,v 1.8 2004/02/05 03:39:17 jlam Exp $
+# $NetBSD: sunpro.mk,v 1.9 2004/02/06 03:04:50 jlam Exp $
.if !defined(COMPILER_SUNPRO_MK)
COMPILER_SUNPRO_MK= one
@@ -41,7 +41,11 @@ COMPILER_SUNPRO_MK+= two
# Prepend the path to the compiler to the PATH.
. if !empty(_LANGUAGES.sunpro)
-PATH:= ${SUNWSPROBASE}/bin:${PATH}
+. if !empty(PHASES_AFTER_BUILDLINK:M${PKG_PHASE}) && \
+ empty(PREPEND_PATH:M${SUNWSPROBASE}/bin)
+PREPEND_PATH+= ${SUNWSPROBASE}/bin
+PATH:= ${SUNWSPROBASE}/bin:${PATH}
+. endif
. endif
. endif # COMPILER_SUNPRO_MK
.endif # BSD_PREFS_MK