History log of /freebsd-current/sys/conf/kern.post.mk
Revision Date Author Comments
# 8e1a7e29 10-Oct-2023 Mark Johnston <markj@FreeBSD.org>

sanitizers: Avoid building genassym.c and genoffset.c with sanitizers

Some, particularly KASAN, may insert redzones around global symbols,
resulting in incorrect offset definitions because genassym.sh (ab)uses
symbol sizes to assign semantic meaning.

(Ideally I would be able to define this pattern in one place, but I
haven't found a way to define a GENSYM_CFLAGS that actually works for
all of the consumers (kern.post.mk, kmod.mk, sys/conf/files*).)

MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Juniper Networks, Inc.


# c6ae97c4 26-Dec-2023 Alex Xu (Hello71) <alex_y_xu@yahoo.ca>

sys: ${CFLAGS:N-flto} -> ${CFLAGS:N-flto*}

For the same reason as the original https://reviews.freebsd.org/D9659:
-flto=<N>, -flto=full, and -flto=thin also produce the GIMPLE/bitcode
which is not supported by genassym, so filter those out as well.

Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/898


# d3849ec3 25-Nov-2023 Konstantin Belousov <kib@FreeBSD.org>

Set installed kernel and driver files access modes using KMODMODE var

Reviewed by: emaste, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D42768


# 0b200141 09-Nov-2023 Andrew Turner <andrew@FreeBSD.org>

sys/conf: Move adding kernel.bin earlier

When building with kernel.bin enabled we need to set KERNEL_EXTRA and
KERNEL_EXTRA_INSTALL before they are used otherwise kernel.bin isn't
built.

Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D42531


# 34632ed1 26-Oct-2023 Warner Losh <imp@FreeBSD.org>

arm: Introduce MK_KERNEL_BIN to control generation of kernel.bin

It's sometimes desirable to generate kernel.bin and install it. While
the mainstream has moved on to UEFI booting on arm, some specialized
gear can't support it. For that gear, we unconditionally generate
kernel.bin. Add a knob so that WITH_KERNEL_BIN or WITHOUT_KERNEL_BIN
control its generation and installation. config files should add
'makeoptions WITH_KERNEL_BIN=t' to enable it. Since its use is
specialized, it is off by default now since the arm world has largely
moved on to UEFI.

It only affects arm and arm64 (since those are the only two that support
it).

Sponsored by: Netflix
Reviewed by: mmel
Differential Revision: https://reviews.freebsd.org/D39013


# 3a338c53 18-Oct-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

Add the BBR and RACK stacks to the LINT kernel.

While here, drop the EXTRA_TCP_STACKS option, which serves no purpose and
should never have been added. Instead, build bbr and rack as long as
either or both of INET and INET6 is enabled. There is no risk to anyone
who doesn't load one or both and then twiddle the relevant sysctls.

Differential Revision: https://reviews.freebsd.org/D42088


# 031beb4e 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


# 8a6ab0f7 27-Jul-2023 Jessica Clarke <jrtc27@FreeBSD.org>

Pre-quote macros passed to .incbin to avoid unwanted substitution

Currently for the MFS, firmware and VDSO template assembly files we pass
the path to include with .incbin unquoted and use __XSTRING within the
assembly file to stringify it. However, __XSTRING doesn't just perform a
single level of expansion, it performs the normal full expansion of the
macro, and so if the path itself happens to tokenise to something that
includes a defined macro in it that will itself be substituted. For
example, with #define MACRO 1, a path like /path/containing/MACRO/in/it
will expand to /path/containing/1/in/it and then, when stringified, end
up as "/path/containing/1/in/it", not the intended string. Normally,
macros have names that start or end witih underscores and are unlikely
to appear in a tokenised path (even if technically they could), but now
that we've switched to GNU C as of commit ec41a96daaa6 ("sys: Switch the
kernel's C standard from C99 to GNU99.") there are a few new macros
defined which don't start or end with underscores: unix, which is always
defined to 1, and i386, which is defined to 1 on i386. The former
probably doesn't appear in user paths in practice, but the latter has
been seen to and is likely quite common in the wild.

Fix this by defining the macro pre-quoted instead of using __XSTRING.
Note that technically we don't need to do this for vdso_wrap.S today as
all the paths passed to it are safe file names with no user-controlled
prefix but we should do it anyway for consistency and robustness against
future changes.

This allows make tinderbox to pass when built with source and object
directories inside ~/path-with-unix, which would otherwise expand to
~/path-with-1 and break.

PR: 272744
Fixes: ec41a96daaa6 ("sys: Switch the kernel's C standard from C99 to GNU99.")


# 89f361f7 17-Jul-2023 Simon J. Gerraty <sjg@FreeBSD.org>

kern.post.mk allow NEWVERS_{ENV,ARGS}

Allow makefiles better control of newvers.sh env and args.
Also allow variable overrides on command line.

Reviewed by: imp, stevek
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D41012


# 12496806 27-Mar-2023 Yuri Pankov <yuripv@FreeBSD.org>

kern.post.mk: fix PORTSDIR handling

Using subshell's PORTSDIR variable (via $${PORTSDIR}}) seems to be
only working if PORTSDIR is specified directly on the make command
line.

Use ${PORTDIR} here instead so that setting the variable in
/etc/{make,src,src-env}.conf would work (also works for variable
being set on command line or in the environment).

PR: 268299
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D37868


# e9d6b699 05-Feb-2023 Simon J. Gerraty <sjg@FreeBSD.org>

kern.post.mk we need .MAKE.DEPENDFILE for DIRDEPS_BUILD

When MK_DIRDEPS_BUILD is yes, we need .MAKE.DEPENDFILE left
alone

Reviewed by: stevek


# ab8b2d10 14-Dec-2022 Mark Johnston <markj@FreeBSD.org>

sys/conf: Remove an unneeded flag variable

After commit fac6dee9eb58 ("Remove tests for obsolete compilers in the
build system"), we always set -fdebug-prefix-map, so there's no point in
defining and testing _MAP_DEBUG_PREFIX. No functional change intended.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation


# d07600c5 13-Jun-2022 Brooks Davis <brooks@FreeBSD.org>

amd64: symlink i386 includes into build dir

By creating an i386 symlink, this allows code compiled with -m32 to
build (32-bit vdso and linux bits) when -m32 support requires files
in the i386 hierarchy.

Reviewed by: jhb, imp


# aea2a658 13-Feb-2022 David E. O'Brien <obrien@FreeBSD.org>

Don't delete hack.c - causes perpetual 'out of date' kernel

Deleting hack.c cause the kernel to always be out of date:

$ make kernel
make: /usr/src/sys/amd64/compile/GENERIC/.depend.hack.pico, 1:
ignoring stale .depend for hack.c
:> hack.c
cc -shared -O2 -pipe ... -nostdlib hack.c -o hack.pico
rm -f hack.c
MAKE="make" sh ../../../conf/newvers.sh "-R" GENERIC
cc -c -O2 -pipe ... -std=iso9899:1999 -Werror vers.c
ctfconvert -L VERSION -g vers.o
linking kernel.full

Keeping hack.c in the compile directory causes no harm,
so there's no reason to delete it.

Also rename the file to "force-dyamic-hack.c" so it is
clear what the hack is aboug.

Reviewed by: sjg
Differential Revision: https://reviews.freebsd.org/D34281


# 0f2d88d1 06-Dec-2021 Konstantin Belousov <kib@FreeBSD.org>

amd64: Only build aout.ko when COMPAT_FREEBSD32 is enabled

a.out.ko is useless without COMPAT_FREEBSD32, and since vdso support was
added, it requires a header built during depend phase, from the COMPAT
option.

Reported by: glebius
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33311


# 24221389 02-Jun-2021 Andrew Turner <andrew@FreeBSD.org>

Fix the KCSAN_ENABLED check when building modules

The KCSAN_ENABLED variable is non-empty when the kernel is being built
with KCSAN. This allows us to disable modules that are known to be
broken.

There was a bug where we would check if it was defined. As this is
always the case the KCSAN_ENABLED variable would be set when building
modules so we would never build such a module. Fix this by checking
if the value is empty before passing it on to the module stage.

This doesn't affect how modules are built as the CFLAGS passed to
modules has the correct check.

Reported by: rstone
Sponsored by: Innovate UK


# aa3ea612 31-Mar-2021 Konstantin Belousov <kib@FreeBSD.org>

x86: remove gcov kernel support

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D29529


# f54c6ef1 20-Oct-2020 John Baldwin <jhb@FreeBSD.org>

Use a template assembly file to generate the embedded MFS.

This uses the .incbin directive to pull in the MFS image contents.
Using assembly directly ensures that symbols can be defined with the
name and properties (such as .size) desired without having to rename
symbols, etc. via a second objcopy invocation. Since it is compiled
by the C compiler driver, it also avoids the need for all of the
EMBEDFS* make variables.

Suggested by: jrtc27
Reviewed by: kib, markj
Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26781


# 2b6ee34c 25-Aug-2020 Alex Richardson <arichardson@FreeBSD.org>

Pass -fuse-ld=/path/to/ld if ${LD} != "ld"

This is needed so that setting LD/XLD is not ignored when linking with $CC
instead of directly using $LD. Currently only clang accepts an absolute
path for -fuse-ld= (Clang 12+ will add a new --ld-path flag), so we now
warn when building with GCC and $LD != "ld" since that might result in the
wrong linker being used.

We have been setting XLD=/path/to/cheri/ld.lld in CheriBSD for a long time and
used a similar version of this patch to avoid linking with /usr/bin/ld.
This change is also required when building FreeBSD on an Ubuntu with Clang:
In that case we set XCC=/usr/lib/llvm-10/bin/clang and since
/usr/lib/llvm-10/bin/ does not contain a "ld" binary the build fails with
`clang: error: unable to execute command: Executable "ld" doesn't exist!`
unless we pass -fuse-ld=/usr/lib/llvm-10/bin/ld.lld.

This change passes -fuse-ld instead of copying ${XLD} to WOLRDTMP/bin/ld
since then we would have to ensure that this file does not exist while
building the bootstrap tools. The cross-linker might not be compatible with
the host linker (e.g. when building on macos: host-linker= Mach-O /usr/bin/ld,
cross-linker=LLVM ld.lld).

Reviewed By: brooks, emaste
Differential Revision: https://reviews.freebsd.org/D26055


# 5bb9250e 25-Aug-2020 Alex Richardson <arichardson@FreeBSD.org>

Add necessary Makefile.inc1 infrastructure for building on non-FreeBSD

The most awkward bit in this patch is the bootstrapping of m4:
We can't simply use the host version of m4 since that is not compatible
with the flags passed by lex (at least on macOS, possibly also on Linux).
Therefore we need to bootstrap m4, but lex needs m4 to build and m4 also
depends on lex (which needs m4 to generate any files). To work around this
cyclic dependency we can build a bootstrap version of m4 (with pre-generated
files) then use that to build the real m4.

This patch also changes the xz/unxz/dd tools to always use the host version
since the version in the source tree cannot easily be bootstrapped on macOS
or Linux.

Reviewed By: brooks, imp (earlier version)
Differential Revision: https://reviews.freebsd.org/D25992


# fac6dee9 12-May-2020 Eric van Gyzen <vangyzen@FreeBSD.org>

Remove tests for obsolete compilers in the build system

Assume gcc is at least 6.4, the oldest xtoolchain in the ports tree.
Assume clang is at least 6, which was in 11.2-RELEASE. Drop conditions
for older compilers.

Reviewed by: imp (earlier version), emaste, jhb
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D24802


# ab2b8d67 07-Apr-2020 Brooks Davis <brooks@FreeBSD.org>

Allow the kernel to build with a compiler that sets -fno-common.

The mechanism that generates assym.inc and offset.inc depends on the
symbols in question being common. For now, simply force the object files
to be created with -fcommon.

-fno-common will be the default in GCC10/LLVM11.

Submitted by: arichardson
Reviewed by: kevans
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24322


# 82952c40 31-Jan-2020 Bryan Drewery <bdrewery@FreeBSD.org>

make all is needed to generate .depend.*

PR: 241746
X-MFC-With: r357043
MFC after: 1 week


# 1207cda9 26-Jan-2020 John Baldwin <jhb@FreeBSD.org>

Compile hack.c with normal CFLAGS + -shared -nostdlib.

Originally, hack.c was compiled into a shard object with just -shared
-nostdlib. This assumed that ${CC} did not require any additional
flags for ABIs, cross-building, etc.

When kern.post.mk was created in r89509 by reducing duplication in
kernel Makefile.<arch> files, the -shared flag was moved into a
HACK_EXTRA_FLAGS variable so that sparc64 could override it with
-Wl,-shared. The sparc64 hack was removed in r111650, but
HACK_EXTRA_FLAGS was left in place. Over time, we have started
support toolchains that require flags to support alternate ABIs on
MIPS and PowerPC and started (ab)using HACK_EXTRA_FLAGS to set only
those flags.

I need to fix risc-v to pass -mno-relax to the hack.c build for lld in
llvm 10, and the patches to support cross-build from non-FreeBSD hosts
need to include -target for clang in CFLAGS for hack.c. Rather than
adding more hacks into HACK_EXTRA_FLAGS, just use the full set of
CFLAGS with hack.c.

Reviewed by: kib, arichardson
MFC after: 1 month
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23362


# 10cd2843 23-Jan-2020 Yoshihiro Takahashi <nyan@FreeBSD.org>

Fix kernel-tags target.
- A depend-file is broken up into .depend.*.o files. [1]
- Fix an assembly file support.

PR: 241746
Submitted by: leres [1]
MFC after: 1 week


# 849aef49 21-Nov-2019 Andrew Turner <andrew@FreeBSD.org>

Port the NetBSD KCSAN runtime to FreeBSD.

Update the NetBSD Kernel Concurrency Sanitizer (KCSAN) runtime to work in
the FreeBSD kernel. It is a useful tool for finding data races between
threads executing on different CPUs.

This can be enabled by enabling KCSAN in the kernel config, or by using the
GENERIC-KCSAN amd64 kernel. It works on amd64 and arm64, however the later
needs a compiler change to allow -fsanitize=thread that KCSAN uses.

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D22315


# 1f6453b1 04-Sep-2019 Kyle Evans <kevans@FreeBSD.org>

Back out r351799

empty does not appear to work like I thought it did and it actively breaks
real LOCAL_MODULES usage, of which I have none at the moment...


# a3f59fe2 03-Sep-2019 Kyle Evans <kevans@FreeBSD.org>

LOCAL_MODULES: Allow LOCAL_MODULES="" in src.conf to work

Currently LOCAL_MODULES= works, but LOCAL_MODULES="" causes build errors as
.for still has the empty string to loop over. An .if empty prior to the loop
was considered, but LOCAL_MODULES has empty quotes at that point and thus,
isn't empty. A better solution likely exists, but this floats us by for
now...


# 9b82c664 06-Aug-2019 John Baldwin <jhb@FreeBSD.org>

Fix LOCAL_MODULES and improve the make output.

The exists() check guarding the invocation of ls was not working
correctly as it was expanding '$L' to determine the path of the local
modules directory. Fix by using {} around the variable name.

Inline some of the logic from bsd.subdir.mk when invoking local module
builds. This gives output in 'make buildkernel' the same as if there
was a Makefile in /usr/local/sys/modules with SUBDIR =
${LOCAL_MODULES}.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D20991


# 29317e6a 10-May-2019 Bryan Drewery <bdrewery@FreeBSD.org>

Fix build race with machine links and genoffset.o.

Generate the ilinks for all dependency objects not just the ones
in the CLEAN list.

Possibly related to r345351

Reported by: kmoore
MFC after: 2 weeks
X-MFC-with: r345351
Sponsored by: Dell EMC Isilon


# af44a263 23-Apr-2019 Kyle Evans <kevans@FreeBSD.org>

fdt: stop installing FDT_DTS_FILE

r346307 inadvertently started installing FDT_DTS_FILE along with the kernel.
While this isn't necessarily bad, it was not intended or discussed and it
actively breaks some current setups that don't anticipate any .dtb being
installed when it's using static fdt. This change could be reconsidered down
the line, but it needs to be done with prior discussion.

Fix it by pushing FDT_DTS_FILE build down into the raw dtb.build.mk bits.
This technically allows modules building DTS to accidentally specify an
FDT_DTS_FILE that gets built but isn't otherwise useful (since it's not
installed), but I suspect this isn't a big deal and would get caught with
any kind of testing -- and perhaps this might end up useful in some other
way, for example by some module wanting to embed fdt in some other way than
our current/normal mechanism.

