@zifehng
2017-06-15T11:11:55.000000Z
字数 2386
阅读 4252
Android
make
本文基于Android5.1.1,其他版本仅供参考
伪目标clean在build/core/main.mk中定义如下:
.PHONY: clean
clean:
@rm -rf $(OUT_DIR)/*
@echo "Entire build directory removed."
执行make clean
将会会删除out/目录下所有内容。
伪目标clobber在build/core/main.mk中定义如下:
.PHONY: clobber
clobber: clean
执行make clobber
效果等同于make clean
,也是删除out/目录下所有内容。
伪目标dataclean在bulid/core/cleanbuild.mk中定义如下:
.PHONY: dataclean
dataclean: FILES := $(dataclean_files)
dataclean:
$(hide) rm -rf $(FILES)
@echo "Deleted emulator userdata images."
执行make dataclean
将会删除dataclean_files
,dataclean_files
定义如下:
# The files/dirs to delete during a dataclean, which removes any files
# in the staging and emulator data partitions.
dataclean_files := \
$(PRODUCT_OUT)/data/* \
$(PRODUCT_OUT)/data-qemu/* \
$(PRODUCT_OUT)/userdata-qemu.img
PRODUCT_OUT
展开为out/target/product/$(TARGET_DEVICE)
,根据注释,执行make dataclean
将会删除out目录下对应板级目录中data分区相关文件。
伪目标installclean在bulid/core/cleanbuild.mk中定义如下:
.PHONY: installclean
installclean: FILES := $(installclean_files)
installclean: dataclean
$(hide) rm -rf $(FILES)
@echo "Deleted images and staging directories."
执行make installclean
将会删除installclean_files
,installclean_files
定义如下:
#
# installclean logic
#
# The files/dirs to delete during an installclean. This includes the
# non-common APPS directory, which may contain the wrong resources.
#
# Deletes all of the files that change between different build types,
# like "make user" vs. "make sdk". This lets you work with different
# build types without having to do a full clean each time. E.g.:
#
# $ make -j8 all
# $ make installclean
# $ make -j8 user
# $ make installclean
# $ make -j8 sdk
#
installclean_files := \
$(HOST_OUT)/obj/NOTICE_FILES \
$(HOST_OUT)/sdk \
$(PRODUCT_OUT)/*.img \
$(PRODUCT_OUT)/*.ini \
$(PRODUCT_OUT)/*.txt \
$(PRODUCT_OUT)/*.xlb \
$(PRODUCT_OUT)/*.zip \
$(PRODUCT_OUT)/kernel \
$(PRODUCT_OUT)/data \
$(PRODUCT_OUT)/skin \
$(PRODUCT_OUT)/obj/APPS \
$(PRODUCT_OUT)/obj/NOTICE_FILES \
$(PRODUCT_OUT)/obj/PACKAGING \
$(PRODUCT_OUT)/recovery \
$(PRODUCT_OUT)/root \
$(PRODUCT_OUT)/system \
$(PRODUCT_OUT)/vendor \
$(PRODUCT_OUT)/oem \
$(PRODUCT_OUT)/userfastboot \
$(PRODUCT_OUT)/dex_bootjars \
$(PRODUCT_OUT)/obj/JAVA_LIBRARIES \
$(PRODUCT_OUT)/obj/FAKE \
$(PRODUCT_OUT)/obj/EXECUTABLES/adbd_intermediates \
$(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libfs_mgr_intermediates \
$(PRODUCT_OUT)/obj/EXECUTABLES/init_intermediates \
$(PRODUCT_OUT)/obj/ETC/mac_permissions.xml_intermediates \
$(PRODUCT_OUT)/obj/ETC/sepolicy_intermediates \
$(PRODUCT_OUT)/obj/ETC/init.environ.rc_intermediates
在切换编译目标时需要执行make installclean
,用以清除之前编译生成的文件。