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
This commit is contained in:
parent
0383be9bae
commit
3bed45ab81
@ -39,26 +39,6 @@ CXXFLAGS.clang+= -stdlib=libc++
|
||||
|
||||
.PATH: ${LLVM_SRCS}/${SRCDIR}
|
||||
|
||||
.if ${MK_DIRDEPS_BUILD} == "yes"
|
||||
.if empty(TOOLSDIR) || !exists(${TOOLSDIR}/usr/bin/clang-tblgen)
|
||||
.if ${MACHINE} == "host" && defined(BOOTSTRAPPING_TOOLS)
|
||||
.if !empty(LEGACY_TOOLS) && exists(${LEGACY_TOOLS}/usr/bin/tblgen)
|
||||
TOOLSDIR= ${LEGACY_TOOLS}
|
||||
.endif
|
||||
.endif
|
||||
.if ${MK_STAGING} == "yes" && exists(${STAGE_HOST_OBJTOP:Uno}/usr/bin/tblgen)
|
||||
TOOLSDIR= ${STAGE_HOST_OBJTOP}
|
||||
.endif
|
||||
.if exists(${LEGACY_TOOLS:Uno}/usr/bin/tblgen)
|
||||
TOOLSDIR= ${LEGACY_TOOLS}
|
||||
.endif
|
||||
.endif
|
||||
TOOLSDIR?=
|
||||
.if !empty(TOOLSDIR) && exists(${TOOLSDIR}/usr/bin/clang-tblgen)
|
||||
TBLGEN= ${TOOLSDIR}/usr/bin/tblgen
|
||||
CLANG_TBLGEN= ${TOOLSDIR}/usr/bin/clang-tblgen
|
||||
.endif
|
||||
.endif # ${MK_DIRDEPS_BUILD} == "yes"
|
||||
TBLGEN?= tblgen
|
||||
CLANG_TBLGEN?= clang-tblgen
|
||||
|
||||
|
@ -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}
|
||||
|
@ -20,7 +20,7 @@ BSENV= \
|
||||
MAKESYSPATH=${SRCTOP}/tools/build/mk:${SRCTOP}/share/mk \
|
||||
TARGET=${HOST_MACHINE} TARGET_ARCH=${HOST_MACHINE_ARCH} \
|
||||
WITHOUT_STAGING=1 STAGE_ROOT= BOOTSTRAPPING_TOOLS=1 \
|
||||
WORLDTMP=${BTOOLSDIR} LEGACY_TOOLS=${LEGACY_TOOLS} \
|
||||
WORLDTMP=${BTOOLSDIR} \
|
||||
INSTALL="sh ${SRCTOP}/tools/install.sh" \
|
||||
PATH=${LEGACY_TOOLS}/usr/sbin:${LEGACY_TOOLS}/usr/bin:${LEGACY_TOOLS}/bin:${PATH}
|
||||
|
||||
@ -67,14 +67,15 @@ cross-tools build-tools bootstrap-tools: .MAKE .META
|
||||
touch $@
|
||||
|
||||
# MAKELEVEL=0 so that dirdeps.mk does its thing
|
||||
# LEGACY_TOOLS lets us use the bootstrapped stuff above
|
||||
# BSENV:MPATH=* lets us use the bootstrapped stuff in LEGACY_TOOLS above.
|
||||
# TARGET* is so that MK_CLANG gets set correctly.
|
||||
BSTCENV= \
|
||||
MAKELEVEL=0 \
|
||||
MACHINE=host \
|
||||
LEGACY_TOOLS=${LEGACY_TOOLS} \
|
||||
BOOTSTRAPPING_TOOLS=1 \
|
||||
TARGET=${HOST_MACHINE} \
|
||||
TARGET_ARCH=${HOST_MACHINE_ARCH}
|
||||
TARGET_ARCH=${HOST_MACHINE_ARCH} \
|
||||
${BSENV:MPATH=*}
|
||||
|
||||
BSTCARGS= \
|
||||
${BSARGS:NDESTDIR=*:NOBJTOP=*:NOBJROOT=*:NMK_CROSS_COMPILER=*:NMK_CLANG=*:NMK_GCC=*} \
|
||||
|
Loading…
Reference in New Issue
Block a user