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
[EMAIL PROTECTED]
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to