# Incremental build



## prathapreddy (Nov 4, 2015)

I am new to FreeBSD. I want to learn more about FreeBSD and improve my developer skills and learn about some protocols like DNS and DHCP. I am able to successfully  compile FreeBSD source by using command `make buildworld`. But I want to change some code in some specific file  and do incremental build only specific file/folder because full build is taking 6 hrs ~.

Can somebody please provide info regarding incremental builds.

I am using freebsdFreeBSD 10.2.


----------



## SirDice (Nov 4, 2015)

I'm not sure if it's enough (I always do a full build) but try `make -DNO_CLEAN buildworld`. That should build only the changed bits. See build(7):

```
NO_CLEAN               If set, no object tree files are cleaned at all.
                            Setting NO_CLEAN implies NO_KERNELCLEAN, so when
                            NO_CLEAN is set no kernel objects are cleaned
                            either.
```

And depending on where you've made the changes you can also do a `make install` inside one of the directories in the source tree.


----------



## Juanitou (Nov 4, 2015)

Try also devel/ccache.


----------



## forquare (Nov 21, 2015)

SirDice said:


> I'm not sure if it's enough (I always do a full build) but try `make -DNO_CLEAN buildworld`. That should build only the changed bits. See build(7):
> 
> ```
> NO_CLEAN               If set, no object tree files are cleaned at all.
> ...



Wowza, I stumbled across this while browsing the forums and tried it out - brought a five hour build down to less than ten minutes!  Out of interest, is there a good reason for not doing these incremental builds?  i.e. is there a good reason for doing a "clean" build?


----------



## protocelt (Nov 21, 2015)

Generally, if you are compiling a RELEASE branch incremental builds are fine as no major changes are brought in. If you are running STABLE or CURRENT there can be some problems here and there by doing incremental builds as larger changes are brought into those branches, especially CURRENT. I always do a full build as I use both the STABLE and CURRENT branches.


----------

