History log of /freebsd-current/share/mk/src.sys.obj.mk
Revision Date Author Comments
# 3cc91b77 02-Jun-2024 Jessica Clarke <jrtc27@FreeBSD.org>

Revert "src.sys.obj.mk: Export OBJTOP"

Unfortunately this results in make universe's environment, i.e.
corresponding to the host, being used for every one of its sub-makes, so
they're in the wrong place and trample over each other.

This reverts commit 2b7c1402f96be2d2986738e32706dab7b5691ef0.


# 2b7c1402 28-May-2024 Simon J. Gerraty <sjg@FreeBSD.org>

src.sys.obj.mk: Export OBJTOP

If we had to set OBJTOP we want to .export it (if .MAKE.LEVEL > 0)
for the benefit of things like x!= ${.MAKE} -r ... and similar.

Without OBJTOP, the default MAKEOBJDIR setting will result in
attempting to use an objdir like /lib or /bin etc in some cases.

This patch is based on D30990
with the addition of the check for level > 0.

Reviewed by: jrtc27
Differential Revision: <https://reviews.freebsd.org/D30990>


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

Remove $FreeBSD$: one-line sh pattern

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


# bee3d4bf 11-May-2023 Simon J. Gerraty <sjg@FreeBSD.org>

Move DIRDEPS_BUILD settings to sys.dirdeps.mk

When originally implemented, there was no distinction between
DIRDEPS_BUILD and META_MODE, they were one and the same.

META_MODE however is useful by itself, but since meta.sys.mk
had lots of settings related to DIRDEPS_BUILD its use was limited
to DIRDEPS_BUILD.

Move (most) DIRDEPS_BUILD related items to sys.dirdeps.mk
so that meta.sys.mk can be used for just META_MODE.
There is of course some bluring of the lines, so settings remain
in meta.sys.mk

Add MK_META_ERROR_TARGET to enable the META_MODE .ERROR target
independent of DIRDEPS_BUILD, it copies failed .meta files to ${SB}/error
to make it easier to identify the cause of build failures.

Since sys.dirdeps.mk should be included first, most of
local.meta.sys.mk becomes local.sys.dirdeps.mk
and some other bits need to move to local.sys.dirdeps.env.mk

Also fix dirdeps.mk to not add CURDIR to DIRDEPS when it is SRCTOP.

Reviewed by: bdrewery
Differential Revision: https://reviews.freebsd.org/D40053


# 01f124b4 27-Jun-2018 Bryan Drewery <bdrewery@FreeBSD.org>

tinderbox: Only build clang/lld once if needed.

Need to handle LLD_BOOTSTRAP separately (for archs like i386).
This would be much better off with an off-by-default option like
SHARED_TOOLCHAIN that universe force-enabled. Then a normal buildworld
would store the toolchain there if enabled and otherwise in WORLDTMP
with only the 1 arch selected.

MFC after: 3 weeks
Sponsored by: Dell EMC


# 6e6be2bb 20-Jun-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Reduce exec and fstat overhead for non-build targets.

This is mostly targetting 'make showconfig' and 'make test-system-*' for
the benefit of makeman and universe-one-clang work.

Sponsored by: Dell EMC


# fc287c10 23-Feb-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Fix installation with read-only OBJDIR.

Reported by: npn
Sponsored by: Dell EMC


# 2e07e232 11-Jan-2018 Bryan Drewery <bdrewery@FreeBSD.org>

Add a hack to disable AUTO_OBJ for 'old style' kernel builds.

Another solution would be to extend the Makefile.sys.inc idea, or a .no_obj
file, to more places but I would rather keep that limited to the top-level
build for now to not impact performance (statting a file in every make call)
or to bring unintended side-effects.

Reported by: jhb, imp
Sponsored by: Dell EMC Isilon


# 302bf4c1 05-Dec-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Handle writable-but-not-a-directory cases for writable OBJDIR check.

Sponsored by: Dell EMC


# e22224a5 05-Dec-2017 Bryan Drewery <bdrewery@FreeBSD.org>

AUTO_OBJ: For all top-level targets enforce using an OBJDIR.

This will cause an error if the wanted OBJDIR is not writable. Previously it
would cause the files to generate to the source tree. This was too obscure and
things like buildworld really expect a proper OBJDIR layout.

Sponsored by: Dell EMC


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

Remove unneeded special case for .OBJDIR=.CURDIR.

The else statement is already handling this by ensuring a safe .OBJDIR is used.

Sponsored by: Dell


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

Fix top-level targets with read-only OBJDIR.

This also makes it so that top-level build targets do not immediately create
the OBJDIR. Only sub-make targets will do so. This avoids creating object
directories for targets like 'make check-old' or creating unneeded
MACHINE.MACHINE_ARCH directories during 'make tinderbox'.

Reported by: npn, lifanov
Tested by: npn, Mark Millard
Sponsored by: Dell


# de2b0e03 10-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

DIRDEPS_BUILD: Fix after r325417.

DIRDEPS_BUILD works just fine without defining __objdir or dealing with any of
this logic. It handles its own TARGET_SPEC in local.meta.sys.mk as well. Just
let it do its own thing.

Sponsored by: Dell EMC Isilon


# 5edf5dc2 10-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Don't work out of a TARGET. directory if TARGET_ARCH is not defined.

This fixes 'TARGET=<target> make universe_kernels' creating an empty TARGET.
directory and showing it in SIGINFO.

Sponsored by: Dell EMC Isilon


# f82493cc 10-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Handle MAKEOBJDIRPREFIX when already inside of .OBJDIR.

