Now that gcc >= 12 supports -ftrivial-auto-var-init, add it to
bsd.compiler.mk's "init-all" feature.
PR: 271047
Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D40208
As of clang 16, the -ftrivial-auto-var-init=zero option no longer needs
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
to enable the option. Only add it for older clang versions.
PR: 271047
Reviewed by: emaste
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D40208
While *most* projects need only DEP_MACHINE for host, there is always
an exception. So we allow for TARGET_SPEC_VARS.host to be a subset of
TARGET_SPEC_VARS. The default will *just work* for most projects.
We set DEP_TARGET_SPEC_VARS and hence DEP_TARGET_SPEC based on
DEP_MACHINE. Allow for M_dep_qual_fixes.host to be different too and
take care to apply the right set.
Add more comments to explain what and why.
Ensure OBJROOT ends in / or - (/ preferred).
Export OBJTOP if level > 0
this avoids the issue with bmake/unit-tests.
Check if we have to override MAKEOBJDIR
and if so, put it into env correctly.
Rather than define the TARGETS and TARGET_ARCHES in src/Makefile
put them in sys.machine.mk so they can also be leveraged by
non-top-level builds.
We have TARGET_MACHINE_LIST as the list of MACHINES we build for.
For each MACHINE we have a MACHINE_ARCH_LIST_${MACHINE}
and the first entry of each list is used as default for
MACHINE_ARCH_${MACHINE}
We can now remove a bunch of MACHINE_ARCH.* handling from
local.sys.dirdeps*mk
Reviewed by: imp
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D40083
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix
When originally implemented, there was no distinction between
DIRDEPS_BUILD and META_MODE, they were one and the same.
META_MODE however is useful by itself, but since meta.sys.mk
had lots of settings related to DIRDEPS_BUILD its use was limited
to DIRDEPS_BUILD.
Move (most) DIRDEPS_BUILD related items to sys.dirdeps.mk
so that meta.sys.mk can be used for just META_MODE.
There is of course some bluring of the lines, so settings remain
in meta.sys.mk
Add MK_META_ERROR_TARGET to enable the META_MODE .ERROR target
independent of DIRDEPS_BUILD, it copies failed .meta files to ${SB}/error
to make it easier to identify the cause of build failures.
Since sys.dirdeps.mk should be included first, most of
local.meta.sys.mk becomes local.sys.dirdeps.mk
and some other bits need to move to local.sys.dirdeps.env.mk
Also fix dirdeps.mk to not add CURDIR to DIRDEPS when it is SRCTOP.
Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D40053
We're never going to support EFI booting on i386 (32-bit). Start to
decommission it, since it's never worked.
Sponsored by: Netflix
Reviewed by: tsoome, emaste
Differential Revision: https://reviews.freebsd.org/D40011
The N_host_libs dance only makes sense if host is FreeBSD.
Even then, if MK_host_egacy is yes we need libmd
libnetbsd does not need libutil when using libegacy
Sponsored by: Juniper Networks, Inc.
Prior to 590461a4b8 installation of include files was controlled
directly by ${MK_TOOLCHAIN}. 590461a4b8 added an INCLUDES knob
defaulting to YES. Setting WITHOUT_TOOLCHAIN forced it off to retain
existing behaviour.
Decouple them now, as there are reasonable use cases for installing
libraries and include files without a compiler or other tool chain
components.
Reviewed by: imp, jrtc27
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39918
A user may use a tool chain from a package or just use an existing
tool chain from a previous installation. There is no reason for this
to disable the installation of lib${LIB}_pic.a.
This also means we don't need to force MK_TOOLCHAIN=yes in lib/libc.
This reverts part of commit c0f5aeb032.
Reviewed by: jrtc27
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39917
If we need to set MK_host_egacy=yes we might need to check it
in local.toolchain.mk so set it earlier in local.meta.sys.env.mk
Leave the default MK_host_egacy?=no in local.sys.mk so it can
be tested in Makefiles without concern for build mode.
For DIRDEPS_BUILD we need Makefile.depend.options to
force libegacy to be built on older FreeBSD and non-FreeBSD hosts.
Add readpassphrase to libegacy to avoid the need for libbsd on Linux
src.opts.mk disable TESTS for host if MK_host_egacy is yes
Reviewed by: imp
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39766
Rather than having a tool in the FreeBSD base system for obtaining
the FreeBSD ports tree, users are encouraged to `pkg install git`
and then `git clone https://git.FreeBSD.org/ports.git /usr/ports`.
The portsnap servers will continue operating until FreeBSD 13 reaches
its End-of-Life, and portsnap is available from the ports tree as
ports-mgmt/portsnap.
Requested by: portmgr
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D39563
X-MFC: no
Latest meta.sys.mk follows sys.mk in including local.meta.sys.env.mk
and local.meta.sys.mk late, but we have things we need done early
so move them to local.meta.sys.env.mk
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.sys.mk: create a pseudo option MK_host_egacy to indicate
if tools/build needs to be built for "host".
local.dirdeps.mk: set MK_host_egacy.host to ${MK_host_egacy}
all other DEP_MACHINES will get "no"
This allows a Makefile.depend.options in makefs etc 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}
src.init.mk: if MACHINE is host and we are not FreeBSD
set some MK_ flags the same as tools/build/mk/Makefile.boot.pre and
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
Reviewed by: jrtc27, arichardson
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39744
Move the setting of TARGET_SPEC_VARS to local.sys.env.mk
so meta.sys.mk can do the processing, and include local.meta.sys.mk
later.
Move the setting of GENDIRDEPS_FILTER*_VARS from local.gendirdeps.mk
to local.meta.sys.mk so we can automatically set DEP_* at level 1+
to avoid syntax errors when DEP_* variables are used in conditionals
in Makefile.depend files.
Update gendirdeps.mk just to get the documentation about the above.
No functional change.
local.dirdeps.mk be more careful about adding to DIRDEPS to avoid
unnecessary overhead, and introducing cycles in the graph.
Also set DEP_MACHINE_CPUARCH.
Reviewed by: stevek
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39737
NETLINK was added along side NETLINK_SUPPORT to control building netlink
specific programs, but it has no consumers so remove it for now.
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D39678
Several makefile depend on tools built for host.
At least when using DIRDEPS_BUILD we can build these for the
pseudo machine "host" to facilitate building on older host versions.
Ideally we would build these tools in their own directories to avoid
building more than needed.
For now, setting an appropriate default for BTOOLSPATH will suffice
Reviewed by: stevek
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D39708
jobs.mk automates -j$JOB_MAX and capturing build log based on target.
Compute a default for JOB_MAX in local.sys.mk
Reviewed by: stevek, imp
Differential Revision: https://reviews.freebsd.org/D39683
A typo in Makefile.depend.options including dirdeps.mk rather than
dirdeps-options.mk can result in infinite recursion - don't let that happen.
Reviewed by: stevek
One conditional outside of ifdef WARNS did not protect against an
unset WARNS. Default WARNS to 0 in conditional if not defined.
Obtained from: Juniper Networks, Inc.
Add CPUTYPE and MACHINE_CPUARCH to the list of variables printed
when there are build errors.
Protect local.sys.mk from multiple inclusion.
Reviewed by: sjg
Obtained from: Juniper Networks, Inc.
lld >= 16 turned on --no-undefined-version by default, which results in
errors whenever symbols are mentioned in version maps, but are not
actually defined in the binary.
Since we have quite a few instances of symbols that are defined or not,
depending on various compile-time settings, suppress this lld check for
the time being.
MFC after: 1 week