From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 28 10:23:05 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 47F1016A4CE for ; Thu, 28 Oct 2004 10:23:05 +0000 (GMT) Received: from mail815.megamailservers.com (mail815.carrierinternetsolutions.com [69.49.106.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id 972F443D2F for ; Thu, 28 Oct 2004 10:23:04 +0000 (GMT) (envelope-from strick@covad.net) X-POP-User: strick.covad.net Received: from mist.nodomain (h-67-101-98-29.snfccasy.dynamic.covad.net [67.101.98.29])i9SAN31l027305 for ; Thu, 28 Oct 2004 06:23:03 -0400 Received: from mist.nodomain (localhost [127.0.0.1]) by mist.nodomain (8.12.11/8.12.11) with ESMTP id i9SAN2Ci001782; Thu, 28 Oct 2004 03:23:02 -0700 (PDT) (envelope-from dan@mist.nodomain) Received: (from dan@localhost) by mist.nodomain (8.12.11/8.12.11/Submit) id i9SAN27L001781; Thu, 28 Oct 2004 03:23:02 -0700 (PDT) (envelope-from dan) Date: Thu, 28 Oct 2004 03:23:02 -0700 (PDT) From: Dan Strick Message-Id: <200410281023.i9SAN27L001781@mist.nodomain> To: freebsd-hackers@freebsd.org cc: dan@mist.nodomain Subject: questionable feature in FreeBSD pmake X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2004 10:23:05 -0000 I just spent a *very* frustrating hour trying to figure out why the FreeBSD make program was invoking all commands to make things in a subdirectory named "obj". I eventually discovered this gem in the make man page: In addition, make sets or knows about the following internal variables or environment variables: ... .OBJDIR A path to the directory where the targets are built. At startup, make searches for an alternate directory to place target files. It will attempt to change into this special directory and will search this directory for makefiles not found in the current directory. The following directories are tried in order: 1. ${MAKEOBJDIRPREFIX}/`pwd` 2. ${MAKEOBJDIR} 3. obj.${MACHINE} 4. obj 5. /usr/obj/`pwd` I believe this feature is a real botch because it is magic, unintuitive, and so *exceedingly* easy to invoke by mistake. It happens that I really really want to have a subdirectory named "obj" and I really really don't want to cd into it. The only workaround seems to be to define the MAKEOBJDIR variable and that would be disgustingly ugly because it makes no obvious sense unless you are aware of the magic feature. Rules 3-5 look like they were invented without careful consideration to avoid the minor effort required to use one of the first 2 rules. Does anyone know where this feature came from? The .OBJDIR variable was recognized by the pmake distributed with 4.4 BSD, but the man page for that version of make does not mention the gratuitous magic rules for changing the make working directory. The older make program found in 4.3 BSD does not seem to use the .OBJDIR variable at all. This feature is not mentioned in the pmake tutorial found in /usr/share/doc/psd/12.make. Is it a FreeBSD-ism? Dan Strick strick@covad.net