# How to rebuild world after changing one .c file.



## Alain De Vos (May 20, 2021)

I changed one .c file in /usr/src and want to rebuild world but this seem to take ages ...


----------



## SirDice (May 20, 2021)

Add `-DNO_CLEAN` so it only rebuilds what is required to be rebuilt, instead of building everything from scratch.


----------



## zirias@ (May 20, 2021)

`-DNO_CLEAN` _can_ sometimes lead to strange problems (rare, but possible).

In most cases, using meta-mode solves this issue nicely:

make sure you have filemon(4) (filemon.ko) loaded
Add `WITH_META_MODE=yes` to /etc/src-env.conf
Edit: you need one complete build with meta-mode enabled before you can benefit from it


----------



## SirDice (May 20, 2021)

Zirias said:


> `-DNO_CLEAN` _can_ sometimes lead to strange problems (rare, but possible).


Yeah, don't use it when newvers.sh has been changed. It'll lead to some really weird version errors.


----------



## zirias@ (May 20, 2021)

SirDice said:


> Yeah, don't use it when newvers.sh has been changed. It'll lead to some really weird version errors.


I'd assume this is not the only thing that can go wrong with `-DNO_CLEAN`. Admittedly, it will work fine as a one-time solution when you really just did a trivial change 

Still, meta-mode is designed to address the problem once and for all without any risks. There are some complaints that even with meta-mode, there are situations with unnecessary rebuilds, but it does help a lot (and definitely works in this "trivial change" situation).


----------



## covacat (May 20, 2021)

you can build only the program / lib that the file belongs to
for most stuff cd /usr/src/bin/echo;make all install


----------

