Subject: Re: make(1)'s inbuilt objdir handling
To: Luke Mewburn <lukem@NetBSD.org>
From: Simon J. Gerraty <sjg@crufty.net>
List: tech-toolchain
Date: 06/26/2005 18:15:43
>As recently observed in another discussion on this list,
>make(1) has "special" inbuilt .OBJDIR handling.

>To recap, the inbuilt-to-make .OBJDIR rules are:

>    	if MAKEOBJDIRPREFIX is set in the environment		# rule 1
>		.OBJDIR = ${MAKEOBJDIRPREFIX}/${PWD}
>	else MAKEOBJDIR is set in the environment		# rule 2
>			# MAKEOBJDIR may be an expression
>		.OBJDIR = ${MAKEOBJDIR}
>	else if -d "obj.${MACHINE}"				# rule 3
>		.OBJDIR = obj.${MACHINE}
>	else if -d "obj"					# rule 4
>		.OBJDIR = obj
>	else if -d "/usr/obj/${PWD}"				# rule 5
>		.OBJDIR = /usr/obj/${PWD}
>	else							# rule 6
>		.OBJDIR = .CURDIR

>I personally believe that rules 3 through 5 should be removed from make.

No objection here, I suspect all of those can now be simulated anyway 
by putting something like:

.OBJDIR: obj.${MACHINE}

in /etc/mk.conf or any other makefile.

The above can actually be used to automatically create the obj dirs 
as you go - no need for a 'mk obj' pass.  I find this very handy
for speeding up builds and reducing suprises from users after updating their
trees...

--sjg