Subject: Re: obj dir not created (subdir sendmail/cf/cf)
To: Jachym Holecek <freza@liberouter.org>
From: None <tlaronde@polynum.com>
List: tech-toolchain
Date: 06/20/2005 19:26:10
On Mon, Jun 20, 2005 at 06:26:26PM +0200, Jachym Holecek wrote:
> 
> > 3) ${.TARGET} is the same as POSIX classical $@ and expands just to
> > the given target, no obj stuff being prepended;
> 
> ${.TARGET} will typically only contain name of the file (basename).
> 
> > => so MAKEDEV is generated in the srcdir, when it is supposed---from
> > ETC_INSTALL_OBJ---to be generated in .OBJDIR
> 
> I didn't look in detail at fragment in question -- the general BSD make
> trick however is that ${PWD} will be changed from ${.CURDIR} to ${.OBJDIR}
> for the lifetime of rule-commands. So:
> 
> foo:
> 	echo "hello" > ${.TARGET}
> 
> May generate ${.CURDIR}/foo or ${.OBJDIR}/foo, depending on whether
> the conditions described above were met.
> 
> > For one reason I don't remember at the moment, changing MAKEOBJDIRPREFIX
> > by .OBJDIR was not giving the correct result (file was not generated in
> > the correct place).
> 
> MAKEOBJDIRPREFIX will affect .OBJDIR -- iff MAKEOBJDIRPREFIX/${.CURDIR}
> exists (and can be cwd'd to). Maybe that was the problem?

That is at least a clue! I seem to remember now that prepending .OBJDIR
was giving _twice_ the path (i.e. ${.OBJDIR}/${.OBJDIR}/foo), while at
the same time, giving -M <my_objdir_prefix> to build.sh, MAKEDEV was
obstinately trying to be generated in srcdir (read only hence failure).

The duplication of ${.OBJDIR} is consistent with what you say, remains
the problem to find why in the gnu/usr.sbin/sendmail/cf/cf and
etc/MAKEDEV cases things fail while in all other cases there is no
problem (in my case with some peculiarity that I need to find).

Is there some documentation about the ${PWD} dance ("howto write Makefile
so that ${.CURDIR} or ${.OBJDIR} is chosen" sort of)?...except reading 
the whole sources of nbmake and share/mk if I can avoid it ;)

Regards,
-- 
Thierry Laronde (Alceste) <tlaronde +AT+ polynum +dot+ com>
http://www.kergis.org/  |  http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89  250D 52B1 AE95 6006 F40C