博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
make clean、 make mrproper、make distclean的区别
阅读量:4077 次
发布时间:2019-05-25

本文共 1545 字,大约阅读时间需要 5 分钟。

内核编译时, 到底用make clean, make mrproper还是make distclean
在编译内核时, 被make clean, make mrproer 和 make distclean搞的纠结, 稍微总结一下这三者之间的区别:
解压内核源码包后, 到内核源代码目录树的顶层目录, 执行
# make help
Cleaning targets:

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

distclean    - mrproper + remove editor backup and patch files

make help的结果:

make clean                    删除大多数的编译生成文件, 但是会保留内核的配置文件.config, 还有足够的编译支持来建立扩展模块
make mrproper             删除所有的编译生成文件, 还有内核配置文件, 再加上各种备份文件
make distclean              mrproper删除的文件, 加上编辑备份文件和一些补丁文件。

看帮助可以发现删除的文件范围从小到大依次为: make clean < make mrproper < make distclean, 查看源码目录树的顶层目录下的Makefile求证, 可以发现:
clean: archclean $(clean-dirs)
$(call cmd,rmdirs)
$(call cmd,rmfiles)
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.symtypes' -o -name 'modules.order' \
-o -name 'Module.markers' \) \
-type f -print | xargs rm -f
mrproper: clean archmrproper $(mrproper-dirs)
$(call cmd,rmdirs)
$(call cmd,rmfiles)
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 mrproper, 会先执行make clean, 执行make distclean之前, 会先执行make mrproper。
其实, 对于一个刚刚从kernel.org上下载的内核源码包, 可以不用执行make clean/make mrproper/make distclean, 因为源码包的状态本身就是clean的。

转载地址:http://tzjni.baihongyu.com/

你可能感兴趣的文章
linux环境下C语言中sleep的问题
查看>>
ubuntu 12.04 安装 GMA3650驱动
查看>>
新版本的linux如何生成xorg.conf
查看>>
xorg.conf的编写
查看>>
启用SELinux时遇到的问题
查看>>
virbr0 虚拟网卡卸载方法
查看>>
No devices detected. Fatal server error: no screens found
查看>>
新版本的linux如何生成xorg.conf
查看>>
virbr0 虚拟网卡卸载方法
查看>>
Centos 6.0_x86-64 终于成功安装官方显卡驱动
查看>>
Linux基础教程:CentOS卸载KDE桌面
查看>>
db sql montior
查看>>
read humor_campus
查看>>
IBM WebSphere Commerce Analyzer
查看>>
Unix + OS IBM Aix FTP / wu-ftp / proftp
查看>>
my read work
查看>>
db db2 base / instance database tablespace container
查看>>
hd disk / disk raid / disk io / iops / iostat / iowait / iotop / iometer
查看>>
project ASP.NET
查看>>
db db2_monitorTool IBM Rational Performace Tester
查看>>