From owner-freebsd-current Tue Jun 25 01:33:52 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id BAA01947 for current-outgoing; Tue, 25 Jun 1996 01:33:52 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id BAA01940 for ; Tue, 25 Jun 1996 01:33:43 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id SAA31406; Tue, 25 Jun 1996 18:26:34 +1000 Date: Tue, 25 Jun 1996 18:26:34 +1000 From: Bruce Evans Message-Id: <199606250826.SAA31406@godzilla.zeta.org.au> To: freebsd-current@FreeBSD.org, nate@sri.MT.net Subject: Re: Building inside of /usr/src? Sender: owner-current@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk >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