# make buildworld speed up possibilities



## deadbeef (Nov 23, 2019)

Im new to freebsd and want/have to compile the system by myself.
are there some tweaks or pro-tipps to speed up the whole process (besides the -j option)?
what to do if the compilation fails?
what will happen next if I cancel the process mid compilation?
'make' should begin from the point which was the last target, is that right?


----------



## Crivens (Nov 23, 2019)

Make starts by doing a 'clean'. You need to pass NO_CLEAN=YES to make to skip this.
Read the makefile for options and targets.


----------



## Phishfry (Nov 23, 2019)

I just wanted to add that the -j option is only recommended for the build stage, not install stage.
The reason is that install stage needs to happen in-order, while the build stage can run parallel.

Also there is a shorter NO_CLEAN directive.
`make -DNO_CLEAN buildkernel`
This would be useful if repetitively building the kernel.

The build directives can be found in the source files.
/usr/src/Makefile
/usr/src/Makefile.inc1
The -DNO flags are not really optimizations and you really need to understand what they do before applying them.


----------



## laurentis (Nov 23, 2019)

I'd recommend the use of 'meta mode' for incremental builds. You'll just need to run make cleanworld once. After the first build in 'meta mode', the system will just rebuild what has changed since the last build.  https://wiki.freebsd.org/MateuszPiotrowski/MetaMode


----------



## olafz (Nov 25, 2019)

What about using devel/ccache? Good or bad idea?


----------



## ljboiler (Nov 25, 2019)

laurentis said:


> You'll just need to run make cleanworld once.



Or just `rm -rf /usr/obj`


----------



## laurentis (Nov 26, 2019)

olafz said:


> What about using devel/ccache? Good or bad idea?


I've been using devel/ccache in conjunction with META_MODE with no issues. So I'd say it's fine from my personal experience.


----------

