Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Jun 1996 04:53:49 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, jkh@time.cdrom.com
Cc:        current@FreeBSD.ORG
Subject:   Re: OK, here it is! [was Re: Whoops! That was a mite premature..]
Message-ID:  <199606221853.EAA08924@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>> >-.if exists(${.CURDIR}/../cc_int/obj)
>> >-LIBDESTDIR=	${.CURDIR}/../cc_int/obj
>> >+.if exists(${.OBJDIR}/../cc_int)
>> >+LIBDESTDIR=	${.OBJDIR}/../cc_int
>> > .else
>> > LIBDESTDIR=	${.CURDIR}/../cc_int
>> > .endif
>> 
>> This isn't good enough.  ${.OBJDIR} only gives the object directory
>> associated with the current directory.  The rule for building the
>> pathname for the object directory associated with other source
>> directories may be quite different.  E.g., if I'm compiling cc and want

>I don't think that this is going to be a general case, if it ever even
>comes up.  I do have to make some assumptions here, and one is that
>/usr/obj is essentially going to shadow /usr/src.  Trying to make it
>even more general case than this would probably be an exercise in
>diminishing returns.

It works now.  Don't break it.  I think the way to do it is to go back to
the root of the tree and not use ${.OBJDIR}.  There are now 3 source-relative
paths where the foreign objects might be (in decreasing priority):

	${.CURDIR}/../cc_int/obj	# same as before
	${.CURDIR:S/foo/bar/:S/obj$//}/../cc_int	# new
	${.CURDIR}/../cc_int		# same as before

where `:S/foo/bar' is some substitution to convert the source tree to the
object tree.  MAKEOBJDIR could be defined as a substitution instead of as
a path to make this easier.  The usual case would be foo=src, bar=obj.

>> What will replace `cd obj'?  Not cd ${MAKEOBJDIR}`pwd | sed ...`.
>> Perhaps "cd `make --print-makes-idea-of-the-obj-dir`".

>What's wrong with `cd ${.OBJDIR}'?

To begin with, it's a syntax error.  Shell identifiers can't begin with
a `.'.

>> MAKEOBJDIR should be named something like MAKEOBJROOTDIR.

>I thought this too, at first, but MAKEOBJDIR wasn't used anywhere and
>I wondered at the utility in keeping it.  The same goes for
>${.OBJDIR}, actually.  It used to point to either obj/ or ${.CURDIR},
>now it always points at the path under ${MAKEOBJDIR} whether that
>directory exists or not.  I deemed this better than creating a new
>variable (${.NEWOBJDIR} or something) and also retaining the semantics
>where ${.OBJDIR} and ${.CURDIR} were ever identical.  Knowing they're
>not enables me to blow away ${.OBJDIR} with impugnity, also saving
>MUCH time in running the clean rule first since you know you're about
>to blow everything in there away anyway and there's not much point in
>removing individual files first.

Urk.  The semantics of ${.OBJDIR} must not change since foreign makefiles
might depend on them.  It is more usefule than before since there are now
3 places where the object directory might be and the new place isn't
obvious.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606221853.EAA08924>