Reported by: Mori Hiroki <yamori813@yahoo.co.jp>
MFC after: 3 days
X-MFC-With: r346307


# 924f8189 16-Apr-2019 Kyle Evans <kevans@FreeBSD.org>

fdt: further consolidate DTB building and revise manpage

FDT_DTS_FILE was built separately with a rule in sys/conf/files and
recreated the rules we used in dtb.mk. Now that we have other infrastructure
to build a DTB along with the kernel, fold FDT_DTS_FILE into that since it
doesn't have any special requirements.

fdt(4) never got revised to mention the DTS/DTSO make options, so do that
now.

Reviewed by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19736


# 963ae7a6 27-Mar-2019 Mark Johnston <markj@FreeBSD.org>

Stop using -fdebug-prefix-map to map the object directory.

We were doing so as a workaround for the problem addressed by r345593, so
it's no longer necessary.

Reviewed by: jhb
Discussed with: emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19705


# dc463613 25-Mar-2019 Kyle Evans <kevans@FreeBSD.org>

Allow kernel config to specify DTS/DTSO to build, and out-of-tree support

This allows for directives such as

makeoptions DTS+=/out/of/tree/myboard.dts
# in tree! Same rules applied as if this were in a dtb/ module
makeoptions DTS+=otherboard.dts

to be specified in config(5) and have these built/installed alongside th
kernel. The assumption that overlays live in an overlays/ directory is only
made for in-tree DTSO, but we still make the assumption that out-of-tree
arm64 DTS will be in vendored directories (for now).

This lowers the cost to hacking on an overlay or dts by being able to
quickly throw it in a custom config, especially if it doesn't fit one of the
current dtb/modules quite appropriately or it's not intended for commit
there.

The build/install targets were split out of dtb.mk to centralize the build
logic and leave out the all/realinstall/CLEANFILES additions... it was
believed that we didn't want to pollute the kernel build with these.

The build rules were converted to suffix rules at the suggestion of Ian to
clean things up a little bit in a world where we can have mixed
in-tree/out-of-tree DTS/DTSO specified.

Reviewed by: ian
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D19351


# 0a036938 20-Mar-2019 Bryan Drewery <bdrewery@FreeBSD.org>

Build common kernel dependencies before modules.

This ensures files like genassym.o and awk/mfiles are generated before
descending into the modules build. It may also allow some module builds
to not recreate files that are already present in the KERNBUILDDIR.

This fixes a rare build race where genassym.o is missing and assym.inc
is empty.

More work is planned around this to reduce some redundant dependency
generation in modules.

PR: 233339
MFC after: 2 weeks
Reported by: markj


# 7114b176 20-Mar-2019 Mark Johnston <markj@FreeBSD.org>

Use -fdebug-prefix-map to map auto-generated kernel build paths.

The kernel build uses symlinks to make MD #includes like <machine/pcpu.h>
work. Debug info ends up referencing these symlinks in a relative path,
so debuggers generally don't know how to find the corresponding headers.
Address this by using -fdebug-prefix-map to map relative paths through
the symlinks to their absolute paths in the source tree. This is
consistent with how regular source file paths are defined in the
kernel's debug info.

Also map the current directory to an absolute path to the object
directory. This gives debuggers a chance to find auto-generated files
like vnode_if.c if the object directory is available.

Reviewed by: emaste, jhb (previous version)
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19633


# 5426539c 23-Feb-2019 Matt Macy <mmacy@FreeBSD.org>

gcov support

add gcov support and export results as files in debugfs

Reviewed by: hps@
MFC after: 1 week
Sponsored by: iX Systems
Differential Revision: https://reviews.freebsd.org/D19260


# 4ea56599 06-Nov-2018 Andrew Turner <andrew@FreeBSD.org>

Port the NetBSD ubsan runtime to the FreeBSD kernel.

This allows us to build the ubsan code added in r340189 into the kernel
with the KUBSAN option. This will report when undefined behaviour is
detected in the currently running kernel.

As it can be large, the kernel is 65MB on arm64, loader may not be able to
load the kernel on all architectures so is disabled by default for now.

Sponsored by: DARPA, AFRL


# 58b6812d 30-Oct-2018 John Baldwin <jhb@FreeBSD.org>

Only invoke 'ls' if the local modules directory exists.

This avoids a spurious make warning if /usr/local/sys/modules doesn't
exist.

Submitted by: rgrimes
Reported by: markj


# cd785c1b 29-Oct-2018 John Baldwin <jhb@FreeBSD.org>

Permit local kernel modules to be built as part of a kernel build.

Add support for "local" modules. By default, these modules are
located in LOCALBASE/sys/modules (where LOCALBASE defaults to
/usr/local). Individual modules can be built along with a kernel by
defining LOCAL_MODULES to the list of modules. Each is assumed to be
a subdirectory containing a valid Makefile. If LOCAL_MODULES is not
specified, all of the modules present in LOCALBASE/sys/modules are
built and installed along with the kernel.

This means that a port that installs a kernel module can choose to
install its source along with a suitable Makefile to
/usr/local/sys/modules/<foo>. Future kernel builds will then include
that kernel module using the kernel configuration's opt_*.h headers
and install it into /boot/kernel along with other kernel-specific
modules.

This is not trying to solve the issue of folks running GENERIC release
kernels, but is instead aimed at folks who build their own kernels.
For those folks this ensures that kernel modules from ports will
always be using the right KBI, etc. This includes folks running any
KBI-breaking kernel configs (such as PAE).

There are still some kinks to be worked out with cross-building (we
probably shouldn't include local modules in cross-built kernels by
default), but this is a sufficient starting point.

Reviewed by: imp
MFC after: 3 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D16966


# 08d0704d 11-Sep-2018 Ed Maste <emaste@FreeBSD.org>

Switch reproducible builds to unmodified src tree mode

newvers.sh supports two modes for reproducible builds:

-r Reproducible build. Do not embed directory names, user
names, time stamps or other dynamic information into
the output file. This is intended to allow two builds
done at different times and even by different people on
different hosts to produce identical output.

-R Reproducible build if the tree represents an unmodified
checkout from a version control system. Metadata is
included if the tree is modified.

Switch to the second mode when reproducible builds are enabled.
The value of a reproducible build is much less when building from an
uncontrolled, modified src tree, and -R likely provides the best
compromise in allowing the REPRODUCIBLE_BUILD knob to be enabled by
default for the release.

Approved by: re (kib)
Sponsored by: The FreeBSD Foundation


# 817f7baa 03-Jul-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Use OBJS_DEPEND_GUESS for forced opt_global.h dependency.

MFC after: 2 weeks
Sponsored by: Dell EMC


# 9f7b089e 03-Jul-2018 Matt Macy <mmacy@FreeBSD.org>

Enable MODULE_TIED by default for modules compiled with the kernel

Requested by: jhb


# cd1acc77 03-Jul-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Fix .depend.foo.o tracking for sys/conf/files defined compilations.

Some example files:
ia32_genassym.o
acpi_wakecode.o

The old mkdep method also lacked tracking these files.

Objects defined in sys/conf/files with no-obj and no-implicit-rule get their
own targets defined in the kernel Makefile but lack having their objects added
to DEPENDOBJS so never get a .depend file generated. Normally if an object is
in OBJS it will get a .depend file.

Fix this by looking for .o files in CLEAN and ensuring they are part of
the -MD filtering and .depend loading. This is a hack. Other solutions
could exist involving sys/conf/files or config(8) to auto add these to
DEPENDFILES/DEPENDOBJS but this method seems reliable enough without being
intrusive or error-prone for new files.

Reported by: bde
MFC after: 3 weeks
Sponsored by: Dell EMC


# 44e41648 03-Jul-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Fix r335906+r335907 to not pass multiple source files to genoffset_test.o target.

This is working around a bug with the FAST_DEPEND logic with custom targets
that use .ALLSRC.

