Subject: New possibility to move "obj" logic *out* of make(1)
To: None <tech-toolchain@netbsd.org>
From: Todd Vierling <tv@wasabisystems.com>
List: tech-userlevel
Date: 10/31/2001 09:03:04
A change I made to make(1) last night makes it possible to set ${.OBJDIR} in
Makefiles directly, by using the special target ".OBJDIR:".  This feature
will be used to implement the host-specific obj directories requested by
several people for Makefiles which use <bsd.hostprog.mk> (particularly
src/tools).

While musing about it this morning, I realized that this new ability will
make it possible to move the logic which finds the obj directory out of
make(1) entirely, and into <bsd.obj.mk>.

This would fix PR bin/3938, which describes how our make(1) will happily
make use of an "obj" directory if it exists--even for third-party sources
that probably do not want that kind of handling.

It would also allow for much more flexible modification of objdir handling.
For instance, this would let the BSDSRCDIR/BSDOBJDIR type of obj tree
handling do away with the symlinks, as that method could be expressed
automatically in terms of a MAKEOBJDIR transform.

And finally, it should make it possible to set MAKEOBJDIR and/or
MAKEOBJDIRPREFIX in mk.conf.  Currently these must be set in the environment
in order to function properly.

What do others think about this?

Note that the one upshot of moving all objdir handling to <bsd.obj.mk> does
have one noticeable impact:  pre-evaluating variables (using := or !=), or
dependency rules, containing an explicit ${.OBJDIR} before including
<bsd.obj.mk>, will probably evaluate to the wrong thing.  However, typically
an explicit ${.OBJDIR} is not needed, and I am running a full-text grep on
the source tree to find the locations where this can be fixed in our tree.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  Wasabi & NetBSD:  Run with it.
-- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/