Subject: Re: obj dir not created (subdir sendmail/cf/cf)
To: None <>
From: Jachym Holecek <>
List: tech-toolchain
Date: 06/20/2005 18:26:26

> > > -	    awk -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl > ${.TARGET}
> > > +	    awk -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \
> > 
> > Wrong. You probably meant ${.OBJDIR} there, which is pointless since
> > the rule's PWD will already be equal .OBJDIR, iff either MAKEOBJDIRPREFIX
> > is set or MAKEOBJDIR is set or ${.CURDIR}/obj[.${MACHINE}] exists. One
> > of these conditions should be satisfied after a 'make obj' pass.
> Well, last time I try to track down how things were supposed to behave,
> I concluded (I may be totally or partially wrong):
> 1) The Makefiles are called from the source dir;


> 2) ${.CURDIR} is hence the source dir;

Correct, absolute path to source dir.

> 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:

	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).

exists (and can be cwd'd to). Maybe that was the problem?

		-- Jachym Holecek