歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> make clean、make mrproer及make distclean有什麼區別

make clean、make mrproer及make distclean有什麼區別

日期:2017/3/3 15:55:54   编辑:關於Linux

解壓內核源碼包後, 到內核源代碼目錄樹的頂層目錄, 執行

# 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 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。

再回到make help的結果:

make clean 刪除大多數的編譯生成文件, 但是會保留內核的配置文件.config, 還有足夠的編譯支持來建立擴展模塊

make mrproper 刪除所有的編譯生成文件, 還有內核配置文件, 再加上各種備份文件

make distclean mrproper 刪除的文件, 加上編輯備份文件和一些補丁文件。

更多精彩內容:http://www.bianceng.cn/OS/Linux/

Copyright © Linux教程網 All Rights Reserved