Is a `make clean` (and which one) needed after repository/ feeds update?

When I update an OpenWRT git checkout via

git pull
./scripts/feeds update -a
./scripts/feeds install -a

, and I then want to build some new package not previously built, do I then need to issue some cleaning process (make clean, make targetclean or make dirclean; and which one of them?), or does the build system automatically recognise what has been changed and what needs to be rebuilt,, down to every dependency?

Regards!

The relevant wiki: https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem#cleaning_up

2 Likes

Yes, I have read it.
This does not state when I should make a clean and which. It does state that I might need to clean up "every now and then".

That's why I am wondering:

  • What is this "every now and then"?
  • Which cleanup is needed when?

And in this case I phrased my confusion into a specific question about if, and if yes, which, cleanup should be done after a git repository update.

./scripts/feeds clean
./scripts/feeds update -a
./scripts/feeds install -a

1 Like

make clean before a build to ensure that no outdated artifacts have been left from the previous builds.

I run this before every build. Equivalent to rm -rf bin build_dir tmp

make targetclean does make clean and deletes also the directories /build_dir/toolchain* and /staging_dir/toolchain* (= the cross-compile tools).

Used if I change from gcc8.x to gcc11.x in my build environment. Rebuilds the tool chain.

make dirclean I would use this when moving from master to Stable or between releases.

make distclean erases your build configuration <buildroot>/.config. Use only if you need a “factory reset” of the system.

Personally, I just recreate my buildroot environment instead.

For the most part, these are the rule of thumb I follow. YMMV.

2 Likes

Thanks, @RuralRoots, for the more detailed explanation!

Should this also be done as a rule of thumb when there is an error in the build process, the error gets resolved by changing the configuration/ Makefile, and then continue building, when no other packages are updated? Or is it in that case safe just to continue building?

I ask because rebuilding everything takes a looong time, even with ccache.

A failed build shouldn’t require a make clean.

make -j1 V=sc, find/resolve your error, and initiate your make -j $(($(nproc)+1)) again.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.