# Bug or feature? (about FreeBSD make)



## pjincz (Feb 6, 2013)

*W*hen a folder contains a sub folder names obj.
make run in a different (correct?) path.

*S*ee following:

```
[jcz@jcz-freebsd ~]$ mkdir test
[jcz@jcz-freebsd ~]$ cd test
[jcz@jcz-freebsd ~/test]$ echo -e "first:\n\tpwd" > Makefile
[jcz@jcz-freebsd ~/test]$ cat Makefile 
first:
        pwd
[jcz@jcz-freebsd ~/test]$ make
pwd
/usr/home/jcz/test
[jcz@jcz-freebsd ~/test]$ mkdir obj
[jcz@jcz-freebsd ~/test]$ make
pwd
/usr/home/jcz/test/obj
```


----------



## fonz (Feb 6, 2013)

pjincz said:
			
		

> When a folder[red]directory[/red] contains a sub folder[red]subdirectory[/red] names[red]name*d*[/red] obj.[red],[/red] make run[red]s[/red] in a different (correct?) path.


Admittedly, I normally use GNU Make (devel/gmake) because a) it's more widely used/supported, b) I just happen to be used to it and c) it appears to have more features, but I do seem to recall that BSD Make has this thing with obj directories. Does the man page (see make(1)) say anything about it?


----------



## Carpetsmoker (Feb 6, 2013)

This seems to be a feature.

From the manpage:

```
.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 folâ€
         lowing directories are tried in order:

         1.   ${MAKEOBJDIRPREFIX}/`pwd -P`
         2.   ${MAKEOBJDIR}
         3.   obj.${MACHINE}
         4.   obj
         5.   /usr/obj/`pwd -P`
```


----------



## fonz (Feb 6, 2013)

Carpetsmoker said:
			
		

> This seems to be a feature.
> 
> From the manpage:
> [snip]


Exactly. It may catch one off-guard if one is more used to GNU Make, but it does appear to be intended BSD Make behaviour.


----------



## pjincz (Feb 10, 2013)

3ks to everyone.
^_^


----------

