# Portmaster and make flags



## tanked (Nov 29, 2009)

Hello,

Can someone tell me how (or if I should) pass the -j make flag to portmaster as I'm now using a multi-core machine.

Thanks.


----------



## hedwards (Nov 30, 2009)

Add something like MAKE_JOBS_NUMBER=3 to your /etc/make.conf should make it so, at least for those ports that are safely compiled like that. EDIT: By which I mean give you that extra job on a dual core processor rather than defaulting to one per core.

http://lists.freebsd.org/pipermail/freebsd-ports/2009-March/053736.html has more information on that.

EDIT: Thanks for asking, I was too lazy to look it up for myself earlier today.


----------



## tanked (Nov 30, 2009)

Thankyou - does that option also apply to kernel & userland compiles?


----------



## tankist02 (Nov 30, 2009)

To compile kernel and world in parallel manner I use the -j flag on 4-core machine:


```
cd /usr/src && make cleanworld && make -j8 buildworld && make -j8 kernel
```


----------



## DutchDaemon (Nov 30, 2009)

I think you're supposed to feed (cores + 1) to -j, not (cores * 2).


----------



## phoenix (Nov 30, 2009)

The "rule of thumb" is (cores + 1).  However, it's very dependent on the system, and some local testing will show the optimal number.  Some machines work better with more than (cores + 1).  Others work better with less.

Running [cmd=]time -h make -j X buildworld[/cmd] with different values of X is quite enlightening.  Especially if you put /usr/obj onto a separate filesystem and newfs it between runs (and reboot to clear out RAM).


----------

