6

It is written in the linux kernel Makefile that

clean - Remove most generated files but keep the config and
        enough build support to build external modules
mrproper - Remove all generated files + config + various backup files

And it is stated on the arch docs that

To finalise the preparation, ensure that the kernel tree is absolutely clean;

$ make clean && make mrproper

So if make mrproper does a more thorough remove, why is the make clean used?

9

According to the Linux kernel Makefile, the mrproper target depends on the clean target (see line 1324).

Executing make mrproper will therefore be enough as it would also remove the same things as what the clean target would do.

The mrproper target was added in 1993 (Linux 0.97.7) and has always depended on the clean target. This means that it was never necessary to use both targets as in make clean && make mrproper.

Reference: https://archive.org/details/git-history-of-linux

  • @derobert wow, great. So make clean is redundant, right? – sitilge Aug 22 '17 at 13:46
  • 2
    @sitilge yes, it's redundant, as make will run it anyway when you run make mrproper. – derobert Aug 22 '17 at 13:47
0

clean is a prerequisite for mrproper target in Makefile, so executing make clean separately is redundant.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.