Subject: Re: Should make create $MAKEOBJDIR ?
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 03/18/2003 14:46:23
On Wed, Mar 19, 2003 at 01:19:14AM +1100, Luke Mewburn wrote:
> On Tue, Mar 18, 2003 at 02:01:47PM +0000, David Laight wrote:
>   | > >I wondered if there were any reason why make shouldn't create
>   | > >the object directory when MAKEOBJDIR is set in the environment.
>   | > 
>   | > Yes.  This would likely break far more than it fixes.  
>   | 
>   | OK have (yet another) random environment variable that causes make to
>   | either:
>   | 1) abort if MAKEOBJDIR is set and the directory doesn't exist
>   | or:
>   | 2) create the required directory.
> 
> Argh, more configuration knobs in the build system.  Evil!

I've already been caught out by the extremely evil code that decides
to put .o files in `pwd`/obj just because the directory exists...

That is a 'feature' that definitely (IMHO) should be shot.

> Seriously though; there's already N different ways to support objdirs,
> and adding Yet Another Config Knob just adds more crap we have to
> support "down the track".

What happened on Monday was my netbsd build failed in the union fs
code.  Some files had been commited just after I'd synced, so I pulled
them in to see if it helped [1].  However there was a modified (or
maybe new) Makefile, so when I ran 'build.sh -o' the new obj directories
hadn't been created.  Since I was running 2 build in parallel
both put a 'machine' symlink into the source directory :-(

> Your problem would most likely be solved if you used MAKEOBJDIRPREFIX
> instead of MAKEOBJDIR.  Sure, the paths to the objdirs are longer, but
> then you can do stuff like:
> 	$MAKEOBJDIRPREFIX/$cwd/$cwd:t
> (in (t)csh) to access your newly built application :)

The netbsd makefiles have a dynamic MAKEOBJDIR...

Actually I just use the 'cd src obj' feature of ksh (imported into netbsd's
/bin.sh because it is so useful).

	David

-- 
David Laight: david@l8s.co.uk