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 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    刪除的文件, 加上編輯備份文件和一些補丁文件。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章