User xmj shows us how to speed up your builds on FreeBSD. Head over to their Github for the full set of instructions.

If you’re repeatedly building components of the FreeBSD operating system – kernel, base or userland – you will be interested in optimizing the build duration. Luckily, over time the various commercial users of FreeBSD have figured out various ways of speeding up that build process. The probably most obvious way of shaving off time is through to not rebuild things that have not changed. In this article I’d like to show a few ways of achieving this from a user’s perspective.

METAMODE

For kernel/base builds, one way of achieving this is using meta mode. This makes make(1) capture information that will be relevant for next builds in a .meta file, such as the compiler invocation, files read during compile (including includes, and their location), libraries used, interesting syscalls issued, etc. make(1) achieves that by using the filemon(4) interface (required for e.g. tracing syscalls issued during make(1) execution). On subsequent runs, if a .meta file can be found, make(1) determines if the information in this .meta file still contains uptodate information (e.g. by comparing the proposed to the past compiler invocation), comparing access times for libraries and code used to the object previously built), and if not, rebuilds the object.

Full tutorial: https://xmj.github.io/articles/sysadmin/builds_ccache_memcached.html

Other: Turning FreeBSD to HardenedBSD