Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jun 1996 18:26:34 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-current@FreeBSD.org, nate@sri.MT.net
Subject:   Re: Building inside of /usr/src?
Message-ID:  <199606250826.SAA31406@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>While I think the new cleanup of the obj handling is great, it appears that
>it's now impossible to build things *inside* of the /usr/obj tree now?
                                                          src

>How does one build stuff inside of the current directory using the
>current mk macros?  I leave /usr/obj (and the symlinks) populated with the most
>recent sources on my development box, so I don't have to re-build everything on
>updates.  Then, when I do local hacking I 'mv obj obj_off' and do all my
>hacking knowing that I won't mess up my 'normal' obj files, and then after
>I finish I do a 'cvs update; make cleandir; mv obj_off obj' and I'm back to
>where I was before I started.

Move the real obj directory out of the way similary.

Make's path building and priorities for finding the obj directory are now
broken.  Not only the source tree is broken.  Try this:

	$ cd /tmp
	$ cvs co cat
	$ cd cat
	$ make		# builds in ".", OK
	$ make clean
	$ mkdir obj
	$ make		# still builds in ".", not OK
	$ make clean
	$ mkdir /usr/obj/tmp /usr/obj/tmp/cat
	$ make		# now builds in /usr/obj/tmp/cat :-(
	$ rm -rf /usr/obj/tmp	# don't leave this trap
	$ export MAKEOBJDIR=obj
	$ mkdir obj
	$ make		# still builds in ".", not OK
	$ mkdir obj/tmp obj/tmp/cat
	$ make		# now builds in /tmp/cat/obj/tmp/cat :-(.

Make's default obj directory search path (in $PATH notation) has changed as
follows:

case MAKEOBJDIR not set (machine i386):
old					new
---					---
./obj.i386:./obj:.			/usr/obj/tmp/cat:.

case MAKEOBJDIR set to "obj":
old					new
---					---
./obj:./obj.				./obj/tmp/cat:.

case MAKEOBJDIR set to "/tmp/cat/obj":
old					new
---					---
/tmp/cat/obj:/tmp/cat/obj:.		/tmp/cat/obj/tmp/cat:.

The builtin knowledge of /usr/obj is worse than the builtin knowledge of
./obj, and MAKEOBJDIR useless becase the full path to the current directory
is appended to it.

Fix: restore the old behaviour of make and introduce a new environment
variable MAKEOBJTREE to control the new behaviour.  The priorities should
be:

	$MAKEOBJDIR		(if MAKEOBJDIR is set) (highest)
	obj.$machine
	obj
	$MAKEOBJTREE/`pwd`	(if MAKEOBJTREE is set)
	.

MAKEOBJTREE would normally be set in bsd.*.mk.  The above priority allow
overriding it easily (for building outside the src tree) using `mkdir obj'.
There is still the problem that the objects may be put under $MAKEOBJTREE
if a directory that you don't know about happens to exist there.

I also dislike the full pathname being appended to $MAKEOBJTREE.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606250826.SAA31406>