This change builds kernel tools based on the same assumption as building

the kernel itself:  If building for the same architecture as the build host,
the kernel build assumes that the host toolchain is capable of building the
kernel.  If it's not, "make kernel-toolchain" will bootstrap a new set of
tools that will work.

With this change the same assumptions are made for building kernel tools,
and the existing host toolchain is used to do the build (notably, the build
doesn't link the tools with the legacy libraries, which may not even exist).
If ever for some reason the host toolchain isn't capable of building the
kernel tools, then doing a "make kernel-toolchain" will bootstrap newer
tools to get the job done.

So when built as part of buildworld or kernel-toolchain, the kernel tools
are built using the XMAKE (via BMAKE) commands and environment.  When built
as part of building just the kernel on a same-target host, the tools are
built using the new KTMAKE commands and environment.  What doesn't jump
out at you in the diffs is that the difference between BMAKE and KTMAKE
is that BMAKE contains this magic line which changes how the build is done
because it changes what files get included for .include <bsd.prog.mk> and
other standard includes:

    MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}"

and KTMAKE doesn't, and contains this instead:

    TOOLS_PREFIX=${WORLDTMP}

Hopefully this brings the "how to build aicasm with the right toolchain"
saga to a conclusion that works in all usage scenarios that have
historically been supported.
This commit is contained in:
Ian Lepore 2013-11-09 00:15:36 +00:00
parent e2defa5278
commit d3109d3971

View File

@ -263,6 +263,21 @@ XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
-DWITHOUT_GDB
# kernel-tools stage
KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
PATH=${BPATH}:${PATH} \
WORLDTMP=${WORLDTMP} \
VERSION="${VERSION}" \
COMPILER_TYPE=${COMPILER_TYPE}
KTMAKE= TOOLS_PREFIX=${WORLDTMP} MAKEOBJDIRPREFIX=${WORLDTMP} \
${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
DESTDIR= \
BOOTSTRAPPING=${OSRELDATE} \
SSP_CFLAGS= \
-DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
-DNO_PIC -DNO_PROFILE -DNO_SHARED \
-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
# world stage
WMAKEENV= ${CROSSENV} \
_SHLIBDIRPREFIX=${WORLDTMP} \
@ -1020,7 +1035,7 @@ buildkernel:
@echo "--------------------------------------------------------------"
@echo ">>> stage 2.3: build tools"
@echo "--------------------------------------------------------------"
${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools
${_+_}cd ${.CURDIR}; ${KTMAKE} kernel-tools
.if !defined(NO_KERNELDEPEND)
@echo
@echo "--------------------------------------------------------------"