Reported by: mmacy


# a46134b6 03-Jul-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Handle .depend for genoffset_test.o


# 4cee7eae 03-Jul-2018 Bryan Drewery <bdrewery@FreeBSD.org>

No need to make a copy to build genoffset_test.o


# 018617b8 03-Jul-2018 Matt Macy <mmacy@FreeBSD.org>

explain the purpose of genoffset_test


# 87c259d4 03-Jul-2018 Matt Macy <mmacy@FreeBSD.org>

ensure that offset.inc is generated first


# 6443773d 02-Jul-2018 Matt Macy <mmacy@FreeBSD.org>

make critical_{enter, exit} inline

Avoid pulling in all of the <sys/proc.h> dependencies by
automatically generating a stripped down thread_lite exporting
only the fields of interest. The field declarations are type checked
against the original and the offsets of the generated result is
automatically checked.

kib has expressed disagreement and would have preferred to simply
use genassym style offsets (which loses type check enforcement).
jhb has expressed dislike of it due to header pollution and a
duplicate structure. He would have preferred to just have defined
thread in _thread.h. Nonetheless, he admits that this is the only
viable solution at the moment.

The impetus for this came from mjg's D15331:
"Inline critical_enter/exit for amd64"

Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D16078


# 28da5c6d 30-Mar-2018 Jason A. Harmening <jah@FreeBSD.org>

Remove MK_AUTO_OBJ from env passed to PORTS_MODULES

This fixes a failure to resolve object file paths seen when buildkernel
(which sets MK_AUTO_OBJ=yes) and installkernel (which sets MK_AUTO_OBJ=no)
are run as separate steps. r329232 partially fixed this scenario by removing
MAKEOBJDIR, but it seems the AUTO_OBJ setting also needs to be on the same
page for the build and install steps.

Reviewed by: bdrewery
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14143


# fc2a8776 20-Mar-2018 Ed Maste <emaste@FreeBSD.org>

Rename assym.s to assym.inc

assym is only to be included by other .s files, and should never
actually be assembled by itself.

Reviewed by: imp, bdrewery (earlier)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D14180


# 71b12654 09-Mar-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Fix rebase mismerge in r330724.

X-MFC-With: r330724
MFC after: 2 weeks
Sponsored by: Dell EMC


# 906ce865 09-Mar-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Don't skip reading depend for 'make obj' unless it is alone.

This was effectively done in bsd.dep.mk quite some time ago.

MFC after: 2 weeks
Sponsored by: Dell EMC


# 003a0576 09-Mar-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Skip reading depend files with -V unless looking up a depend variable.

This speeds up some simple -V lookups significantly.

Reported by: bde
MFC after: 2 weeks
Sponsored by: Dell EMC


# 50160862 13-Feb-2018 Bryan Drewery <bdrewery@FreeBSD.org>

ports modules: Don't leak AUTO_OBJ changes into the port builds.

This came about when r328489 made ports modules builds no longer use the
in-tree share/mk files, but didn't cleanup MAKEOBJDIR from the
environment.

This fixes "Variable OBJTOP is recursive".

Sponsored by: Dell EMC


# 283f8a5c 27-Jan-2018 Jason A. Harmening <jah@FreeBSD.org>

Remove system makefile path directives from env passed to PORTS_MODULES step

Previously, MAKESYSPATH as well as '-m' directives in MAKEFLAGS would cause
any port rebuilt during the PORTS_MODULES stage to consume system makefiles
from $(SRCROOT)/share/mk instead of those installed under /usr/share/mk.
For kernel modules that need to build against an updated src tree this
makes sense; less so for <bsd.port.mk> or any userspace library or utility
the port may also happen to install.

Before 11.0, this probably didn't matter much in practice. But the addition
of src.libnames.mk under $(SRCROOT)/share/mk in 11.0 breaks any consumer of
bsd.prog.mk and DPADD/LDADD during PORTS_MODULES.

Address the build breakage by removing MAKESYSPATH and any occurrence of
'-m' from MAKEFLAGS in the environment created for the port build.
Instead set SYSDIR so that any kmod built by the port will still consume
conf/kmod.mk from the updated src tree, assuming it uses <bsd.kmod.mk>

Reviewed by: bdrewery
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D13053


# 454ce383 16-Jan-2018 Alex Richardson <arichardson@FreeBSD.org>

Use ln -n instead of -h to allow building the kernel on Linux

Both flags do the same thing but -n is more widely supported.

Reviewed By: jhb, emaste
Approved By: jhb (mentor)
Differential Revision: https://reviews.freebsd.org/D13936


# 7cc780d7 04-Dec-2017 Bryan Drewery <bdrewery@FreeBSD.org>

DEPENDSRCS not used here.

Sponsored by: Dell EMC


# b4585565 04-Dec-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Rename DEPENDFILES_OBJS to DEPENDFILES.

This is to be consistent with bsd.dep.mk using DEPENDFILES after
r325677.

Sponsored by: Dell EMC


# b00ea69b 18-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Fix PORTS_MODULES+'make reinstallkernel' trying to run bogus 'make redeinstall'.

Also fix 'make installkernel' running 'make deinstall' twice.

PR: 201779
MFC after: 2 weeks
Sponsored by: Dell


# 1cbb5888 17-Nov-2017 Warner Losh <imp@FreeBSD.org>

Remove build system support for lint.

Differential Revision: https://reviews.freebsd.org/D13124


# 96dd05dd 16-Aug-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Quote ${MAKE} when passing in env in case it contains spaces.

Downstream we are wrapping MAKE with a limits(1) call which
interferes with these non-quoted cases.

Sponsored by: Dell EMC Isilon


# ecc39238 25-Jul-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Allow -DNO_SKIP_DEPEND to override the _SKIP_DEPEND logic.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon


# c2fd1d01 24-Jul-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Allow disabling dependency tracking if DEPEND_CFLAGS is empty.

This falls back on using the guesssed dependencies if so.
Also remove a pre-bmake check while here.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon


# 711019f7 24-Jul-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Slightly simplify logic for which depend file is expected.

This is a NOP.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon


# f80b8a88 12-Jul-2017 Bryan Drewery <bdrewery@FreeBSD.org>

META_MODE: Fix not writing .meta files in the kernel build.

This was a regression in r320220 due to improper porting of the
same logic from share/mk/bsd.dep.mk and having only tested with
-DNO_FILEMON at the time.

Pointyhat to: bdrewery
Reported by: Mark Millard, dhw, O. Hartmann
Sponsored by: Dell EMC Isilon


# 210ecc00 21-Jun-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Rework logic for skipping .depend/.meta file read/stat/writes.

- Rename _SKIP_READ_DEPEND to _SKIP_DEPEND since it also avoids writing.
- This now uses .NOMETA to avoid reading any .meta files related to
DEPENDOBJS. Objects not in OBJS/DEPENDOBJS may still have their .meta
files read in if they are in the dependency graph.
- This also avoids statting .meta and .depend files in the META_MODE +
-DNO_FILEMON case.

MFC after: 2 weeks
Sponsored by: Dell EMC Isilon


# 202d6f8c 21-Jun-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Fix various 'make *clean *all *install' combinations.

This follows commits like r320174 in share/mk/bsd.dep.mk.

MFC after: 3 days
Sponsored by: Dell EMC Isilon


# 6d75a7a8 09-May-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Support skipping 'make obj' tree-walk.

This is part of a larger effort for WITH_AUTO_OBJ and a WORLDFAST
option.

Sponsored by: Dell EMC Isilon


# d61db6be 27-Feb-2017 Enji Cooper <ngie@FreeBSD.org>

Use "build" instead of "all" when building ports modules

"all" in ports currently means "stage the ports", which requires root today,
and brings to light other potential issues, like ENAMETOOLONG with staged
directories (bug 161481, etc).

This fixes buildkernel for me when run as a non-root user, assuming all
of the prerequisites have been installed beforehand and are up-to-date.

MFC after: 1 month
Discussed with: swills (IRC)
Sponsored by: Dell EMC Isilon


# 0e8b3ab3 21-Feb-2017 Ed Maste <emaste@FreeBSD.org>

Exclude -flto when building *genassym.o

The build process generates *assym.h using nm from *genassym.o (which is
in turn created from *genassym.c).

When compiling with link-time optimization (LTO) using -flto, .o files
are LLVM bitcode, not ELF objects. This is not usable by genassym.sh,
so remove -flto from those ${CC} invocations.

Submitted by: George Rimar
Reviewed by: dim
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D9659


# 0a201eea 22-Dec-2016 Ian Lepore <ian@FreeBSD.org>

Use ${.OBJDIR} to refer to the kernel build object dir, instead of trying
to recreate it from ${MAKEOBJDIRPREFIX} and ${SRC_BASE} and ${KERNCONF},
the latter being especially problematic when KERNCONF is set to the names
of multiple kernel configs.


# 602f95d4 15-Dec-2016 Ed Maste <emaste@FreeBSD.org>

Add WITH_REPRODUCIBLE_BUILD src.conf(5) knob to disable kernel metadata

The kernel builds reproducibly, except for the time, date, user, and
hostname baked into the kernel (reported at startup and via the
kern.version sysctl for uname). Add a build knob to disable the
inclusion of this metadata.

Reviewed by: jhb
MFC after: 1 month
Relnotes: Yes
Sponsored by: Reproducible Builds World Summit 2, Berlin
Differential Revision: https://reviews.freebsd.org/D8809


# 2b4da8aa 24-Sep-2016 Marcel Moolenaar <marcel@FreeBSD.org>

When MAKEOBJDIRPREFIX points to a case-insensitive file system, the
build can break when different source files create the same target
files (case-insensitivity speaking). This is the case for object
files compiled with -fpic and shared libraries. The former uses
an extension of ".So", and the latter an extension ".so". Rename
shared object files from *.So to *.pico to match what NetBSD does.

See also r305855

MFC after: 1 month
Sponsored by: Bracket Computing
Differential Revision: https://reviews.freebsd.org/D7906


# c30c436a 23-Aug-2016 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Fix 'make all install' not properly rebuilding based on .depend.* files.

An optimization is in place to skip reading the .depend.* files with
'make install'. This was too strong and broke 'make all install' and
'make foo.o foo install'. Now only skip reading the dependency files
if all make targets ran are install targets.

The problem comes about because headers are only added in as a guessed
dependency if .depend.* files do not yet exist. If they do exist, even
if being skipped from being read, then the header dependencies are not
applied. This applies to all #included files, and not just headers.

Reported by: kib
MFC after: 1 day
Sponsored by: EMC / Isilon Storage Division


# 786c8050 12-Aug-2016 Bryan Drewery <bdrewery@FreeBSD.org>

PORTS_MODULES: Don't leak in CC/CXX/CPP.

These may have ccache in them or -target/--sysroot from external
compiler or SYSTEM_COMPILER support. Many ports do not support
a CC with spaces in it, such as emulators/virtualbox-ose-kmod.
Passing --sysroot to ports makes no sense as ports doesn't support
--sysroot currently.
If these variables need to be overridden for ports then they can
be set in make.conf or passed as make arguments.

MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division


# 799483e4 21-Jun-2016 Bryan Drewery <bdrewery@FreeBSD.org>

META_MODE: Don't generate or read _EXTRADEPEND dependencies when using filemon.

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


# c155decc 15-Jun-2016 Bryan Drewery <bdrewery@FreeBSD.org>

WITH_META_MODE: Do include headers for specific guessed dependencies

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


# ad8874fd 10-Jun-2016 Jonathan T. Looney <jtl@FreeBSD.org>

Change the default build behavior so we don't compile extra TCP modules by
default. At least initially, the feature to support multiple TCP stacks is
aimed at supporting advanced use cases and TCP development, but it is not
necessarily aimed at a wide audience. Therefore, there is no need to build
and install the extra TCP stacks by default. Instead, the people who are
using or developing this functionality can add the extra option to build/
install the extra TCP stacks.

However, we do want to build the extra TCP stacks as part of test builds
(e.g. LINT or tinderbox) to ensure that developers who are testing their
changes will know that their changes do not break the additional TCP
stack modules.

After this change, a user will need to add WITH_EXTRA_TCP_STACKS=1 to
make.conf or the kernel config in order to build the extra TCP modules.

