make mrproper与make clean

编译内核时,我常用到make clean,把之前编译产生的.o文件清除,进行一些配置修改后,再重新编译。

在编译内核模块时,会用到make mrproper,目的是把下载的内核还原到初始状态(清除掉.o文件,清除掉一些在make之后生成的备份文件,甚至还清除了.config配置文件)。

在make mrproper时,会首先调用make clean。

至于要清除些什么东西,要查看内核源文件中的Makefile,仅仅一个Makefile就有1500行,不得不感慨它的强大。

Makefile里这么描述mrproper的:
“Delete all generated files, including .config”
对应的规则为:

mrproper: rm-dirs := $(wildcard $(MRPROPER_DIRS))
mrproper: rm-files := $(wildcard $(MRPROPER_FILES))
mrproper-dirs := $(addprefix _mrproper_,Documentation/DocBook scripts)

PHONY += $(mrproper-dirs) mrproper archmrproper
$(mrproper-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _mrproper_%,%,$@)

mrproper: clean archmrproper $(mrproper-dirs)
$(call cmd,rmdirs)
$(call cmd,rmfiles)

虽然前面几条,看不懂,但最后一条:
mrproper: clean archmrproper $(mrproper-dirs)
明确的说明了在执行make mrproper之前会先make clean、make archmrproper及make $(mrproper-dirs)。

还有扩展一下:
make distclean
Makefile里有这么几行:

distclean: mrproper
@find $(srctree) $(RCS_FIND_IGNORE) \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' -o -size 0 \
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-type f -print | xargs rm -f

说明,在执行make distclean时,会先make mrproper。


至于make clean、make mrproper及make distclean的作用是什么,查到再添加。


more:
1、[url=http://blog.csdn.net/ce123/article/details/7237989]make clean、make mrproer 以及make distclean的区别[/url]
2、[url=http://blog.csdn.net/ce123/article/details/6922398]make mrproper及mrproper的含义[/url]
3、[url=http://blog.21ic.com/user1/8467/archives/2012/89860.html]Linux内核——make mrproper与make clean的区别[/url]

4、[url=http://wiki.centos.org/HowTos/BuildingKernelModules]Build Your Own Kernel Modules[/url]
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值