Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Oct 2004 23:12:50 -0500 (CDT)
From:      Sean Farley <sean-freebsd@farley.org>
To:        Dan Strick <strick@covad.net>
Cc:        dan@mist.nodomain
Subject:   Re: questionable feature in FreeBSD pmake
Message-ID:  <20041028225223.W44325@thor.farley.org>
In-Reply-To: <200410281201.i9SC1Vk8002007@mist.nodomain>
References:  <200410281201.i9SC1Vk8002007@mist.nodomain>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 28 Oct 2004, Dan Strick wrote:

> On Thu, 28 Oct 2004 03:23:02 -0700, Dan Strick wrote:
>>
>> 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 just noticed this is in the BUGS section of make:
      The determination of .OBJDIR is contorted to the point of
      absurdity.

> It seems that I have no alternative but to rename my "obj" directory.
> Can someone suggest an alternative?  Note that it is not possible for
> me to set an environment variable (i.e. MAKEOBJDIR) before running
> make or to add an option to the make command line.  Any fix must be
> contained entirely within the makefile.  Setting .OBJDIR or MAKEOBJDIR
> within the makefile does not work.  Placing a "cd .." or "cd
> $(.CURDIR)" in front of every set of makefile shell commands is
> unthinkable.

Why are you unable to do anything with the command-line?  Any of these
will solve your problem.
Bourne:
MAKEOBJDIR=/no_obj_here make

Bourne or CSH:
env MAKEOBJDIR=/no_obj_here make

Here is a Makefile that does not use obj/.  The special targets can be
placed into a file to be included into all your Makefiles.  It only
suffers from a failed build where it will not rename obj to tmpobj.

-----------------------
.BEGIN:
 	mv tmpobj obj || mkdir obj

.INTERRUPT:
 	mv obj tmpobj

.END:
 	mv obj tmpobj

all:
 	touch testing

clean:
 	rm -f testing
-----------------------

Sean
-- 
sean-freebsd@farley.org



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