aboutsummaryrefslogtreecommitdiff
path: root/share/mk/local.meta.sys.mk
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2015-12-01 05:19:02 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2015-12-01 05:19:02 +0000
commit3bed45ab81b42ff4029368ec778cd8700723c535 (patch)
tree6552b1600053cd1af52553a0860a5413eaabc3e3 /share/mk/local.meta.sys.mk
parent0383be9bae2307b24ea5a02ee530a450508fb8c4 (diff)
downloadsrc-3bed45ab81b42ff4029368ec778cd8700723c535.tar.gz
src-3bed45ab81b42ff4029368ec778cd8700723c535.zip
META MODE: Rework [bootstrapped] tools PATH support.
- Support more of the toolchain from TOOLSDIR. - This also improves 'make bootstrap-tools' to pass, for example, AS=/usr/bin/as to Makefile.inc1, which will tell cross-tools to use external toolchain support and avoid building things we won't be using in the build. - Always set the PATH to contain the staged TOOLSDIR directories when not building the bootstrap targets. The previous version was only setting this at MAKE.LEVEL==0 and if the TOOLSDIR existed. Both of these prevented using staged tools that were built during the build though as DIRDEPS with .host dependencies, such as the fix for needing usr.bin/localedef.host in r291311. This is not a common tool so we must build and use it during the build, and need to be prepared to change PATH as soon as it appears. This should also fix the issue of host dependencies disappearing from Makefile.depend and then reappearing due to the start of the fresh build not having the directory yet, resulting in the tools that were built not actually being used. - Only use LEGACY_TOOLS while building in Makefile.inc1. After r291317 and r291546 there is no need to add LEGACY_TOOLS into the PATH for the pseudo/targets/toolchain build. - Because the pseudo/targets/toolchain will now build its own [clang-]tblgen, the special logic in clang.build.mk is no longer needed. - LEGACY_TOOLS is no longer used outside of targets/pseudo/bootstrap-tools so is no longer passed into the environment in its build. Sponsored by: EMC / Isilon Storage Division
Notes
Notes: svn path=/head/; revision=291561
Diffstat (limited to 'share/mk/local.meta.sys.mk')
-rw-r--r--share/mk/local.meta.sys.mk44
1 files changed, 25 insertions, 19 deletions
diff --git a/share/mk/local.meta.sys.mk b/share/mk/local.meta.sys.mk
index c9b0a7104c16..03c4723b0b10 100644
--- a/share/mk/local.meta.sys.mk
+++ b/share/mk/local.meta.sys.mk
@@ -204,35 +204,41 @@ TRACER= ${TIME_STAMP} ${:U}
.if ${MACHINE} == "host"
MK_SHARED_TOOLCHAIN= no
.endif
+TOOLCHAIN_VARS= AS AR CC CLANG_TBLGEN CXX CPP LD NM OBJDUMP OBJCOPY RANLIB \
+ STRINGS SIZE TBLGEN
+_toolchain_bin_CLANG_TBLGEN= /usr/bin/clang-tblgen
+_toolchain_bin_CXX= /usr/bin/c++
.ifdef WITH_TOOLSDIR
TOOLSDIR?= ${HOST_OBJTOP}/tools
-.elif defined(STAGE_HOST_OBJTOP) && exists(${STAGE_HOST_OBJTOP}/usr/bin)
+.elif defined(STAGE_HOST_OBJTOP)
TOOLSDIR?= ${STAGE_HOST_OBJTOP}
.endif
-.if !empty(TOOLSDIR)
-.if ${.MAKE.LEVEL} == 0 && exists(${TOOLSDIR}/usr/bin)
-PATH:= ${PATH:S,:, ,g:@d@${exists(${TOOLSDIR}$d):?${TOOLSDIR}$d:}@:ts:}:${PATH}
+# Don't use the bootstrap tools logic on itself.
+.if ${.TARGETS:Mbootstrap-tools} == "" && \
+ !defined(BOOTSTRAPPING_TOOLS) && !empty(TOOLSDIR) && ${.MAKE.LEVEL} == 0
+.for dir in /sbin /bin /usr/sbin /usr/bin
+PATH:= ${TOOLSDIR}${dir}:${PATH}
+.endfor
.export PATH
-.if exists(${TOOLSDIR}/usr/bin/cc)
-HOST_CC?= ${TOOLSDIR}/usr/bin/cc
-CC?= ${HOST_CC}
-HOST_CXX?= ${TOOLSDIR}/usr/bin/c++
-CXX?= ${HOST_CXX}
-HOST_CPP?= ${TOOLSDIR}/usr/bin/cpp
-CPP?= ${HOST_CPP}
-.export HOST_CC CC HOST_CXX CXX HOST_CPP CPP
-.endif
+# Prefer the TOOLSDIR version of the toolchain if present vs the host version.
+.for var in ${TOOLCHAIN_VARS}
+_toolchain_bin.${var}= ${TOOLSDIR}${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
+.if exists(${_toolchain_bin.${var}})
+HOST_${var}?= ${_toolchain_bin.${var}}
+${var}?= ${HOST_${var}}
+.export HOST_${var} ${var}
.endif
+.endfor
.endif
-HOST_CC?= /usr/bin/cc
-HOST_CXX?= /usr/bin/c++
-HOST_CPP?= /usr/bin/cpp
+.for var in ${TOOLCHAIN_VARS}
+HOST_${var}?= ${_toolchain_bin_${var}:U/usr/bin/${var:tl}}
+.endfor
.if ${MACHINE} == "host"
-CC= ${HOST_CC}
-CXX= ${HOST_CXX}
-CPP= ${HOST_CPP}
+.for var in ${TOOLCHAIN_VARS}
+${var}= ${HOST_${var}}
+.endfor
.endif
.if ${MACHINE:Nhost:Ncommon} != "" && ${MACHINE} != ${HOST_MACHINE}