Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 May 2016 11:20:27 -0700
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Subject:   [Build] Enabling automatic object directory creation
Message-ID:  <5e8f0d99-dab1-36a8-1aac-328de4490145@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--blLpJKRvLJFWHeKtKg5lsfvGL9VH5vERU
Content-Type: multipart/mixed; boundary="JoN8ecuKiEiJx34inKN6kJ7o4vH78GtID"
From: Bryan Drewery <bdrewery@FreeBSD.org>
To: "freebsd-arch@freebsd.org" <freebsd-arch@freebsd.org>
Message-ID: <5e8f0d99-dab1-36a8-1aac-328de4490145@FreeBSD.org>
Subject: [Build] Enabling automatic object directory creation

--JoN8ecuKiEiJx34inKN6kJ7o4vH78GtID
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

For in-tree source builds only, I would like to make it so that 'make'
in a subdirectory would automatically create the object directory.  This
would naturally extend to buildworld/buildkernel as well with some
tweaks.  I already am nearly done with adding this in for buildworld and
was going to just make it happen since the 'make obj' tree-walk is a
waste of time.  It is very error-prone to not automatically create an
object directory when building in a subdirectory as it may look for
files in the wrong place.  So I would prefer to add it everywhere instead=
=2E

What is the impact of this feature?

Keep in mind this would *only affect in-tree builds, not ports*.

We would need to move the 'default' MAKEOBJDIRPREFIX from
Makefile/Makefile.inc1 into share/mk/sys.mk.  It would only be
overridable from environment and make argument, but also
/etc/src-env.conf (I think).  This restriction is already in place.  I
would have to move the assertion for this out of /Makefile and into
sys.mk.  Now when I say sys.mk I really mean something like
src.sys.env.mk. which is hidden in a way to only impact in-tree builds.

The feature is named 'WITH_AUTO_OBJ'.  Enabling this by default means
that the only way to disable it is to add WITHOUT_AUTO_OBJ=3Dyes to
environment, make argument or /etc/src-env.conf.

There are times when building in a directory without an object directoy
makes sense, but for the vast majority of people they likely have done a
buildworld already and are trying to build in a subdirectory to test
something further.  If they pulled down new revisions then it is
possible that this new directory did not get a 'make obj' tree-walk.

A side topic is changing the default MAKEOBJDIR such that it always uses
${MAKEOBJDIRPREFIX}/${SRCTOP}/${TARGET}.${TARGET_ARCH}/${RELDIR}.  Doing
this is far simpler if I can just use WITH_AUTO_OBJ everywhere.  This is
discussed a bit in https://reviews.freebsd.org/D3711.  It would give
directories such as: /usr/obj/usr/src/amd64.amd64/bin/sh.  It would keep
all universe/cross-builds inside of /usr/obj/usr/src and allow more
easily cleaning up object trees with multiple checkouts.  This object
tree pattern is what the DIRDEPS_BUILD uses as well and has been quite
handy.  I would extend the DIRDEPS_BUILD 'make destroy' and 'make
destroy-arch', to the normal build, to cleanup the entire object tree
for the object directory and the specified target.target_arch respectivel=
y.


--=20
Regards,
Bryan Drewery


--JoN8ecuKiEiJx34inKN6kJ7o4vH78GtID--

--blLpJKRvLJFWHeKtKg5lsfvGL9VH5vERU
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBAgAGBQJXRezrAAoJEDXXcbtuRpfPK7IH/2nwXZS6/JtzUhXVOb1pExdy
N+V27ILj9UiJtrWXWCYZjAtM4w1wvuNNeIySALruNiKqVndHuNSDm/j/uOQFiA1T
GlGZrU/0XQ2LFVNrVSnYHI2upoJH1h9jS786zG/LMLWDFFII76sF2CP5jyVYkoWk
GU4SqK3UWMR+hTQ0TYg8tuINjii1daAib7VPEfkm4u3sj6GNA6RTl8Dfy+j/BgKD
hjw0fR2x1Q2I//G8TguRWea/w47RHX4GQI3ZAxBqNQK1qN2kZd027+v1eLgyESaV
E/k7rKLZV8by2GaBKAg8//m2fRTqQeKJv3bK5lcGJsOEIYOSpYJ+vUC0DAoaJjw=
=62Zf
-----END PGP SIGNATURE-----

--blLpJKRvLJFWHeKtKg5lsfvGL9VH5vERU--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5e8f0d99-dab1-36a8-1aac-328de4490145>