Differential Revision: https://reviews.freebsd.org/D6795
Reviewed by: sjg
Approved by: re (kib)


# 5852ae2d 03-Jun-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Revert r301079.

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.


# 292c5292 31-May-2016 Bryan Drewery <bdrewery@FreeBSD.org>

WITH_META_MDE: Fix machine/include and x86/include issues.

- Fixes 'ln: File exists' errors.
- Fixes creating include directories in the source directory as well.

Sponsored by: EMC / Isilon Storage Division


# 2dcffa9c 31-May-2016 Bryan Drewery <bdrewery@FreeBSD.org>

WITH_META_MODE: Resolve SYSDIR to avoid changed build commands.

Sponsored by: EMC / Isilon Storage Division


# 28849c57 31-May-2016 Bryan Drewery <bdrewery@FreeBSD.org>

WITH_META_MODE: Mitigate switching from without to with META_MODE.

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


# 49773547 26-May-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Add some missing .PHONY.

These are relevant for WITH_META_MODE to ensure they are
always reran and don't generate a .meta file.

Sponsored by: EMC / Isilon Storage Division


# 3b828e44 20-May-2016 Bryan Drewery <bdrewery@FreeBSD.org>

WITH_META_MODE: Fix suffix transformation rules with guessed dependencies.

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


# 1782ba0c 20-Apr-2016 Wojciech Macek <wma@FreeBSD.org>

Revert r298357

Revert workaround fixed by r298361


# 7ffae6f2 20-Apr-2016 Ed Maste <emaste@FreeBSD.org>

Update comment added in r298357

The additional regex replacements are actully required due to an
elfcopy bug which is now fixed (by r298361), not a Clang/GCC issue.

Sponsored by: The FreeBSD Foundation


# fb9c3478 20-Apr-2016 Wojciech Macek <wma@FreeBSD.org>

Fix MFS symbol redefinition with clang 3.8.0

Newest CLANG objcpy uses different name parsing.
Modify regexp to match (i.e. avoid substitution
of "/" or "-" with "_").

Obtained from: Semihalf
Sponsored by: Juniper Networks
Reviewed by: hselasky, zbb
Differential Revision: https://reviews.freebsd.org/D5873


# d7296a8f 14-Apr-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Implement the dependency condition more safely.

Nested : are not handled well without "".

Sponsored by: EMC / Isilon Storage Division


# 497e8091 30-Mar-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Remove the old depend (mkdep) code and make FAST_DEPEND the one true way.

Reviewed by: emaste, hselasky (partial), brooks (brief)
Discussed on: arch@
Sponsored by: EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D5742


# e32a2cbe 10-Mar-2016 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Use .dinclude to enable full .depend logic in bmake.

The inclusion of .MAKE.DEPENDFILE (.depend) has special logic in make
to ignore stale/missing dependencies. bmake 20160220 added a '.dinclude'
directive that uses the special logic for .depend when including the file.

This fixes a build error when a file is moved or deleted that exists in a
.depend.OBJ file. This happened in r292782 when sha512c.c "moved" and an
incremental build of lib/libmd would fail with:
make: don't know how to make /usr/src/lib/libcrypt/../libmd/sha512c.c. Stop

Now this will just be seen as a stale dependency and cause a rebuild:
make: /usr/obj/usr/src/lib/libmd/.depend.sha512c.o, 13: ignoring stale .depend for /usr/src/lib/libcrypt/../libmd/sha512c.c
--- sha512c.o ---
...
This rebuild will only be done once since the .depend.sha512c.o will
be updated on the build with the -MF flags.

This also removes -MP being passed for the .depend.OBJ generation (which
would create fake targets for system headers) since the logic is no
longer needed to protect from missing files.

Sponsored by: EMC / Isilon Storage Division


# e9508dc2 29-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Prefer .OBJDIR depend files.

Sponsored by: EMC / Isilon Storage Division


# cba0af0a 24-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Remove hack from r2408 that is no longer needed.

Sponsored by: EMC / Isilon Storage Division


# b9cd412e 24-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Always run depend via beforebuild which removes many hacks.

This will generate dependencies rather than depending on the previous behavior
of depending on the guessed OBJS: *.h dependecies or a user running
'make depend'.

Experimentation showed that depending only on headers was not enough and
prone to .ORDER errors. Downstream users may also have added
dependencies into beforedepend or afterdepend targets. The safest way to
ensure dependencies are generated before build is to run 'make depend'
beforehand rather than just depending on DPSRCS+SRCS.

Note that the OBJS_DEPEND_GUESS mechanism (a.k.a .if !exists(.depend) then
foo.o: *.h) is still useful as it improves incremental builds with missing
.depend.* files and allows 'make foo.o' to usually work, while this
'beforebuild: depend' ensures that the build will always find all dependencies.
The 'make foo.o' case has no means of a 'beforebuild' hook.

This also removes several hacks in the DIRDEPS_BUILD:
- NO_INSTALL_INCLUDES is no longer needed as it mostly was to work around
.ORDER problems with building the needed headers early.
- DIRDEPS_BUILD: It is no longer necesarry to track "local dependencies" in
Makefile.depend.

These were only in Makefile.depend for 'clean builds' since nothing would
generate the files due to skipping 'make depend' and early dependency
bugs that have been fixed, such as adding headers into SRCS for the
OBJS_DEPEND_GUESS mechanism. Normally if a .depend file does not exist then
a dependency is added by bsd.lib.mk/bsd.prog.mk from OBJS: *.h. However,
meta.autodep.mk creates a .depend file from created meta files and inserts
that into Makefile.depend. It also only tracks *.[ch] files though which can
miss some dependencies that are hooked into 'make depend'. This .depend
that is created then breaks incremental builds due to the !exists(.depend)
checks for OBJS_DEPEND_GUESS. The goal was to skip 'make depend' yet it only
really works the first time. After that files are not generated as expected,
which r288966 tried to address but was using buildfiles: rather than
beforebuild: and was reverted in r291725. As noted previously,
depending only on headers in beforebuild: would create .ORDER errors
in some cases.

meta.autodep.mk is still used to generate Makefile.depend though via:
gendirdeps: Makefile.depend
.END: gendirdeps

This commit allows removing all of the "local dependencies" in
Makefile.depend which cuts down on churn and removes some of the
arch-dependent Makefile.depend files.

The "local dependencies" were also problematic for bootstrapping.

Sponsored by: EMC / Isilon Storage Division


# 70ca9ec4 24-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Hook the meta/nofilemon build into using FAST_DEPEND.

FAST_DEPEND is intended to be the "skip 'make depend' and mkdep"
feature. Since DIRDEPS_BUILD does this already with some of its own
hacks, and filemon doesn't need this, and nofilemon does, teach it how
to handle each of these cases.

In meta+filemon mode filemon will handle dependencies itself via the
meta mode logic in bmake. We still want to set MK_FAST_DEPEND=yes to
enable some logic that indicates that 'make depend' is skipped in the
traditional sense. The actual .depend.* files will be skipped.

When nofilemon is set though we still need to track and generate dependencies.

Sponsored by: EMC / Isilon Storage Division


# 68add213 24-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Don't waste time generating an empty .depend file.

The .depend file will still be generated if _EXTRADEPEND is used. The target
is kept with a dependency on DPSRCS though so that 'make depend' will generate
all files.

Sponsored by: EMC / Isilon Storage Division


# d7beff08 24-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Rework how guessed dependencies are handled.

Rather than depend on .depend not existing, check the actual
.depend.OBJ file that will be used for that object. If it doesn't
exist then use the guessed dependencies.

FAST_DEPEND may never have a .depend file. Not having one means all of the
previous logic would over-depend all object files on all headers which is not
what we wanted. It also means that if a .depend is generated before a build
is done for _EXTRADEPEND (such as for PROG or LIB) then all of these
dependencies would not be used since the .depend wasn't generated from mkdep
and the real .depend.* files are not generated until the build.

Sponsored by: EMC / Isilon Storage Division


# cc666701 24-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Support beforebuild in the kernel.

Sponsored by: EMC / Isilon Storage Division


# 590363ef 22-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Always remove .depend.* in case switching between FAST_DEPEND on/off.

This was missed in r295666.

Sponsored by: EMC / Isilon Storage Division


# f84e07cb 18-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Apply conditional -MF from r291945 to kernel as well.

Sponsored by: EMC / Isilon Storage Division


# 9fb02a70 18-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Avoid reading .depend.* in simple cases where not needed.

This will speed up some tree-walks with FAST_DEPEND which otherwise
would include length(SRCS) .depend files.

This also uses a trick suggested by sjg@ to still read them in when
specifying _V_READ_DEPEND=1 in the env/make args.

Sponsored by: EMC / Isilon Storage Division


# 58bcfe41 15-Feb-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Use built-in :tA here rather than realpath(1).

Sponsored by: EMC / Isilon Storage Division


# f4c1f0b9 02-Feb-2016 Adrian Chadd <adrian@FreeBSD.org>

Fix MFS builds when both MD_ROOT_SIZE and MFS_IMAGE are specified

MD_ROOT_SIZE and embed_mfs.sh were basically retired as part of
https://reviews.freebsd.org/D2903 .
However, when building a kernel with 'options MD_ROOT_SIZE' specified, this
results in a non-working MFS, as within sys/dev/md/md.c we fall within the
wrong # ifdef.

This patch implements the following:

* Allow kernels to be built without the MD_ROOT_SIZE option, which results
in a kernel built as per D2903.
* Allow kernels to be built with the MD_ROOT_SIZE option, which results
in a kernel built similarly to the pre-D2903 way, with the following
differences:
* The MFS is now put in a separate section within the kernel (oldmfs,
so it differs from the mfs section introduced by D2903).
* embed_mfs.sh is changed, so it looks up the oldmfs section within the
kernel, gets its size and offset, sees if the MFS will fit within the
allocated oldmfs section and only if all is well does a dd of the MFS
image into the kernel.

Submitted by: Stanislav Galabov <sgalabov@gmail.com>
Reviewed by: brooks, imp
Differential Revision: https://reviews.freebsd.org/D5093


# a5694b65 27-Jan-2016 Hans Petter Selasky <hselasky@FreeBSD.org>

Fix generation of dependency rules for the LinuxKPI, the MLX5 driver
and all of OFED except MLX4[EN/IB].

Sponsored by: Mellanox Technologies
MFC after: 1 week


# 39818ec6 26-Jan-2016 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Apply missed nofilemon fix from r294351.

Sponsored by: EMC / Isilon Storage Division


# dd076b93 15-Jan-2016 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Fix incremental builds leading to kernel panics.

This fixes .depend.genassym.o not being included. genassym.o depends on
all of the system headers and when rebuilt regenerates assym.s which
lists offsets for critial .S files to utilize. By having a struct in a
system header change its offsets and not have generassym.o be rebuilt,
this would lead to panics.

The flaw in the initial commit was seeing ${OBJS} in ${SYSTEM_OBJS} and
assuming it had all of ${SRCS} in it. This is not the case though. The
older mkdep code splits out all of the various SRC lists for generating
the .depend file. It also includes ${GEN_CFILES}, which had genassym.c
and was the only significant file lacking from ${SYSTEM_OBJS} upon inspection,
since it is not linked in. Rather than duplicate the likely
soon-to-be-removed mkdep lists, just add genassym.o to the DEPENDOBJS
list. Using ${SRCS} as bsd.dep.mk does would be nice but there are many
files in the build that are only added to ${OBJS} and not ${SRCS}, such
as bf_enc.o derived from bf_enc.S for i386.

Sponsored by: EMC / Isilon Storage Division
Reported by: dhw (several panics on current@)
Pointyhat to: bdrewery


# 9f286e82 15-Jan-2016 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Rework optimization for r290524.

The .MAKEFLAGS check inside of the .for loop is extremely slow for some
reason. Just moving it out of the loop trimmed -V lookup time from 11
seconds to 1 second in the kernel obj directory.

Sponsored by: EMC / Isilon Storage Division


# 9160419c 07-Nov-2015 Bryan Drewery <bdrewery@FreeBSD.org>

Add built-in ccache build support via WITH_CCACHE_BUILD option.

