questionable feature in FreeBSD pmake

Sean Farley sean-freebsd at farley.org
Thu Oct 28 21:12:58 PDT 2004


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 at farley.org


More information about the freebsd-hackers mailing list