This can happen in obscure cases with things like the kernel build.

Sponsored by: Dell EMC Isilon


# 2f1b9408 10-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Don't append TARGET.TARGET_ARCH if OBJTOP is already set.

This avoids flipping the expected TARGET.TARGET_ARCH suffix / OBJTOP when it is
already set by a parent make which wants to control it more such as in
something like 'make native-xtools'.

Sponsored by: Dell EMC Isilon


# fa65e3a5 09-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Handle some .OBJDIR == .CURDIR cases.

- If OBJROOT is SRCTOP then don't add on TARGET.TARGET_ARCH. This
only happens at the top-level, and for sub-directories when the
user is clever with MAKEOBJDIRPREFIX=/.
- Don't bother checking 'test -w' on .CURDIR.
- Properly set OBJTOP/OBJROOT to SRCTOP in various needed cases.
- Check if the OBJDIR is writable even for *clean* targets since it
determines which .OBJDIR the user gets; If they cannot write to an
existing eligible .OBJDIR then it needs to clean in .CURDIR instead.
- Add guard to cleanworld/cleanuniverse from removing SRCTOP.
- Ensure OBJTOP is proper for .OBJDIR=.CURDIR which fixes finding
libraries since src.libnames.mk is based on OBJTOP.
- Avoid some chdir(2) for modifying .OBJDIR

Sponsored by: Dell EMC Isilon


# 502304ef 07-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Reenable AUTO_OBJ by default.

The problem with it was a bogus .OBJDIR in some cases where creation of
object directories were purposely not attempted, such as for 'make cleandir'
and in etc/ sub-directories. In these cases bmake would start with a
bogus .OBJDIR like etc/ due to MAKEOBJDIR being a dynamic value based on
.CURDIR, SRCTOP, and OBJTOP. OBJTOP would not yet be defined but is
during early src.sys.obj.mk. That file and auto.obj.mk both were not
modifying .OBJDIR unless they expected to create the objdir. Thus in
these cases the .OBJDIR was left as etc/* rather than fixed to the
proper .CURDIR.

The issues were fixed in r325404 and r325416. An assertion to avoid the
bad .OBJDIR was added in r325405.

Sponsored by: Dell EMC Isilon


# 34074065 04-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Set the expected __objdir for auto.obj.mk to try.

This avoids some future discrepency that might cause auto.obj.mk to use the
wrong OBJDIR.

Sponsored by: Dell EMC Isilon


# 00428a51 04-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Always try to set .OBJDIR, even if AUTO_OBJ is enabled, and fallback to .CURDIR.

When AUTO_OBJ is enabled this change becomes redundant with the auto.obj.mk
check added in r325404. However, it is possible that new code is added
at some point between src.sys.obj.mk and auto.obj.mk that disables AUTO_OBJ.
That could leave make with a bogus and unsafe .OBJDIR in some cases.

Sponsored by: Dell EMC Isilon


# dea21cf4 04-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Validate MAKEOBJDIR after the MAKEOBJDIRPREFIX override.

Sponsored by: Dell EMC Isilon


# 5fecb1f1 02-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

AUTO_OBJ is unsafe at the moment as it is for some reason removing /etc with _cleanobj.


# 615a1e70 02-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Enable AUTO_OBJ by default if the OBJDIR is writable, only for in-tree builds.

This can be disabled by putting WITHOUT_AUTO_OBJ=yes in /etc/src-env.conf, not
/etc/src.conf, or passing it in the environment.

The purpose of this rather than simply flipping the default of AUTO_OBJ to yes
is to avoid hassling users with auto.obj.mk failures if the wanted OBJDIR is
not writable. It will fallback to writing to the source directory like it does
today if MAKEOBJDIRPREFIX is not writable.

The act of enabling MK_AUTO_OBJ disables all 'make obj' treewalks since
previous work has made those not run if MK_AUTO_OBJ==yes in Makefile.inc1.

Relnotes: yes
Reviewed by: sjg
Discussed at: https://lists.freebsd.org/pipermail/freebsd-arch/2016-May/017805.html
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12841


# fbb74b0e 01-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Don't propagate MAKEOBJDIRPREFIX changes to environment.

A makefile may use this variable later for its own reasons,
don't infect sub-makes with that value.

Sponsored by: Dell EMC Isilon


# dfa09989 01-Nov-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Add option UNIFIED_OBJDIR, on by default, which moves the default build OBJDIR.

This changes the build OBJDIR from the older style of /usr/obj/<srcdir> for
native builds, and /usr/obj/<target>.<target_arch>/<srcdir> for cross builds to
a new simpler format of /usr/obj/<srcdir>/<target>.<target_arch>. This
new format is used regardless of cross or native build. It allows
easier management of multiple source tree object directories.

The UNIFIED_OBJDIR option will be removed and its feature made permanent
for the 12.0 release.

Relnotes: yes (don't note UNIFIED_OBJDIR option since it will be removed)
Prior work: D3711 D874
Reviewed by: gjb, sjg
Discussed at: https://lists.freebsd.org/pipermail/freebsd-arch/2016-May/017805.html
Discussed with: emaste
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12840


# bec340c8 30-Oct-2017 Bryan Drewery <bdrewery@FreeBSD.org>

This check is not ready here yet.

Keeping for blame purposes, it will be enabled soon.


# 0dd60f15 30-Oct-2017 Bryan Drewery <bdrewery@FreeBSD.org>

Move some objdir handling (OBJROOT/OBJTOP) out of DIRDEPS_BUILD-only files.

Sponsored by: Dell EMC Isilon