为什么同时使用“ make clean”和“ make mrproper”?


10

这是写在Linux内核Makefile

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

并在arch文档中指出

要完成准备工作,请确保内核树绝对干净。

$ make clean && make mrproper

那么如果make mrproper要彻底清除,为什么make clean要用呢?

Answers:


18

Linux内核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

根据Makefile,mrproper目标取决于clean目标(请参阅第1421行)。此外,distclean目标取决于mrproper

make mrproper因此执行就足够了,因为它也可以删除与clean目标将要做的事情相同的事情(甚至更多)。

mrproper1993年加入目标(的Linux 0.97.7),并一直依赖于clean目标。这意味着不必像中一样使用两个目标make clean && make mrproper

历史参考资料:https//archive.org/details/git-history-of-linux


@derobert哇,太好了。所以make clean是多余的,对不对?
sitilge

2
@sitilge是的,它是多余的,因为在您运行时make仍然可以运行它make mrproper
derobert

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.