ccache is mostly beneficial for frequent builds where -DNO_CLEAN is not
used to achieve a safe pseudo-incremental build. This is explained in
more detail upstream [1] [2]. It incurs about a 20%-28% hit to populate the
cache, but with a full cache saves 30-50% in build times. When combined with
the WITH_FAST_DEPEND feature it saves up to 65% since ccache does cache the
resulting dependency file, which it does not do when using mkdep(1)/'CC
-E'. Stats are provided at the end of this message.

This removes the need to modify /etc/make.conf with the CC:= and CXX:=
lines which conflicted with external compiler support [3] (causing the
bootstrap compiler to not be built which lead to obscure failures [4]),
incorrectly invoked ccache in various stages, required CCACHE_CPP2 to avoid
Clang errors with parenthesis, and did not work with META_MODE.

The option name was picked to match the existing option in ports. This
feature is available for both in-src and out-of-src builds that use
/usr/share/mk.

Linking, assembly compiles, and pre-processing avoid using ccache since it is
only overhead. ccache does nothing special in these modes, although there is
no harm in calling it for them.

CCACHE_COMPILERCHECK is set to 'content' when using the in-tree bootstrap
compiler to hash the content of the compiler binary to determine if it
should be a cache miss. For external compilers the 'mtime' option is used
as it is more efficient and likely to be correct. Future work may optimize the
'content' check using the same checks as whether a bootstrap compiler is needed
to be built.

The CCACHE_CPP2 pessimization is currently default in our devel/ccache
port due to Clang requiring it. Clang's -Wparentheses-equality,
-Wtautological-compare, and -Wself-assign warnings do not mix well with
compiling already-pre-processed code that may have expanded macros that
trigger the warnings. GCC has so far not had this issue so it is allowed to
disable the CCACHE_CPP2 default in our port.

Sharing a cache between multiple checkouts, or systems, is explained in
the ccache manual. Sharing a cache over NFS would likely not be worth
it, but syncing cache directories between systems may be useful for an
organization. There is also a memcached backend available [5]. Due to using
an object directory outside of the source directory though you will need to
ensure that both are in the same prefix and all users use the same layout. A
possible working layout is as follows:
Source: /some/prefix/src1
Source: /some/prefix/src2
Source: /some/prefix/src3
Objdir: /some/prefix/obj
Environment: CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj'
This will use src*/../obj as the MAKEOBJDIRPREFIX and tells ccache to replace
all absolute paths to be relative. Using something like this is required due
to -I and -o flags containing both SRC and OBJDIR absolute paths that ccache
adds into its hash for the object without CCACHE_BASEDIR.

distcc can be hooked into by setting CCACHE_PREFIX=/usr/local/bin/distcc.
I have not personally tested this and assume it will not mix well with
using the bootstrap compiler.

The cache from buildworld can be reused in a subdir by first running
'make buildenv' (from r290424).

Note that the cache is currently different depending on whether -j is
used or not due to ccache enabling -fdiagnostics-color automatically if
stderr is a TTY, which bmake only does if not using -j.

The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_CCACHE_BUILD=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files and ccache objects.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16

The WITH_FAST_DEPEND feature was used for comparison here as well to show
the dramatic time savings with a full cache.

