When run at tThe top -level we get whatever mk files the bMakefile passes -m to its sub-make used hass in order to ensure
with it (unless explicitly overridden with -m).they use the in-tree mk files in share/mk, SUB_MAKE is set tobut the top-level make itself
include -m pointing ahas to rely on whatever environment the in-tree share/mkbmake used has. For FreeBSD, but the top level does notwe
get thatconfigure the system bmake with .../share/mk:/usr/share/mk, and so needs to work with the subset that is supported bywhich means
bmake's own mk files. The tinderbox, toolchains, kernel-toolchainsit will pick up src's share/mk whenever run from within the src tree,
kernels and worlds targets all recurse into universe and thus work finebut currently for non-FreeBSD we configure our bootstrap bmake only with
in this setting,bmake's own mk files. This is mostly compatible, with two exceptions:
1. but targets"targets" runs at the top level, universe itself requested at the top levelbut needs TARGET_MACHINE_LIST and
and universe-toolchain (whether explicit or implicitly from a top-level the corresponding MACHINE_ARCH_LIST_${target}, otherwise it will just
universe) do not print an empty list.
2. Notably"universe" and "universe-toolchain", targets currently gives an empty list due towhen run at the top level (i.e.
not having sys.machine.mk's definitions not via the various wrappers around universe like tinderbox), aend universe(-toolchain) havep
issues recurs failing into Makefile.inc1 around MAKEOBJDIR(PREFIX). universe-toolchain itself with:
These can all be addressed by introducing new underscore-prefixed bmake[1]: "/path/to/freebsd/share/mk/src.sys.obj.mk" line 112: Cannot use MAKEOBJDIR=
targets we recurse into, giving consistency across all universe-related Unset MAKEOBJDIR to get default: MAKEOBJDIR='${.CURDIR:S,^${SRCTOP},${OBJTOP},}'
By including .../share/mk in the default sys path like FreeBSD's system
targetsbmake we ensure that we get the in-tree mk files for the top-level make,
not just sub-makes, and avoid such issues.
Note that we cannot (yet) stop using the installed mk files, since the
MAKEOBJDIRPREFIX check in Makefile runs in the object directory and uses
env -i, thereby losing the MAKESYSPATH exported by src.sys.env.mk. Other
such issues may also exist, though are likely rare if so.