Index: Makefile.inc1 =================================================================== --- Makefile.inc1 +++ Makefile.inc1 @@ -207,7 +207,7 @@ # Building a world goes through the following stages # # 1. legacy stage [BMAKE] -# This stage is responsible for creating compatibility +# This stage is responsible for creating host compatibility # shims that are needed by the bootstrap-tools, # build-tools and cross-tools stages. # 1. bootstrap-tools stage [BMAKE] @@ -1224,12 +1224,18 @@ # # legacy: Build compatibility shims for the next three targets # + +# ELF Tool Chain libraries are needed for ELF tools and dtrace tools. +.if ${BOOTSTRAPPING} < 1100006 +_elftoolchain_libs= lib/libelf lib/libdwarf +.endif + legacy: .if ${BOOTSTRAPPING} < 800107 && ${BOOTSTRAPPING} != 0 @echo "ERROR: Source upgrades from versions prior to 8.0 not supported."; \ false .endif -.for _tool in tools/build +.for _tool in tools/build ${_elftoolchain_libs} ${_+_}@${ECHODIR} "===> ${_tool} (obj,includes,depend,all,install)"; \ cd ${.CURDIR}/${_tool} && \ ${MAKE} DIRPRFX=${_tool}/ obj && \ @@ -1318,21 +1324,6 @@ ${_bt}-usr.bin/clang/tblgen: ${_bt}-lib/clang/libllvmtablegen ${_bt}-lib/clang/libllvmsupport .endif -# ELF Tool Chain libraries are needed for ELF tools and dtrace tools. -# dtrace tools are required for older bootstrap env and cross-build -# pre libdwarf -.if ${BOOTSTRAPPING} < 1100006 || (${MACHINE} != ${TARGET} || \ - ${MACHINE_ARCH} != ${TARGET_ARCH}) -_elftoolchain_libs= lib/libelf lib/libdwarf -.if ${MK_CDDL} != "no" -_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf cddl/usr.bin/ctfconvert \ - cddl/usr.bin/ctfmerge - -${_bt}-cddl/usr.bin/ctfconvert: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf -${_bt}-cddl/usr.bin/ctfmerge: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf -.endif -.endif - # Default to building the GPL DTC, but build the BSDL one if users explicitly # request it. _dtc= usr.bin/dtc @@ -1361,8 +1352,6 @@ .for _tool in \ ${_clang_tblgen} \ ${_kerberos5_bootstrap_tools} \ - ${_elftoolchain_libs} \ - ${_dtrace_tools} \ ${_strfile} \ ${_gperf} \ ${_groff} \ @@ -1462,6 +1451,19 @@ .endif .endif +# DTrace tools are required when +# 1. the host's tools are too old, or +# 2. we're cross-compiling +.if ${BOOTSTRAPPING} < 1100006 || ${MACHINE} != ${TARGET} +.if ${MK_CDDL} != "no" +_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf cddl/usr.bin/ctfconvert \ + cddl/usr.bin/ctfmerge + +${_bt}-cddl/usr.bin/ctfconvert: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf +${_bt}-cddl/usr.bin/ctfmerge: ${_bt}-lib/libelf ${_bt}-lib/libdwarf ${_bt}-cddl/lib/libctf +.endif +.endif + # If we're given an XAS, don't build binutils. .if ${XAS:M/*} == "" .if ${MK_BINUTILS_BOOTSTRAP} != "no" @@ -1502,6 +1504,7 @@ ${_clang} \ ${_binutils} \ ${_elftctools} \ + ${_dtrace_tools} \ ${_cc} \ ${_btxld} \ ${_crunchide} \