questionable feature in FreeBSD pmake

Harti Brandt harti at freebsd.org
Thu Oct 28 23:50:50 PDT 2004


On Thu, 28 Oct 2004, Dan Strick wrote:

DS>On Thu, 28 Oct 2004 03:23:02 -0700, I wrote:
DS>>
DS>> I just spent a *very* frustrating hour trying to figure out why the
DS>> FreeBSD make program was invoking all commands to make things in a
DS>> subdirectory named "obj".  I eventually discovered this gem in the
DS>> make man page:
DS>>
DS>>     In addition, make sets or knows about the following internal
DS>>     variables or environment variables:
DS>>
DS>>     ...
DS>>
DS>>     .OBJDIR	A path to the directory where the targets are built.  At
DS>> 		startup, make searches for an alternate directory to place
DS>> 		target files.  It will attempt to change into this special
DS>> 		directory and will search this directory for
DS>> 		found in the current directory.  The following directories
DS>> 		are tried in order:
DS>>
DS>> 		1.   ${MAKEOBJDIRPREFIX}/`pwd`
DS>> 		2.   ${MAKEOBJDIR}
DS>> 		3.   obj.${MACHINE}
DS>> 		4.   obj
DS>> 		5.   /usr/obj/`pwd`
DS>>	...
DS>>
DS>
DS>A little while later Peter Pentchev responded:
DS>>
DS>> Actually, this feature lies at the base of the FreeBSD base system build
DS>> infrastructure, and it is pretty much The Feature that allows us to
DS>> build from read-only and/or NFS-mounted sources shared among wide swarms
DS>> of machines :)
DS>>
DS>and
DS>>
DS>> Oh, and let's not forget cross-platform builds, too.
DS>>
DS>
DS>It is clear that a great deal of current FreeBSD OS makefile practice
DS>depends on the feature.  The tragedy is that it was never necessary to
DS>make the feature unavoidable.  Its invocation should have been dependent
DS>on using a special environment variable or make command option or makefile
DS>command or makefile variable.  Unfortunately, it seems that its invocation
DS>depends only on the presence of a subdirectory named "obj" in the directory
DS>in which the make command is invoked and there is NO WAY to avoid it.
DS>There seems to be absolutely nothing that I can put in my makefile to
DS>turn the feature off or to undo its effect.

I think this should be made conditional on the .POSIX target in the 
makefile. This way we don't loose this feature for system build but make 
our make more useable for outside packages. I have not yet looked into 
this.

harti

DS>
DS>It seems that I have no alternative but to rename my "obj" directory.
DS>Can someone suggest an alternative?  Note that it is not possible for me
DS>to set an environment variable (i.e. MAKEOBJDIR) before running make or
DS>to add an option to the make command line.  Any fix must be contained
DS>entirely within the makefile.  Setting .OBJDIR or MAKEOBJDIR within the
DS>makefile does not work.  Placing a "cd .." or "cd $(.CURDIR)" in front of
DS>every set of makefile shell commands is unthinkable.
DS>
DS>Dan Strick
DS>strick at covad.net
DS>
DS>(now *immensely* frustrated)
DS>_______________________________________________
DS>freebsd-hackers at freebsd.org mailing list
DS>http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
DS>To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
DS>
DS>
DS>


More information about the freebsd-hackers mailing list