This fixes parallel build issues when trying to depend on ${SUBDIR}. An
example of this in share/i18n/csmapper/Makefile where mapper.dir depends
on ${SUBDIR} having been traversed and built already. Before this
change running make in that directory would build the subdirectories
twice. This led to obscure build races. While reworking that build
may be possible, the framework should not so easily allow creating such
problems.
Now depending on <directory> will properly redirect to the
all_subdir_<directory> target rather than invoking the inline shell.
This also makes 'make -jX <directory>' now respect any
SUBDIR_DEPEND_<directory> statements when SUBDIR_PARALLEL is defined.
This is not entirely intended and may be changed later.
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
This is part of an effort to cleanup handling of some edge cases
involving 'make <directory>'. It also provides the targets for
other uses.
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
This is unifying more of the logic. Rather than create targets such
as 'all: all_subdir_foo' when using SUBDIR_PARALLEL and using
'all: _SUBDIR' when not using SUBDIR_PARALLEL, always use the
expanded out <target>_subdir_<directory> pattern. When not using
SUBDIR_PARALLEL, have each directory-target depend on the previously
defined targets as to respect the *order* of SUBDIR.
Using 'make -N' now prints all directory traversals individually rather
than using a loop, since a loop is no longer used to traverse.
This is part of an effort to cleanup handling of some edge cases
involving 'make <directory>' and making it simpler in the sense
that the pattern used to build is the same for all modes.
MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division
Several atf components require C++, and the test suite is not usable
if building WITHOUT_CXX.
Reviewed by: bdrewery, jmmv
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D7597
This is used by libdtrace to determine the data model of target processes.
This allows for the creation of pid provider probes in 32-bit processes on
amd64.
MFC after: 1 month
Previously, librtld_db just hardcoded /libexec/ld-elf.so, which isn't
correct for processes that aren't using the native ABI. With this change,
librtld_db can be used to inspect non-native processes; in particular,
dtrace -c now works for 32-bit executables on amd64.
MFC after: 1 month
It is a maintained and updated runtime exception stack unwinder that
should be a drop-in replacement.
It can be disabled by setting WITHOUT_LLVM_LIBUNWIND in src.conf.
PR: 206039 [exp-run]
Sponsored by: The FreeBSD Foundation
It was added to sys.mk relatively recently (r274503) for EFI builds
but is no longer used by the base system. The in-tree binutils are
outdated, will not be updated, and will be removed in the future.
Remove it from the toolchain build now to slightly simplify the build
and make sure we don't grow an accidental dependency.
Note that this affects only the toolchain build, and does not affect
/usr/bin/objdump in the built world.
Reviewed by: bdrewery
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D6460
This also adds missing s/aarch64/arm64 to the sys.mk version and also
adds back armv6hf for universe since it was added to the sys.mk version
in r300438.
MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D7159
This improves buildworld, toolchain, kernel-toolchain, and universe targets.
See r300354 or src.conf(5) for more details.
Approved by: re (gjb)
Relnotes: yes (r300354)
Sponsored by: EMC / Isilon Storage Division
kgzldr.o is installed into /usr/lib but using bsd.prog.mk. Add
/usr/lib to the base system directory list so that debug files are
installed into /usr/lib/debug/usr/lib, not /usr/lib/.debug .
Approved by: re (gjb)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
The DPADD data in .depend will be redundant with what is in the .meta file.
Also extend NO_EXTRADEPEND support to bsd.prog.mk.
Approved by: re (blanket, META_MODE)
Sponsored by: EMC / Isilon Storage Division
This is mostly fixing META_MODE with realinstall wanting a .meta
file when it does not need one. These targets really should
always run though since they have _SUBDIR on them.
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
- This was broken by r300350 and r300885.
- Add some comments around the external GCC logic since it is spread out
and in need of some cleanup.
- The problem was that X_COMPILER_TYPE is always defined from CC->XCC's
default, so if /usr/bin/cc is GCC (as it is on native powerpc64) then
X_COMPILER_TYPE was getting GCC and triggering the external logic in
Makefile.libcompat. It was intended to always provide -isystem with
GCC since --sysroot is used into the lib32 sysroot which won't modify
the header path without the -isystem. The use of the libc++/std=c++11
override was only intended to be used for external compilers though
(more accurately GCC 4.8+ but that's a separate assumption to
cleanup). Apply the same logic from Makefile.inc1 to Makefile.libcompat
to only add the libc++ override when needed for external compilers.
Pointyhat to: bdrewery
Tested with: native ppc64 (swills), universe, ppc64 xtoolchain,
amd64 xtoolchain, sparc64 cross-build of ppc64 (host GCC 4.2)
Reported by: andreast, swills
Approved by: re (gjb)
Sponsored by: EMC / Isilon Storage Division
Due to META_MODE being passed into the environment it tends
to keep growing with the defaults.
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
This is a follow-up to r300343.
This is important for the OBJS_DEPEND_GUESS usage in
gnu/usr.bin/cc/cc_tools.
See comments for more details.
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
This is important to allow a Makefile to override OBJS_DEPEND_GUESS for
handling in META_MODE when its depend files are missing.
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
This will print a set of variables from make on error using
MAKE_PRINT_VAR_ON_ERROR. It is already enabled for the DIRDEPS_BUILD.
It may make sense to enable this in the non-meta mode as well once
people are more used to its more verbose error output.
This makes it much simpler to see which .meta file is used when a
command files so that it may be inspected for the build command.
Suggested by: sjg
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
- Move the sys.mk filemon requirement to bsd.init.mk as a warning.
This is intended only to show when building directly in a subdirectory
without filemon loaded.
- Move the error into Makefile and only apply it when building
from the META_TGT_WHITELIST target list.
-DNO_FILEMON can be used to suppress both the warning and the error but
makes WITH_META_MODE less useful. It will only compare build commands
in this mode rather than track all dependencies.
This fixes installing from a jail which doesn't need filemon in this
phase [1].
Reported by: Nikolai Lifanov <lifanov@mail.lifanov.com> [1]
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
Using -B already sets .MAKE.MODE=compat but it was leaving
MK_META_MODE set which could still cause other MK_META_MODE==yes
checks to trigger.
Approved by: re (implicit)
Sponsored by: EMC / Isilon Storage Division
A simplified example of the library targets with WITH_DEBUG_FILES is:
libgeom.so.5: libgeom.so.5.full
cp libgeom.so.5.full libgeom.so.5
libgeom.so.5.full:
ln -s libgeom.so.5 libgeom.so
cc -o libgeom.so.5.full *.o
Before, or without, WITH_DEBUG_FILES it is:
libgeom.so.5:
ln -s libgeom.so.5 libgeom.so
cc -o libgeom.so.5 *.o
The problem is that bmake considers the link source for the libgeom.so
link in the libgeom.so.5.full target as being a dependency for
libgeom.so.5.full. That resolves to libgeom.so.5. Thus a cyclic
dependency is created. The result of this is that if libgeom.so.5 is
created with a newer timestamp than libgeom.so.5.full, then
libgeom.so.5.full will be rebuilt on the next build. This causes a
chain reaction of everything in the build relinking, or hitting the
problem itself.
Moving the link creation to the target that actually creates
libgeom.so.5 fixes the problem. The simplest fix here is to just
duplicate the logic.
Submitted by: sjg
Approved by: re (implicit)
The WITH_META_MODE build is intended to be a working incremental build.
It spies on the build command to see if things should be rebuilt if the
command changes. If you run buildworld, it builds a cross-compiler,
then do installworld and buildworld again it will invoke the
WITH_SYSTEM_COMPILER logic. This then adds on -target/--sysroot, etc,
and causes rebuilds due to the changed build command even though the
compiler used is technically the same revision. Since the incremental
build is not cleaning anything by default then there is much
less risk to rebuilding the already-existing cross-compiler. Just
disable the combined logic and always use and build the cross-compiler.
An alternative to this would be to always pass -target/--sysroot. Doing
so may occur in the future.
Sponsored by: EMC / Isilon Storage Division
Using buildworld, installworld, buildworld. It is expected that nothing
should rebuild. However any host tool used could have its timestamp
updated. Any library used by dynamic tools could have its timestamp
updated. The filemon(4) data in the .meta files captures all reads to
these files. This causes the 2nd buildworld to rebuild everything since
host tools and files have been updated.
Because the build is self-reliant and bootstraps itself, it should be
safe to ignore mtime changes on host files used during the build. Host
files should only impact the build of legacy, build-tools, bootstrap-tools,
cross-tools, but those are already intended to be reproducible from its
own bootstrapping. It is possible in a rare case that a bug in a host
file does produce a broken build tool. If that happens it will just
have to be communicated properly.
An alternative solution would be to update the mtime of all files in the
object directory after installworld so that the host files are not newer
than the object files. That also requires special care for read-only
obj directories and special care to not mess with any intended timestamps in
the build, such as done for reproducibility.
Reported by: many
Sponsored by: EMC / Isilon Storage Division
Ccache will not affect the output of the objects, so just ignore it for
meta mode handling. This avoids having everything rebuild if ccache is
updated.
Sponsored by: EMC / Isilon Storage Division
The first file in these lists will generate everything else so only
it should be getting a .meta file. With bmake's missing=yes meta
feature these would otherwise cause a rebuild without the
.NOMETA hint.
Sponsored by: EMC / Isilon Storage Division
This breaks cross-building with WITH_META_MODE since it will rebuild
'build-tools' during the 'everything' phase.
A more proper fix is coming to bmake to implicitly require .META unless
.NOMETA (and other restrictions) are in place.
for the CONFS issue with dma.conf and ppp.conf.
Thank you very much to Bryan Drewery for looking into the
problem and providing this fix.
Pointyhat: gjb
Sponsored by: The FreeBSD Foundation
Since META_MODE is being sold and used as a working incremental build, it won't
make much sense if filemon data is excluded. There is no way to recover
from that in a subsequent build.
Sponsored by: EMC / Isilon Storage Division
Adding .META to targets-to-build will ensure that they will rebuild if there
is no .meta file.
Adding it to all SUFFIXES and objects ensures that at least objects will
rebuild if there is no .meta file.
This will be reverted if bmake's behavior changes to rebuild on missing .meta
files.
Sponsored by: EMC / Isilon Storage Division
The C++ header files must be searched before /usr/include.
The original code in Makefile.inc1 did this before the change in r297271 to
use -isystem. The libc++ import in r300770 fixed the bug introduced in
r297271 by swapping XCFLAGS and XCXXFLAGS ordering in CROSSENV.
Moving the code from Makefile.inc1 to bsd.sys.mk in r300886 also made it
more difficult to control the order of the flags. CXXFLAGS is based on
CFLAGS, so any additions to it will come after CFLAGS. The CROSSENV
code from Makefile.inc1 was such that it was ensured the CXXFLAGS came
first by setting them directly in CXX. Using CXXFLAGS+=-I would work
here, but instead continue to use -isystem by adding it to CXX so it
comes before CFLAGS.
Reported by: dim
Add zfsd, which deals with hard drive faults in ZFS pools. It manages
hotspares and replements in drive slots that publish physical paths.
cddl/usr.sbin/zfsd
Add zfsd(8) and its unit tests
cddl/usr.sbin/Makefile
Add zfsd to the build
lib/libdevdctl
A C++ library that helps devd clients process events
lib/Makefile
share/mk/bsd.libnames.mk
share/mk/src.libnames.mk
Add libdevdctl to the build. It's a private library, unusable by
out-of-tree software.
etc/defaults/rc.conf
By default, set zfsd_enable to NO
etc/mtree/BSD.include.dist
Add a directory for libdevdctl's include files
etc/mtree/BSD.tests.dist
Add a directory for zfsd's unit tests
etc/mtree/BSD.var.dist
Add /var/db/zfsd/cases, where zfsd stores case files while it's shut
down.
etc/rc.d/Makefile
etc/rc.d/zfsd
Add zfsd's rc script
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
Fix the resource.fs.zfs.statechange message. It had a number of
problems:
It was only being emitted on a transition to the HEALTHY state.
That made it impossible for zfsd to take actions based on drives
getting sicker.
It compared the new state to vdev_prevstate, which is the state that
the vdev had the last time it was opened. That doesn't make sense,
because a vdev can change state multiple times without being
reopened.
vdev_set_state contains logic that will change the device's new
state based on various conditions. However, the statechange event
was being posted _before_ that logic took effect. Now it's being
posted after.
Submitted by: gibbs, asomers, mav, allanjude
Reviewed by: mav, delphij
Relnotes: yes
Sponsored by: Spectra Logic Corp, iX Systems
Differential Revision: https://reviews.freebsd.org/D6564
This fixes CROSS_TOOLCHAIN builds after r300886 since it
relies on X_COMPILER_TYPE being set.
The X_* vars will only represent the external compiler
being used.
Sponsored by: EMC / Isilon Storage Division
This allows respecting -nostdinc, -nostdinc++ and -nostdlib before
making the decision to add in -isystem, etc. The -isystem flags
are problematic for building lib/libc++ and lib/libcxxrt which wants
to only use its own headers.
More information the need of these flags can be found at
https://gcc.gnu.org/ml/gcc/2016-03/msg00219.html
This also reverts r300873.
Sponsored by: EMC / Isilon Storage Division
Passing MAKEOBJDIRPREFIX to the main prog build (rescue) would confuse
WITH_AUTO_OBJ and cause it to create a recursed object directory that
then broke the actual prog build. This is normally not a problem since
we do not call 'make -f prog.mk obj' before building anything in it.
Crunchgen(1) also assumes that if -o is not passed then if an object
directory does not already exist then it should build in the source
directories. The normal buildworld process will have already ran 'make
obj' in each of the component directories so this is not a problem.
With WITH_AUTO_OBJ though this is not the case. So we must tell
crunchgen(1) that MK_AUTO_OBJ=yes will create the directory and to not
require it be present before generating its Makefile.
Sponsored by: EMC / Isilon Storage Division
This would otherwise disallow using meta files from a foreign build that
spread them around in directories outside our own .OBJDIR.
Sponsored by: EMC / Isilon Storage Division
The main prog has a dependency on the submake targets to ensure they are
built. From bsd.crunchgen.mk though we already have our own dependency
on 'make objs' so there is no need for another one. Crunchgen(1) is
doing the right thing here so it is not modified.
This also prevents the CC fix tainting the submake environment with
META_MODE and causing rebuilds. The CC passed is is only intended for
the main prog itself.
Sponsored by: EMC / Isilon Storage Division
This fixes --sysroot and other CFLAGS/LDFLAGS not being respected
in the crunchgen build since it is not including bsd.sys.mk and
other files. For example, this fixes building rescue itself without
--sysroot and other CFLAGS.
Sponsored by: EMC / Isilon Storage Division
Since multiple files are generated from one build command, only
the first to run will actually generate a .meta file. This fix
prevents 'required but missing' rebuilds on each target.
Sponsored by: EMC / Isilon Storage Division
Because bmake defaults to .../share/mk now, this code was not doing anything
to help objdir builds (such as the rescue build). Export the same default.
Sponsored by: EMC / Isilon Storage Division
It turns out we need to leave this in place for a while so that people
running self-hosting armv6hf systems can do the builds necessary to update
to armv6 (which is now hardfloat by default).
This will still build the compiler for the target but will not build the
bootstrap cross-compiler in the cross-tools phase. Other toolchain
bootstrapping, such as elftoolchan and binutils, currently still occurs.
This will utilize the default CC (cc, /usr/bin/cc) as an external compiler.
This is planned to be on-by-default eventually.
This will utilize the __FreeBSD_cc_version compiler macro defined in the
source tree and compare it to CC's version. If they match then the
cross-compiler is skipped. If [X]CC is an external compiler (absolute
path) or WITHOUT_CROSS_COMPILER is already set, then this logic is skipped.
If the expected bootstrap compiler type no longer matches the found CC
compiler type (clang vs gcc), then the logic is skipped. As an extra
safety check the version number is also compared from the compiler to
the tree version.
Clang:
The macro FREEBSD_CC_VERSION is defined in:
lib/clang/include/clang/Basic/Version.inc
For clang -target will be used if TARGET_ARCH != MACHINE_ARCH. This
is from the current external toolchain logic. There is currently an
assumption that the host compiler can build the TARGET_ARCH. This
will usually be the case since we don't conditionalize target arch
support in clang, but it will break when introducing new
architectures. This problem is mitigated by incrementing the version
when adding new architectures.
GCC:
The macro FBSD_CC_VER is defined in:
gnu/usr.bin/cc/cc_tools/freebsd-native.h
For GCC there is no simple -target support when TARGET_ARCH !=
MACHINE_ARCH. In this case the opportunistic skip is not done. If we
add proper support for this case in external toolchain logic then it
will be fine to enable.
This relies on the macros being incremented whenever any change occurs
to these compilers that warrant rebuilding files. It also should never
repeat earlier values.
Reviewed by: brooks, bapt, imp
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D6357
See r298220 for more explanation. We don't want to prevent installing
if a cookie exists for the install target.
Sponsored by: EMC / Isilon Storage Division
This is the same problem as r290629. With META_MODE we do not generate
.depend files, so there is no proper dependency to lookup. Guessed
dependencies must be used. If this proves to be a problem then we will
have to generate and use .depend files even with META_MODE.
Sponsored by: EMC / Isilon Storage Division
This is a follow-up to r299289. If the user did not run bootstrap-tools
for this directory then just build the tool as normal. It assumes that
TARGET == MACHINE, but that was already the case before r299289.
Sponsored by: EMC / Isilon Storage Division
We want to avoid .text relocations in shared objects. libcrypto was the
only consumer and it is now fixed (as of r299389). Remove the now-unused
support for turning off the linker warning.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D6323
Kernel installs always override KMODDIR when installing modules, so
this default setting is only used for standalone module builds. Many
out-of-tree modules manually override KMODDIR already to avoid placing
modules in /boot/kernel. This now makes that behavior the default.
Discussed on: arch@
Reviewed by: imp
Relnotes: yes
after r298107
Summary of changes:
- Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
namespacing is kept with FILES appropriately, and that this shouldn't need
to be repeated if the namespace changes -- only the definition of PACKAGE
needs to be changed
- Allow PACKAGE to be overridden by callers instead of forcing it to always be
`tests`. In the event we get to the point where things can be split up
enough in the base system, it would make more sense to group the tests
with the blocks they're a part of, e.g. byacc with byacc-tests, etc
- Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
previously.
- Remove unnecessary TESTSPACKAGE definitions; this has been elided into
bsd.tests.mk
- Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
- Fix installation of files under data/ subdirectories in lib/libc/tests/hash
and lib/libc/tests/net/getaddrinfo
- Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)
Document the proposed changes in share/examples/tests/tests/... via examples
so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
of communicating that info.
MFC after: never probably
X-MFC with: r298107
PR: 209114
Relnotes: yes
Tested with: buildworld, installworld, checkworld; buildworld, packageworld
Sponsored by: EMC / Isilon Storage Division
Otherwise the build command changes every build. META_MODE will
only remove it if something changes to warrant rebuilding
the file.
Sponsored by: EMC / Isilon Storage Division
dirdeps.mk: move logic to handle -f dirdeps.mk to inside check
for first read of dirdeps.mk
Also fix handling of WITHOUT_DIRDEPS_BELOW
gendirdeps.mk: pass M2D_EXCLUDES to meta2deps
meta.autodep.mk: if we build with nofilemon, leave a cookie to
prevent updating dependencies until cleaned.
Reviewed by: bdrewery
This is limited to src-tree builds, meaning not extended to ports or other
out-of-tree builds.
This will help ensure that read-only OBJDIRS will be respected at install-time
by causing a more consistent failure for those who don't use a read-only
OBJDIR. It also will cause Jenkins to yell. This is a better solution than
trying to see CC=false as has been attempted and discussed before.
Of course this is only relevant for files generated by CC.
Disable this for META_MODE since it will detect the CFLAGS/command
change and force a rebuild.
Sponsored by: EMC / Isilon Storage Division
Prefix with dashes (unordered list) and put one variable on each
line (to avoid future conflicts)
Done via the following one-liner:
> sh -c 'for i in $(make -C tests/sys/aio PROG=foo -VPROG_VARS:O); do printf "\t\t- $i\n"; done'
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
This will allow the variables [*] to be overridden on a per-PROG basis,
which is useful when controlling "stripping" behavior for some tests
that require debug symbols or to be unstripped
DEBUG_FLAGS (similar to CFLAGS) supports appending, whereas STRIP is
an override
*: Due to how STRIP is defined in bsd.own.mk (in addition to
bsd.lib.mk and bsd.prog.mk), and the fact that bsd.test.mk pulls in
bsd.own.mk first, overriding STRIP doesn't work today.
A follow up commit is pending to "rectify" this after additional
testing is done.
Discussed with: bdrewery
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
This happened to work for not prepending .OBJDIR twice but broke the
other case of prepending it when needed.
Pointyhat to: bdrewery
Sponsored by: EMC / Isilon Storage Division
This will only be done if the target is defined, so if the target is
defined after bsd.sys.mk is included then it needs to manually add
${META_DEPS} still.
Sponsored by: EMC / Isilon Storage Division