buildworld:
x buildworld-before
+ buildworld-ccache-empty
* buildworld-ccache-full
% buildworld-ccache-full-fastdep
# buildworld-fastdep
+-------------------------------------------------------------------------------+
|% * # +|
|% * # +|
|% * # xxx +|
| |A |
| A|
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 4519 4525.04 4520.73 4521.59 3.1104823
Difference at 95.0% confidence
758.027 +/- 43.4565
20.1412% +/- 1.15466%
(Student's t, pooled s = 19.1726)
* 3 1823.08 1827.2 1825.62 1825.3 2.0785572
Difference at 95.0% confidence
-1938.26 +/- 43.298
-51.5007% +/- 1.15045%
(Student's t, pooled s = 19.1026)
% 3 1266.96 1279.37 1270.47 1272.2667 6.3971113
Difference at 95.0% confidence
-2491.3 +/- 44.3704
-66.1952% +/- 1.17895%
(Student's t, pooled s = 19.5758)
# 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)

buildkernel:
x buildkernel-before
+ buildkernel-ccache-empty
* buildkernel-ccache-empty-fastdep
% buildkernel-ccache-full
# buildkernel-ccache-full-fastdep
@ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|# @ % * |
|# @ % * x + |
|# @ % * xx ++|
| MA |
| MA|
| A |
| A |
|A |
| A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 727.97 731.91 728.06 729.31333 2.2492295
Difference at 95.0% confidence
156.88 +/- 4.17129
27.4058% +/- 0.728695%
(Student's t, pooled s = 1.84034)
* 3 527.1 528.29 528.08 527.82333 0.63516402
Difference at 95.0% confidence
-44.61 +/- 2.33254
-7.79305% +/- 0.407478%
(Student's t, pooled s = 1.02909)
% 3 400.4 401.05 400.62 400.69 0.3306055
Difference at 95.0% confidence
-171.743 +/- 2.16453
-30.0023% +/- 0.378128%
(Student's t, pooled s = 0.954969)
# 3 201.94 203.34 202.28 202.52 0.73020545
Difference at 95.0% confidence
-369.913 +/- 2.40293
-64.6212% +/- 0.419774%
(Student's t, pooled s = 1.06015)
@ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)

[1] https://ccache.samba.org/performance.html
[2] http://www.mail-archive.com/ccache@lists.samba.org/msg00576.html
[3] https://reviews.freebsd.org/D3484
[5] https://github.com/jrosdahl/ccache/pull/30

PR: 182944 [4]
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
Relnotes: yes


# dbced32a 07-Nov-2015 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Don't enable when .MAKE.MODE=meta.

This is because the .meta files generated from filemon already contain a
list of all files read to generate the object.

X-MFC-With: r290433
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division


# 3cccdc9d 07-Nov-2015 Bryan Drewery <bdrewery@FreeBSD.org>

FAST_DEPEND: Don't include depend files when using 'make -V'.

This is especially noticeable in the kernel obj directory since it
includes so many files.

X-MFC-With: r290433
MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division


# cf1eeb33 05-Nov-2015 Bryan Drewery <bdrewery@FreeBSD.org>

Add a FAST_DEPEND option, off by default, which speeds up the build significantly.

This speeds up buildworld by 16% on my system and buildkernel by 35%.

Rather than calling mkdep(1), which is just a wrapper around 'cc -E',
use the modern -MD -MT -MF flags to gather and generate dependencies during
compilation. This flag was introduced in GCC "a long time ago", in GCC 3.0,
and is also supported by Clang. (It appears that ICC also supports this but I
do not have access to test it). This avoids running the preprocessor *twice*
for every build, in both 'make depend' and 'make all'. This is especially
noticeable when using ccache since it does not cache preprocessor results from
mkdep(1) / 'cc -E', but still speeds up compilation with the -MD flags.

For 'make depend' a tree-walk is still done to ensure that all DPSRCS
are generated when expected, and that beforedepend/afterdepend and
_EXTRADEPEND are all still respected. In time this may change but for now
I've been conservative. The time for a tree-walk with -j combined with
SUBDIR_PARALLEL is not significant. For example, it takes about 9 seconds
with -j15 to walk all of src/ for 'make depend' now on my system.

A .depend file is still generated with the various rules that apply to
the final target, or custom rules. Otherwise there are now
per-built-object-file .depend files, such as .depend.filename.o. These
are included directly by make rather than populating .depend with a loop
and .depend lines, which only added overhead to the now almost-NOP 'make
depend' phase.

Before this I experimented with having mkdep(1) called in parallel per-file.
While this improved the kernel and lib/libc 'make depend' phase, it resulted
in slower build times overall.

The -M flags are removed from CFLAGS when linking since they have no effect.

Enabling this by default, for src or out-of-src, can be done once more testing
has been done, such as a ports exp-run, and with more compilers.

The system I used for testing was:
WITNESS
Build options: -j20 WITH_LLDB=yes WITH_DEBUG_FILES=yes WITH_FAST_DEPEND=yes
DISK: ZFS 3-way mirror with very slow disks using SSD l2arc/log.
The arc was fully populated with src tree files.
RAM: 76GiB
CPU: Intel(R) Xeon(R) CPU L5520 @2.27GHz
2 package(s) x 4 core(s) x 2 SMT threads = hw.ncpu=16

buildworld:
x buildworld-before
+ buildworld-fastdep
+-------------------------------------------------------------------------------+
|+ |
|+ |
|+ xx x|
| |_MA___||
|A |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 3744.13 3794.31 3752.25 3763.5633 26.935139
+ 3 3153.34 3155.16 3154.2 3154.2333 0.91045776
Difference at 95.0% confidence
-609.33 +/- 43.1943
-16.1902% +/- 1.1477%
(Student's t, pooled s = 19.0569)

buildkernel:
x buildkernel-before
+ buildkernel-fastdep
+-------------------------------------------------------------------------------+
|+ x |
|++ xx|
| A||
|A| |
+-------------------------------------------------------------------------------+
N Min Max Median Avg Stddev
x 3 571.57 573.94 571.79 572.43333 1.3094401
+ 3 369.12 370.57 369.3 369.66333 0.79033748
Difference at 95.0% confidence
-202.77 +/- 2.45131
-35.4225% +/- 0.428227%
(Student's t, pooled s = 1.0815)

Sponsored by: EMC / Isilon Storage Division
MFC after: 3 weeks
Relnotes: yes


# 0ed70e42 16-Oct-2015 Bryan Drewery <bdrewery@FreeBSD.org>

Do as r289391 did for share/mk and make installing to a non-existent directory
an error.

Most of these do a 'mkdir -p' or 'install -d' before installing, but add
the trailing / here for consistency with the userland install.

MFC after: 2 weeks
X-MFC-With: r289391
Sponsored by: EMC / Isilon Storage Division


# 8598392c 08-Oct-2015 Konstantin Belousov <kib@FreeBSD.org>

Build changes that allow the modules on arm64.
- Move the required kernel compiler flags from Makefile.arm64 to kern.mk.
- Build arm64 modules as PIC; non-PIC relocations in .o for shared object
output cannot be handled.
- Do not try to install aarch64 symlink.
- A hack for arm64 to avoid ld -r stage. See the comment for the explanation.
Some functionality is lost, like ctf handling, but hopefully will be
restored after newer linker is available.

Reviewed by: andrew, emaste
Tested by: andrew (on real hardware)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3796


# 05117b57 24-Sep-2015 Ed Maste <emaste@FreeBSD.org>

Install kernel debug data under /usr/lib/debug

This avoids needing a large boot partition / file system in order to
accommodate multiple kernels, and provides consistency with userland
debug. This also simplifies the process of moving kernel debug files
to a separate package and installing them on demand.

In addition, change kernel debug file extension to .debug, to match
userland debug files.

When using the supported kernel installation method the
/usr/lib/debug/boot/kernel directory will be renamed (to kernel.old)
as is done with /boot/kernel.

Developers wishing to maintain the historical behavior of installing
debug files in /boot/kernel/ can set KERN_DEBUGDIR="" in src.conf(5).

Reviewed by: bdrewery, brooks, imp, markj
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D1006


# 1558258b 14-Aug-2015 Rui Paulo <rpaulo@FreeBSD.org>

sys/conf: pass NMFLAGS to nm(1) via genassym.sh.


# cc787e3d 13-Aug-2015 Marcel Moolenaar <marcel@FreeBSD.org>

Change md(4) to use weak symbols as start, end and size for the embedded
root disk. The embedded image is linked into the kernel in the .mfs
section.

Add rules and variables to kern.pre.mk and kern.post.mk that handle the
linking of the image. First objcopy is used to generate an object file.
Then, the object file is linked into the kernel.

Submitted by: Steve Kiernan <stevek@juniper.net>
Reviewed by: brooks@
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D2903


# 4f4d15f0 10-Jun-2015 Ruslan Bukin <br@FreeBSD.org>

Allow DTrace to be compiled-in to the kernel.
This will require for AArch64 as we dont have modules yet.

Sponsored by: HEIF5
Sponsored by: ARM Ltd.
Differential Revision: https://reviews.freebsd.org/D1997


# 02dce74d 08-Feb-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Tag the mtree with the targets of the packages:

release tag will be the regular kernel
debug tag is for debug symbols


# a0a67cf0 12-Aug-2014 Warner Losh <imp@FreeBSD.org>

Truncate the ctfmerge command line, like we do with SYSTEM_LD.


# 3d2bc9e8 14-Aug-2013 Simon J. Gerraty <sjg@FreeBSD.org>

Some objects - such as *_genassym.o are not hooked into
SRCS OBJS or anything else, yet have a dependency on symlinks
such as machine/

Reviewed by: obrien


# 7e527d6d 24-Oct-2012 Warner Losh <imp@FreeBSD.org>

Remove the links: target. It too is homelessly outdated since it
relies on the outdated defines list. It likely hasn't been useful in
15 years, and certainly not in the last decade.


# 7750ad47 22-Aug-2012 Marcel Moolenaar <marcel@FreeBSD.org>

Sync FreeBSD's bmake branch with Juniper's internal bmake branch.

Requested by: Simon Gerraty <sjg@juniper.net>


# 12a14de0 06-Aug-2012 Brooks Davis <brooks@FreeBSD.org>

MFP4 change 214967:
Make the process of embedding MDROOT images less perilous by
makeing the target that links kernel and embedding the image
depend on the image. This means, if the image doesn't exist you
find out before you try to boot from it and that if you change
the image you don't have to touch some random source file to
cause a rebuild.

Don't hide that we're embedding the image.


# cd95660f 02-Jul-2012 David E. O'Brien <obrien@FreeBSD.org>

Revert r222186 per instructions for FreeBSD 10.
(a 10-CURRENT share/mk is already required to build a 10-CURRENT kernel
on 9-STABLE)


# 1e8e2a9d 02-Jul-2012 Doug Barton <dougb@FreeBSD.org>

Unfortunately the change in r237958 resulted in s/install/instclean/ due to
the aggressive pattern matching of the :C modifier. I tested build and
install in 2 phases, however with different solutions, resulting in the
breakage. Mea culpa.

The solution is to break out the all: target. This causes a few lines of
code duplication, but now the all: target works as it should, and the
other targets continue to work as they did before.

While I'm here, add a ===> header line to the start of each port build
to make it easier to find/more clear in the logs.


# cea039da 02-Jul-2012 Doug Barton <dougb@FreeBSD.org>

For the ports modules building code, clean WRKDIR before building. This is
important for those that use -DNO_CLEAN routinely, since it will prevent
installing stale stuff, and even more important when the port is upgraded
to a newer version. When the user doesn't use -DNO_CLEAN, this will create
an infinitesimal amount of extra work, but won't hurt anything.

This is necessary because the ports tree has flags that prevent the ususal
'update the build if newer source files exist' logic from doing what it
would do in the base.


# 24a5cfd2 14-Jun-2012 Doug Barton <dougb@FreeBSD.org>

Improve the functionality of the PORTS_MODULES knob by adding
LOCALBASE/bin and sbin to PATH, allowing dependencies to be found;
adding SRC_BASE and OSVERSION to match the new kernel, and putting
the related builds under MAKEOBJDIRPREFIX so that they only need
to be built once per kernel.

In addition to the PR this includes ideas/contributions from crees
and matthew.

PR: ports/161452
Submitted by: Garrett Cooper <yanegomi@gmail.com>


# 88c7c434 27-Mar-2012 Peter Wemm <peter@FreeBSD.org>

Allow (with a license warning) "options ZFS" to work in static kernels.

The 'make depend' rules have to use custom -I paths for the special compat
includes for the opensolaris/zfs headers.

This option will pull in the couple of files that are shared with dtrace,
but they appear to correctly use the MODULE_VERSION/MODULE_DEPEND rules
so loader should do the right thing, as should kldload.

Reviewed by: pjd (glanced at)


# 83cb5bae 30-Nov-2011 Max Khon <fjoe@FreeBSD.org>

- CTF knob is now implemented using common scheme: MK_CTF=yes/no is
defined based on WITH/WITHOUT_CTF settings, default is WITHOUT_CTF,
NO_CTF overrides WITH_CTF (used by Makefile.inc1)
- CTFCONVERT_CMD/NORMAL_CTFCONVERT are now defined to empty string
if make(1) can handle empty commands


# 78e7e3ec 29-Nov-2011 Max Khon <fjoe@FreeBSD.org>

- fix WITH_CTF when specified in /etc/src.conf [1]
- CTFCONVERT_CMD=... is a hack (should be defined to empty string instead):
make(1) should be taught to ignore empty commands silently in compat mode
(as it does in !compat mode, GNU make also silently ignores empty commands)
and to skip printing empty commands in !compat mode
- config(8) should generate ${NORMAL_CTFCONVERT} invocation without '@':
this will allow to simplify kern.pre.mk even more and lessen the number
of shell invocations during kernel build when CTF is turned off
- WITH_CTF can now be converted to usual MK_CTF=yes/no infrastructure

Pointy hat to: fjoe [1]


# cd49c2e8 29-Nov-2011 Max Khon <fjoe@FreeBSD.org>

Conditionalize ctfconvert/ctfmerge runs on make level (.if/.endif) instead
of executing a shell on every object or executable/library file.

This shaves off more than 30,000 shell invocations during buildworld.


# ff239280 23-May-2011 Warner Losh <imp@FreeBSD.org>

Test against "no" rather than "yes" for MK_KERNEL_SYMBOLS
Also, change DEBUG back to DEBUG_FLAGS in kmod.mk. The latter accidentally
snuck in with my backwards compat fix.

Submitted by: ru,gcooper


# adcdcb73 22-May-2011 Warner Losh <imp@FreeBSD.org>

Backwards compatibility hacks to allow kernels to be built via config
wihtout updating world (good transition aide for -current, but also
allows kernels to be built on -stable the old way too). This likely
should go away around FreeBSD 10.0 or so.


# d380e0d2 22-May-2011 Warner Losh <imp@FreeBSD.org>

Start to usher INSTALL_NODEBUG hack out the door. Add new
WITH{OUT,}_KERNEL_SYMBOLS (defaulting to WITH). In the fullness of
time, likely around 2020, INSTALL_NODEBUG will be removed. For now,
don't print a warning when using INSTALL_NODEBUG, but that will be
coming soon.


# 544de89d 01-Nov-2010 John Baldwin <jhb@FreeBSD.org>

Add an x86/include directory to the kernel to hold headers that are common
to amd64, i386, and pc98. The headers are installed to /usr/include/x86
during an installworld, and an 'x86' symlink is created for kernel builds
similar to 'machine' so that the headers can be included as <x86/foo.h>.

Reviewed by: imp


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 25faff34 23-Aug-2010 Warner Losh <imp@FreeBSD.org>

MFtbemd:

Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.


# 915b4b09 13-Jul-2010 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Convert several instances of MACHINE_ARCH to MACHINE_CPUARCH and use the
correct compiler flags on 64-bit PowerPC.


# 21edb039 02-Apr-2010 Alexander Leidinger <netchild@FreeBSD.org>

WITH_CTF can now be specified in src.conf (not recommended, there
are some problems with static executables), make.conf (would also
affect ports which do not use GNU make and do not override the
compile targets) or in the kernel config (via "makeoptions
WITH_CTF=yes").

Additional (related) changes:
- propagate WITH_CTF to module builds
- do not add -g to the linker flags, it's a noop there anyway
(at least according to the man page of ld)
- do not add -g to CFLAGS unconditionally
we need to have a look if it is really needed (IMO not) or if there
is a way to add it only when WITH_CTF is used

Note: ctfconvert / ctfmerge lines will not appear in the build output,
to protect the innocent (those which do not build with WITH_CTF would
see the shell-test and may think WITH_CTF is used).

Reviewed by: imp, jhb, scottl (earlier version)
Discussed on: arch@


# 62769330 25-Mar-2010 Alexander Leidinger <netchild@FreeBSD.org>

Propagate CONF_CFLAGS (from makeoptions) to the module build too.

Discussed with: jhb (on arch@)


# 8859442e 04-May-2009 John Baldwin <jhb@FreeBSD.org>

Always compute the root of the kernel source tree and explicitly pass it
to module builds. This avoids having to have the module builds walk up
the tree to find the kernel sources. It also allows a kernel + module
build to succeed when a new level of module subdirectories is added without
requiring that the /usr/share/mk/bsd.kmod.mk file on the machine be patched.

MFC after: 1 week


# b63fbf28 07-Jan-2009 Bjoern A. Zeeb <bz@FreeBSD.org>

Using KMODOWN/KMODGRP rather than hard coding root/wheel for
installing the kernel allows one, like with modules, to override
the default user/group and install as non-su to a temporary
directory to test, create images or seed a tftp dir.

Reviewed by: Andrzej Tobola <ato@iem.pw.edu.pl>
MFC after: 4 weeks


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 3a877a1d 05-Jul-2008 John Birrell <jb@FreeBSD.org>

Add CTF conversion to the objects compiled from generated code.
This allows DTrace scripts to access variables like 'ostype'.


# ef74ab5a 22-May-2008 John Birrell <jb@FreeBSD.org>

Add support for generating CTF data for the kernel.


# fcfdd827 05-Feb-2008 Rafal Jaworowski <raj@FreeBSD.org>

Introduce a standalone shell script for embedding MFS image.

This allows to fix a problem with ARM kernel.bin not having the MFS image
embedded: it is objcopied from the kernel.noheader temporary ELF file, which
was not subject to embedding the MFS image previously.

Reviewed by: imp
Approved by: cognet (mentor)


# 92d0be02 23-Mar-2007 Warner Losh <imp@FreeBSD.org>

If KERNEL_EXTRA is defined, make kernel-all target depend on it.
If KERNEL_EXTRA_INSTALL is defined, install it into ${DESTDIR}${KODIR}.


# 83616b3a 30-Dec-2006 John-Mark Gurney <jmg@FreeBSD.org>

now that MFS_IMAGE is in the FULLKERNEL section, use FULLKERNEL instead of
KERNEL_KO, this fixes MFS_IMAGE on a debugging kernel...

Submitted by: Neelkanth Natu


# a10892b0 26-Oct-2006 Ruslan Ermilov <ru@FreeBSD.org>

MF kmod.mk 1.176: Properly handle vnode_if.h dependencies.

Instructed by: bde


# 74465532 13-Oct-2006 Ruslan Ermilov <ru@FreeBSD.org>

- Remove include links only when .depend is also removed, so that
"make depend; make clean; make -n" works.

- Preseve kernel's .depend if it already exists and its creation
is interrupted.

Reported/reviewed by: bde


# 8b3ae668 14-Aug-2006 Dag-Erling Smørgrav <des@FreeBSD.org>

Don't use touch when what is really meant is :> (create an empty file, or
truncate it if it exists) or :>> (ensure the file exists, but don't change
it if it already does)

Reviewed by: ru
MFC after: 2 weeks


# f36c2bbe 18-Jun-2006 Warner Losh <imp@FreeBSD.org>

Remove the insistance on having a device.hints. This was a seat belt
for those upgrading from 4.x -> 5.x. It is therefore no longer
necessary because it is installed on 5.x and 6.x and one has to
upgrade from 6.x -> current, or at the very least 5.x (although not
supported, it can be made to work).


# de5f056a 12-Jun-2006 Olivier Houchard <cognet@FreeBSD.org>

Handle MFS_IMAGE in the ${FULLKERNEL} target, so that we can build kernel
with MFS root without debugging.


# c53113c8 11-May-2006 John-Mark Gurney <jmg@FreeBSD.org>

add support for makeoptions MFS_IMAGE="<file>" in the config file which
will automaticly populate the kernel w/ the mfs image...


# ee439c43 07-Feb-2006 Ruslan Ermilov <ru@FreeBSD.org>

Remove .depend when doing "make cleandir".


# 150636ca 16-Jan-2006 Ruslan Ermilov <ru@FreeBSD.org>

I couldn't find any traces of what the tags1 file was supposed to do.


# a90232e1 30-Nov-2005 Ruslan Ermilov <ru@FreeBSD.org>

Teach this to create the "machine" and ${MACHINE_ARCH} (for pc98
only now) symbolic links in the kernel compile directory, rather
than relying on config(8) to do this. (The changes to config(8)
will be committed separately.) This is aimed towards making the
config(8) as lightweight as possible.

Idea by: bde (all bugs are mine)


# 1558abf6 27-Oct-2005 Ruslan Ermilov <ru@FreeBSD.org>

Rename the .dbg extension to .symbols, which matches "symbol-file"
gdb(1) command better, though I must admit it's confusing: these
files have not only [debugging] symbols, but much more than that.

Requested by: obrien


# bebb0521 27-Oct-2005 Ruslan Ermilov <ru@FreeBSD.org>

Use ${S} to pass ${SYSDIR} to ports. This makes PORTS_MODULES
feature work when compiling a kernel via "make buildkernel".

Noticed and tested by: nork


# 98b45a8f 27-Oct-2005 Ruslan Ermilov <ru@FreeBSD.org>

Installing debug modules was a bad idea -- I bogusly assumed that
our kernel linker will only load PT_LOAD segments, apparently not.
Instead, produce .dbg objects from .debug objects, and install
them together with non-debug objects, as described in objcopy(1).

Original code by: obrien


# d24864f7 25-Oct-2005 Ruslan Ermilov <ru@FreeBSD.org>

Refactor (some more) installation of kernel and module objects.

Try to make everyone happy: David (to have debug kernels installed
by default), Warner (to be able to override that), and myself (for
actually making it all work and to be consistent).

Now, if kernel was configured for debugging (through DEBUG=-g in
the kernel config file or "config -g"), doing "make install" will
install debug versions of kernel and module objects with their
canonical names,

kernel.debug -> /boot/kernel/kernel
if_fxp.ko.debug -> /boot/kernel/if_fxp.ko

Installing a kernel not configured for debugging, or debug kernel
with INSTALL_NODEBUG variable defined, will install non-debug
kernel and module objects.

Also, restore the install.debug and reinstall.debug targets that
are part of the existing API (they cause some additional gdb(1)
scripts to be installed).


# 697ca17b 24-Oct-2005 Warner Losh <imp@FreeBSD.org>

Back out most of 1.84. It was unwise to force debug kernels to always
be installed. It should have been optional to install a non-debug
one, just like it was formerly optional to install a debug one. In
order to do that, most of 1.84 had to go.

Instead, make installing the debug kernel the default, but create a
new option INSTALL_NODEBUG for those people that have small /
partitions and good source control habits.

This preserves the behavior of 1.84 while allowing it to be overriden
for people (like me) that do not have the time to upgrade to get a
bigger / and also don't have time for stupid makefile tricks when
upgrading their older system, but still want a kernel.debug around if
things go south.


# e319790c 10-Sep-2005 David E. O'Brien <obrien@FreeBSD.org>

For HEAD, install a kernel with debug information if DEBUG is a kernel
config option. It is too easy to loose the build directory and not have
symbols for kgdb to read.


# 9f74b222 08-Jun-2005 Warner Losh <imp@FreeBSD.org>

Don't build PORTS_MODULES if NO_MODULES is defined


# 5c25ebd5 05-Jun-2005 Maxime Henrion <mux@FreeBSD.org>

Install ports defined in PORTS_MODULES at make reinstall time too.

Reviewed by: imp


# 1afc807b 28-Apr-2005 Ruslan Ermilov <ru@FreeBSD.org>

Be resistant to DESTDIR being set to some unkosher value, e.g. "/".

Noticed by: Steve Ames


# 3365523e 22-Apr-2005 Ruslan Ermilov <ru@FreeBSD.org>

Clean all generated vnode_if* files.


# a13914f6 22-Apr-2005 Ruslan Ermilov <ru@FreeBSD.org>

Fix "make depend" to not redundantly rebuild the .depend file.

Reviewed by: bde (I think so)


# cfaacd7f 02-Apr-2005 Warner Losh <imp@FreeBSD.org>

Now that we have proper links, no need to fake up ones as part of
depend. Now that we no longer need this hack, remove it.

Forgotten by: imp
Reminded by: nyan


# 92daf6f9 29-Mar-2005 Poul-Henning Kamp <phk@FreeBSD.org>

Don't generate major.c anymore.


# f7479776 24-Feb-2005 Warner Losh <imp@FreeBSD.org>

Get SYSDIR set correctly for building ports.
On install, do deinstall reinstall


# c8f0f808 24-Feb-2005 Warner Losh <imp@FreeBSD.org>

use __target in preference to target


# aec0fb7b 01-Dec-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Back when VOP_* was introduced, we did not have new-style struct
initializations but we did have lofty goals and big ideals.

Adjust to more contemporary circumstances and gain type checking.

Replace the entire vop_t frobbing thing with properly typed
structures. The only casualty is that we can not add a new
VOP_ method with a loadable module. History has not given
us reason to belive this would ever be feasible in the the
first place.

Eliminate in toto VOCALL(), vop_t, VNODEOP_SET() etc.

Give coda correct prototypes and function definitions for
all vop_()s.

Generate a bit more data from the vnode_if.src file: a
struct vop_vector and protype typedefs for all vop methods.

Add a new vop_bypass() and make vop_default be a pointer
to another struct vop_vector.

Remove a lot of vfs_init since vop_vector is ready to use
from the compiler.

Cast various vop_mumble() to void * with uppercase name,
for instance VOP_PANIC, VOP_NULL etc.

Implement VCALL() by making vdesc_offset the offsetof() the
relevant function pointer in vop_vector. This is disgusting
but since the code is generated by a script comparatively
safe. The alternative for nullfs etc. would be much worse.

Fix up all vnode method vectors to remove casts so they
become typesafe. (The bulk of this is generated by scripts)


# 10695f3a 13-Nov-2004 Warner Losh <imp@FreeBSD.org>

Use PORTSDIR, falling back to /usr/ports


# 7e25cd95 12-Nov-2004 Ruslan Ermilov <ru@FreeBSD.org>

Ports aren't generally ready for parallel make.

Pointed by: Ben Mesander


# 1fd4bb62 11-Nov-2004 Warner Losh <imp@FreeBSD.org>

PORTS_MODULES: a list of ports to build with this kernel.

# I directly use the targets for building this, but it was suggested
# to use portupgrade. I couldn't fit that into the target model, so I
# punted.


# 08d0c00b 23-Sep-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Per recent HEADSUP: Disconnect (old)vinum from the kernel build.

Users should move to the new geom_vinum implementation instead.

The refcount logic which is being added to devices to enable safe module
unloading and the buf/vm work also in progress would require a major rework
of the (old)-vinum code to comply with the new semantics.

The actual source files will not be removed until I have coordinated with
the geomvinum people if they need any bits repo-copied etc.


# e8f7141e 17-Sep-2004 Ruslan Ermilov <ru@FreeBSD.org>

Pass the idea of the make(1) binary to use down to newvers.sh.
This is necessary so source upgrades use the correct binary.

MFC after: 3 days

For the record: Problem spotted by Scott Long, who mentioned
that source upgrades from 4.7 to recent 5.x and 6.0 are broken.
Detailed analysis shows that 4.7 has a broken make(1) binary.
A breakage was fixed in RELENG_4 in make/main.c,v 1.35.2.7 by
imp@, though the commit log erroneously stated "MFC 1.68"
while in fact it should have been spelled as "MFC 1.67".


# 6324e649 27-Jun-2004 Warner Losh <imp@FreeBSD.org>

We don't need GEN_M_CFILES. Fold it into GEN_CFILES definition and
adjust as necessary.

Suggested by: bde


# b53dd31a 26-Jun-2004 Warner Losh <imp@FreeBSD.org>

MFp4:

Now that the devs files are marked before-depend, we can remvoe them
from a few places they were explicitly mentioned (along with
BEFORE_DEPEND).

Noticed by: bde


# 0825532b 26-May-2004 Warner Losh <imp@FreeBSD.org>

Add pccarddevs.h and usbdevs.h as depends, ala miidevs.h, in the right
places. This should have been committed last night with the rest of
my changes, but wasn't.

Pointy hat to: imp


# 7676d865 22-Mar-2004 David E. O'Brien <obrien@FreeBSD.org>

Use ' rather than ".

Submitted by: ru


# 276233b6 21-Mar-2004 David E. O'Brien <obrien@FreeBSD.org>

Quote NM in case you need to force it to something with args.

Submitted by: jmallett


# 7b5ee339 20-Mar-2004 Marcel Moolenaar <marcel@FreeBSD.org>

Don't make having ${DESTDIR}/boot/device.hints a prerequisite to
installing a kernel on ia64.


# 41460aa5 13-Feb-2004 Ruslan Ermilov <ru@FreeBSD.org>

Merged from kmod.mk,v 1.152: strip debugging symbols even when not
configured for debugging. This saves some bytes, and produces the
same "kernel" object as if it was configured for debugging.


# 0ec876a2 05-Feb-2004 Peter Wemm <peter@FreeBSD.org>

Attempt to clean up the emu10k1-alsa.h stuff so that config doesn't
delete it each time its run and have it regenerated each time by make.
I used a quick hackish script rather than putting it in the files file
and used the before-depend rule to avoid the depend/no-depend hacks.


# c7301f91 21-Jan-2004 Ruslan Ermilov <ru@FreeBSD.org>

The gdbinit.${MACHINE_ARCH} script may not exist.


# 42397935 12-Jan-2004 David E. O'Brien <obrien@FreeBSD.org>

Add emu10k1-alsa%diked.h dependancies.


# e3423462 03-Jan-2004 Warner Losh <imp@FreeBSD.org>

Define KERNBUILDDIR again. The RELENG_5_2 tree is stable enough that
we can turn this back on to start to resolve the issues with the
release process.

Approved by: scottl


# 77c854b0 30-Dec-2003 Bruce Evans <bde@FreeBSD.org>

Backed out rev.1.48. -Winline now works better so there should be no
need for a hack to prevent bogus warnings about unused inlines.


# e1402a88 29-Dec-2003 Bruce Evans <bde@FreeBSD.org>

Garbage-collected some vestiges of objformat support (mainly ${FMT}).


# c52c3a23 29-Dec-2003 Bruce Evans <bde@FreeBSD.org>

Fixed some style bugs (manly a few English usage errors in comments and
many unusual indentations for continued lines in code).


# 01b4ca63 28-Dec-2003 Greg Lehey <grog@FreeBSD.org>

gdbinit target: Remove comment lines from dot.gdbinit. This allows us to
put dire warnings in the original and not find them in the installed version.


# 54e10805 24-Nov-2003 Warner Losh <imp@FreeBSD.org>

Turns out that building modules with the kernel opt files is
uncovering some interesting problems. Be conservative and effecitvely
disable this by default. Interested parties may still define
KERNBUILDDIR by hand to achive the same effect.

I plan on referting this change after 5.2 is released, or sooner if
the issues with building releases are resolved and re@ approves.

Approved by: re@ (scottl, marcel)


# 9644b987 14-Nov-2003 Bruce Evans <bde@FreeBSD.org>

Moved $FreeBSD$ to the beginning of the file.

Improved wording in a nearby comment.


# 8fa793d0 14-Nov-2003 Brian Feldman <green@FreeBSD.org>

Include opt_global.h in the modules build, when building from a normal
kernel build. This makes it possible for me not to get pissed off that
random.ko crashes the system trying to rdtsc() when the i386/cpu.h
support code decides it's okay to call that op when neither I386_CPU or
I486_CPU is defined. I guess it also makes WITNESS/INVARIANTS defines
get picked up by the modules.


# afdc68c4 03-Nov-2003 Brian Feldman <green@FreeBSD.org>

Add a "-f" flag for asf(8) which performs a search to find the each module
no matter where in the directory structure it may be. Use this and the "-k"
flag in the generated gdbinit files so that the "getsyms" function in gdb
requires no user intervention to run and will find every module if they're
in the kernel build's module directory. This is still quite useful for
cases where gdb knows that the path for some modules is /boot/kernel and
others are in the object directory for /usr/src/sys/$ARCH/compile/kernel.

Approved by: grog


# 98a32cb1 07-Aug-2003 Ruslan Ermilov <ru@FreeBSD.org>

Fix logic in Makefile.i386,v 1.249: only back up ${DESTDIR}${KODIR}
to ${DESTDIR}${KODIR}.old if we have booted from ${DESTDIR}${KODIR},
and always keep kern.bootfile in a good shape.


# a018375a 22-Jul-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Don't complain about inlines for genassym


# 46205431 22-Jun-2003 Ruslan Ermilov <ru@FreeBSD.org>

Protect against .depend file somewhere else in the .PATH.
Also consolidate building rules for special files.


# 1d1f8d7c 14-Jun-2003 Mark Murray <markm@FreeBSD.org>

Some glue to allow lint(1) to work on the kernel. This is not
complete without some config(8) work. Config(8) needs to provide
some ${NORMAL_LINT} rules to make foo.ln files.


# 222aa33a 12-Jun-2003 Greg Lehey <grog@FreeBSD.org>

If we're building a debug kernel, add target to install the .gdbinit files
from tools/debugscripts.


# dfb83539 01-Jun-2003 David E. O'Brien <obrien@FreeBSD.org>

Fix a style nit.

Submitted by: ru


# 5345d76f 01-Jun-2003 David E. O'Brien <obrien@FreeBSD.org>

Be sloppier about the miidevs.h dependency. This reduces the maintenance
effort at the expense of making miidevs.h a dependency for very .o.

Requested by: imp


# 89e50d0e 31-May-2003 Poul-Henning Kamp <phk@FreeBSD.org>

If DESTDIR was specified as a makeoption in the kernelconfig file
we want to pass it on to the modules build so we don't install
the kernel under DESTDIR and the modules in /boot.


# 1d6911d1 29-Apr-2003 Mark Murray <markm@FreeBSD.org>

Help out with linting. Print the ${LINT} command line. This makes
the all-important -DFOO -IBAR options "hang out".


# ab404da2 03-Mar-2003 Ruslan Ermilov <ru@FreeBSD.org>

Leave the `clobber' target alone, it clobbers too much (including
the generated Makefile) to be useful as the cleandir replacement.

Reported by: des


# 04b603e5 02-Mar-2003 Ruslan Ermilov <ru@FreeBSD.org>

Abuse `cleandir' for what `clobber' was supposed to do, for peter.


# e1ace8b4 28-Feb-2003 Ruslan Ermilov <ru@FreeBSD.org>

Hopefully, obviate the need of ``make depend''.


# ddc474a8 28-Feb-2003 Ruslan Ermilov <ru@FreeBSD.org>

Initiate the de-orbit burn sequence for <bsd.kern.mk>.
Always use sys/conf/kern.mk when building kernel/modules.
<bsd.kern.mk> is only preserved for sys/boot/pc98/boot2
for now, but this will be fixed. If there are other
users of <bsd.kern.mk>, please let me know.

Reminded by: bde


# 5d1b6a85 28-Feb-2003 Ruslan Ermilov <ru@FreeBSD.org>

Standardize handling of locore.[sS] etc. files.

Submitted by: jake, bde, ru


# 76d6aef5 27-Feb-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Add necessary awk magic to create a table of major numbers allocated
in conf/majors so we can avoid autoallocating them in the kernel.


# 73b893a7 21-Feb-2003 Ruslan Ermilov <ru@FreeBSD.org>

Overhaul the targets and hope this is now much more readable.

This adds some orthodox kernel-* and modules-* targets and
retires harmful ``clobber''.

Now, do we really want to keep the ``modules'' target here?


# cb421150 29-Jan-2003 Peter Wemm <peter@FreeBSD.org>

Move the miidevs.h build stuff to conf/files so that config(8) doesn't
clobber it each time.
XXX: maybe this should be 'optional miibus' rather than 'standard'


# 2d3ce713 18-Jan-2003 David E. O'Brien <obrien@FreeBSD.org>

Remove miidevs.h and generate it from miidevs at compile time.
The devlist2h.awk tool to do this has been repocopied to sys/tools/.


# fb404d6f 03-Nov-2002 Scott Long <scottl@FreeBSD.org>

Hook the aic7xxx modules up. This requires some extra care since aicasm
is a compiler tool and needs to be compiled by the host compiler. I've
tested this in i386->sparc cross-build, 4.7->current upgrade, normal
buildkernel target, and normal /sys/i386/compile/GENERIC configurations.

Submitted by: ru


# 32e8efbf 15-Oct-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Don't show the command line when doing "make lint".


# 66422f5b 16-Sep-2002 Peter Wemm <peter@FreeBSD.org>

Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports. As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL. It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha


# 49b2349b 18-Aug-2002 Bruce Evans <bde@FreeBSD.org>

Added rules to generate .c files from .m files. Run mkdep on these .c
files. This fixes at least "make" (without -j) after "make clean".


# 0f64e446 18-Aug-2002 Bruce Evans <bde@FreeBSD.org>

Finished removing env(1) commands, as in rev.1.13 but non-broken. Set
the environment for the last command of the pipeline (xargs) instead
of too early in the broken version or using an extra env process for
each command spawned by xargs as in rev.1.12. Fixed a nearby English
error.


# 8a3e49fd 14-Aug-2002 Juli Mallett <jmallett@FreeBSD.org>

Spell kenrel as 'kernel' for consistency with the rest of the universe.

Inspired by: bde


# 8fe52021 31-Jul-2002 Peter Wemm <peter@FreeBSD.org>

Remove duplicate 'modules-tags' rule


# ba37958b 31-Jul-2002 Jake Burkholder <jake@FreeBSD.org>

Moved the rule for locore.o from kern.post.mk to Makefile.$ARCH.


# d2893b16 29-Jul-2002 Ruslan Ermilov <ru@FreeBSD.org>

Drop support for COPY, -c has been the default mode of install(1)
for a long time now.

Approved by: bde


# 7f3c93b7 17-Jul-2002 Ruslan Ermilov <ru@FreeBSD.org>

s/install -c/${INSTALL} ${COPY}/


# 3c9d8965 13-Jul-2002 Bruce Evans <bde@FreeBSD.org>

Quick fix for high resolution kernel profiling on i386's. Use
-finstrument-functions instead of -mprofiler-epilogue. The former
works essentially the same as the latter but has a higher overhead
(about 22 more bytes per function for passing unused args to the
profiling functions).

Removed all traces of the IDENT Makefile variable, which had been
reduced to just a place for holding profiling's contribution to CFLAGS
(the IDENT that gives the kernel identity was renamed to KERN_IDENT).


# 1cd1fdea 23-May-2002 Ruslan Ermilov <ru@FreeBSD.org>

Fixed broken ``make -jX install''.

Spotted by: make release TARGET_ARCH=ia64


# b90faaf3 11-May-2002 Dima Dorfman <dd@FreeBSD.org>

sysctl -w -> sysctl


# 2065f9d2 10-May-2002 John Baldwin <jhb@FreeBSD.org>

Add a dummy cleandir target to the kernel section so that make buildkernel
actually works on a kernel config with NO_MODULES set.


# 9fa411ae 30-Apr-2002 David E. O'Brien <obrien@FreeBSD.org>

Use makeobjops.awk rather than makeobjops.pl.
(with big thanks to Oliver Fromme <olli@fromme.com>)


# 2cbc81ff 24-Apr-2002 Ruslan Ermilov <ru@FreeBSD.org>

The install.debug and reinstall.debug targets are needed solely
to build kernel and kernel modules so stop supporting them in
bsd.subdir.mk and reimplement them in kern.post.mk and kmod.mk
as special versions of the install and reinstall targets, and
only define them if DEBUG is also defined (when debug versions
are really built).

Prompted by: bde


# d82f8748 20-Mar-2002 Warner Losh <imp@FreeBSD.org>

Minor cleanups to post.mk from bde. Mostly ordering


# a7ac916b 19-Mar-2002 Bruce Evans <bde@FreeBSD.org>

Backed out the part of the previous commit related to xargs. It just
broke things, since "name=value ... cmd ..." only works for simple
commands (not for pipelines).


# 09f2f5ad 18-Mar-2002 Bruce Evans <bde@FreeBSD.org>

Removed env(1) commands. make(1) uses a real shell, and
"env name=value ... cmd ..." is just a pessimized way of doing
"name=value ... cmd ..." in real shells. Set the environment
(without using env(1)) before starting xargs so that env(1)
is not needed in "xargs env name=value ... cmd ..."


# bbb467cd 18-Mar-2002 Ruslan Ermilov <ru@FreeBSD.org>

lint the previous lint commit.

Reviewed by: markm


# 766f7d6e 17-Mar-2002 Mark Murray <markm@FreeBSD.org>

Allow "make lint" to mostly work. Our sources are very unclean WRT
lint, so this is turned off by default. Setting WANT_LINT will turn
on generation of lint libraries for /usr/libdata/lint/*.ln.

Reviewd by: silence in -audit.


# b7bbb709 28-Feb-2002 David E. O'Brien <obrien@FreeBSD.org>

Use vnode_if.awk rather than vnode_if.pl


# 4fbd95d6 22-Feb-2002 Jake Burkholder <jake@FreeBSD.org>

Don't echo a comment during make depend.


# caa38512 21-Feb-2002 Luigi Rizzo <luigi@FreeBSD.org>

Use make -V VARIABLE | xargs ... to pass argument lists to program
so that this is safe even if VARIABLE is longer than kern.argmax.

There is another instance of CFILES which might need the same treatment,
and might be noticed when doing a "make links".

The same has to be done in RELENG_4 (on some different file).

Noticed-by: picobsd cross-compiling LINT
Suggested-by: Alfred (bright@mu.org), des@freebsd.org
MFC-after: 3 days


# 0b3178a4 09-Jan-2002 Mike Smith <msmith@FreeBSD.org>

Eliminate the use of commons in the kernel and modules,
simplifying the module linking process and eliminating the risks
associated with doubly-defined variables.

Cases where commons were legitimately used (detection of
compiled-in subsystems) have been converted to use sysinits, and
any new code should use this or an equivalent practice as a
matter of course.

Modules can override this behaviour by substituting -fno-common
out of ${CFLAGS} in cases where commons are necessary
(eg. third-party object modules). Commons will be resolved and
allocated space when the kld is linked as part of the module
build process, so they will not pose a risk to the kernel or
other modules.

Provide a mechanism for controlling the export of symbols from
the module namespace. The EXPORT_SYMS variable may be set in the
Makefile to NO (export no symbols), a list of symbols to export,
or the name of a file containing a newline-seperated list of
symbols to be exported. Non-exported symbols are converted to
local symbols. If EXPORT_SYMS is not set, all global symbols are
currently exported. This behaviour is expected to change (to
exporting no symbols) once modules have been converted.

Reviewed by: peter (in principle)
Obtained from: green (kmod_syms.awk)


# 714b6aa6 06-Jan-2002 Warner Losh <imp@FreeBSD.org>

s/oferride/override/

submitted by: dima


# 99fd86af 04-Jan-2002 Warner Losh <imp@FreeBSD.org>

Move initialization of the MKMODULESENV envorinoment to kern.pre.mk
from kern.post.mk so port makefiles can augment it.

Submitted by: nyan


# 4e876428 10-Nov-2001 Warner Losh <imp@FreeBSD.org>

Move all: target to kern.pre.mk so it matters less where you include
kern.post.mk.

# this should allow us to move kern.post.mk to the last line of the makefiles,
# but I'll do that slowly as I verify that one can do that w/o breaking things.

Submitted by: naddy


# 1fddc467 04-Nov-2001 Warner Losh <imp@FreeBSD.org>

Move machine link creation from genassym to kernel-depend, per nyan@


# 7ff50259 02-Nov-2001 Warner Losh <imp@FreeBSD.org>

Arrgh. A clean pc98 build failed due to bogons on my part :-(.

Fix it by putting back the link of machine to sys/i386/include rather
than ../../include (aka sys/pc98/include). I had a stale machine link
on my first test.

Not sure what the "right" fix is, but this unbreaks things.


# 41c8eb30 02-Nov-2001 Warner Losh <imp@FreeBSD.org>

Factor the common parts of the Makefile.foo files. This introduces two
new files: kern.pre.mk, which contains most of the definitions, and
kern.post.mk, which contains most of the rules.

I've tested this on i386 and pc98. I have had feedback on the sparc64
port, but no reports from anybody on alpha, ia64 or powerpc. I
appologize in advance if I've broken you.

Reviewed by: jake, jhb, arch@