[关闭]
@zifehng 2017-06-15T11:11:55.000000Z 字数 2386 阅读 4252

Android make清除命令

Android make


本文基于Android5.1.1,其他版本仅供参考

1. make clean

伪目标clean在build/core/main.mk中定义如下:

  1. .PHONY: clean
  2. clean:
  3. @rm -rf $(OUT_DIR)/*
  4. @echo "Entire build directory removed."

执行make clean将会会删除out/目录下所有内容。

2. make clobber

伪目标clobber在build/core/main.mk中定义如下:

  1. .PHONY: clobber
  2. clobber: clean

执行make clobber效果等同于make clean,也是删除out/目录下所有内容。

3. make dataclean

伪目标dataclean在bulid/core/cleanbuild.mk中定义如下:

  1. .PHONY: dataclean
  2. dataclean: FILES := $(dataclean_files)
  3. dataclean:
  4. $(hide) rm -rf $(FILES)
  5. @echo "Deleted emulator userdata images."

执行make dataclean将会删除dataclean_files,dataclean_files定义如下:

  1. # The files/dirs to delete during a dataclean, which removes any files
  2. # in the staging and emulator data partitions.
  3. dataclean_files := \
  4. $(PRODUCT_OUT)/data/* \
  5. $(PRODUCT_OUT)/data-qemu/* \
  6. $(PRODUCT_OUT)/userdata-qemu.img

PRODUCT_OUT展开为out/target/product/$(TARGET_DEVICE),根据注释,执行make dataclean将会删除out目录下对应板级目录中data分区相关文件。

4. make installclean

伪目标installclean在bulid/core/cleanbuild.mk中定义如下:

  1. .PHONY: installclean
  2. installclean: FILES := $(installclean_files)
  3. installclean: dataclean
  4. $(hide) rm -rf $(FILES)
  5. @echo "Deleted images and staging directories."

执行make installclean将会删除installclean_files,installclean_files定义如下:

  1. #
  2. # installclean logic
  3. #
  4. # The files/dirs to delete during an installclean. This includes the
  5. # non-common APPS directory, which may contain the wrong resources.
  6. #
  7. # Deletes all of the files that change between different build types,
  8. # like "make user" vs. "make sdk". This lets you work with different
  9. # build types without having to do a full clean each time. E.g.:
  10. #
  11. # $ make -j8 all
  12. # $ make installclean
  13. # $ make -j8 user
  14. # $ make installclean
  15. # $ make -j8 sdk
  16. #
  17. installclean_files := \
  18. $(HOST_OUT)/obj/NOTICE_FILES \
  19. $(HOST_OUT)/sdk \
  20. $(PRODUCT_OUT)/*.img \
  21. $(PRODUCT_OUT)/*.ini \
  22. $(PRODUCT_OUT)/*.txt \
  23. $(PRODUCT_OUT)/*.xlb \
  24. $(PRODUCT_OUT)/*.zip \
  25. $(PRODUCT_OUT)/kernel \
  26. $(PRODUCT_OUT)/data \
  27. $(PRODUCT_OUT)/skin \
  28. $(PRODUCT_OUT)/obj/APPS \
  29. $(PRODUCT_OUT)/obj/NOTICE_FILES \
  30. $(PRODUCT_OUT)/obj/PACKAGING \
  31. $(PRODUCT_OUT)/recovery \
  32. $(PRODUCT_OUT)/root \
  33. $(PRODUCT_OUT)/system \
  34. $(PRODUCT_OUT)/vendor \
  35. $(PRODUCT_OUT)/oem \
  36. $(PRODUCT_OUT)/userfastboot \
  37. $(PRODUCT_OUT)/dex_bootjars \
  38. $(PRODUCT_OUT)/obj/JAVA_LIBRARIES \
  39. $(PRODUCT_OUT)/obj/FAKE \
  40. $(PRODUCT_OUT)/obj/EXECUTABLES/adbd_intermediates \
  41. $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libfs_mgr_intermediates \
  42. $(PRODUCT_OUT)/obj/EXECUTABLES/init_intermediates \
  43. $(PRODUCT_OUT)/obj/ETC/mac_permissions.xml_intermediates \
  44. $(PRODUCT_OUT)/obj/ETC/sepolicy_intermediates \
  45. $(PRODUCT_OUT)/obj/ETC/init.environ.rc_intermediates

在切换编译目标时需要执行make installclean,用以清除之前编译生成的文件。

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注