# make option during kernel build to put object files in separate directory



## bsd_newbie (Mar 4, 2009)

What is the option to make to have it put .o files in a user specified directory.

So instead of just saying make buildkernel KERNCONF=MYKERNEL,

I would like to add an extra option to specify a path where object files should be put, rather than the default path.

thanks.


----------



## SirDice (Mar 4, 2009)

If I read this bit of /usr/src/Makefile correctly:

```
MAKEOBJDIRPREFIX?=      /usr/obj
_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
    ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
    -f /dev/null -V MAKEOBJDIRPREFIX dummy
.if !empty(_MAKEOBJDIRPREFIX)
.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
        (in make.conf(5)) or command-line variable.
```

You'll need to set the MAKEOBJDIRPREFIX environment variable.


----------

