The whole point of the DIRDEPS_BUILD is to avoid tree walks
and basically build everything in a single pass.
We use the pseudo MACHINE "host" to represent the build host.
When the build host is not FreeBSD or is an older version of FreeBSD
it may need some help to build host-tools.
The directory tools/build does this - building libegacy.
local.dirdeps.mk: create a pseudo option MK_host_egacy to indicate
if tools/build needs to be built for "host".
If so MK_host_egacy.host= yes which will only apply when DEP_MACHINE is
"host" and MK_host_egacy= no covers everyone else.
This allows a Makefile.depend.options in makefs to cause tools/build
to be built for host but only if necessary.
local.init.mk: use ISYSTEM as arg to -isystem so that it can be overridden.
The default remains ${STAGE_INCLUDEDIR}
Also if HAVE_FLAGS is not empty add a bunch of -DHAVE_* flags to CFLAGS
with value of ${HAVE_*} defaulting to 1. This makes it easy for
a linux host to override HAVE_* flags with 0 where needed.
src.init.mk: if MACHINE is host, include src.init.${.MAKE.OS:tl}.mk
if it exists.
For older versions of FreeBSD add libegacy when building PROGs for "host"
Also instead of -isystem${STAGE_INCLUDEDIR} we want
-I${STAGE_INCLUDEDIR} and -isystem/usr/include so we override ISYSTEM.
This means any headers we stage for "host" will take precedence over
system headers but #include_next will DTRT.
src.init.linux.mk: add
-I${SRCTOP}/tools/build/cross-build/include/linux
and generally deal with building host tools on Linux.
Eg. static linking does not work so set NO_SHARED= no
Override some HAVE_ flags.
src.sys.env.mk: on linux awk throws an warning about # in newvers.sh
just send stderr to /dev/null
Sponsored by: Juniper Networks, Inc.