From owner-freebsd-current Sat Jun 22 12:06:37 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id MAA02049 for current-outgoing; Sat, 22 Jun 1996 12:06:37 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id MAA02032 for ; Sat, 22 Jun 1996 12:06:31 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id EAA08924; Sun, 23 Jun 1996 04:53:49 +1000 Date: Sun, 23 Jun 1996 04:53:49 +1000 From: Bruce Evans Message-Id: <199606221853.EAA08924@godzilla.zeta.org.au> To: bde@zeta.org.au, jkh@time.cdrom.com Subject: Re: OK, here it is! [was Re: Whoops! That was a mite premature..] Cc: current@FreeBSD.ORG Sender: owner-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >> >-.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