Why both `make clean` and `make mrproper` are used?

Cleaning is done on three levels, as described in a comment in the Linux kernel Makefile:

###
# Cleaning is done on three levels.
# make clean     Delete most generated files
#                Leave enough to build external modules
# make mrproper  Delete the current configuration, and all generated files
# make distclean Remove editor backup files, patch leftover files and the like

According to the Makefile, the mrproper target depends on the clean target (see line 1421). Additionally, the distclean target depends on mrproper.

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

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.

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


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

Tags:

Linux

Gnu

Make