questionable feature in FreeBSD pmake

Harti Brandt harti at freebsd.org
Fri Oct 29 00:02:14 PDT 2004


On Thu, 28 Oct 2004, Sean Farley wrote:

SF>On Thu, 28 Oct 2004, Dan Strick wrote:
SF>
SF>> On Thu, 28 Oct 2004 03:23:02 -0700, Dan Strick wrote:
SF>> > 
SF>> > I just spent a *very* frustrating hour trying to figure out why the
SF>> > FreeBSD make program was invoking all commands to make things in a
SF>> > subdirectory named "obj".
SF>
SF>I just noticed this is in the BUGS section of make:
SF>     The determination of .OBJDIR is contorted to the point of
SF>     absurdity.
SF>
SF>> It seems that I have no alternative but to rename my "obj" directory.
SF>> Can someone suggest an alternative?  Note that it is not possible for
SF>> me to set an environment variable (i.e. MAKEOBJDIR) before running
SF>> make or to add an option to the make command line.  Any fix must be
SF>> contained entirely within the makefile.  Setting .OBJDIR or MAKEOBJDIR
SF>> within the makefile does not work.  Placing a "cd .." or "cd
SF>> $(.CURDIR)" in front of every set of makefile shell commands is
SF>> unthinkable.
SF>
SF>Why are you unable to do anything with the command-line?  Any of these
SF>will solve your problem.
SF>Bourne:
SF>MAKEOBJDIR=/no_obj_here make
SF>
SF>Bourne or CSH:
SF>env MAKEOBJDIR=/no_obj_here make
SF>
SF>Here is a Makefile that does not use obj/.  The special targets can be
SF>placed into a file to be included into all your Makefiles.  It only
SF>suffers from a failed build where it will not rename obj to tmpobj.
SF>
SF>-----------------------
SF>.BEGIN:
SF>	mv tmpobj obj || mkdir obj
SF>
SF>.INTERRUPT:
SF>	mv obj tmpobj

.INTERRUPT is dangerous at the moment, because it is not called always and 
it's sometimes called in the wrong place. I have a fix for this.

harti

SF>
SF>.END:
SF>	mv obj tmpobj
SF>
SF>all:
SF>	touch testing
SF>
SF>clean:
SF>	rm -f testing
SF>-----------------------
SF>
SF>Sean
SF>


More information about the freebsd-hackers mailing list