Loading CleanSpec.mk +5 −0 Original line number Diff line number Diff line Loading @@ -405,6 +405,11 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/lib*) # Revert that move $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/lib*) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ core/base_rules.mk +10 −159 Original line number Diff line number Diff line Loading @@ -78,8 +78,6 @@ ifdef LOCAL_2ND_ARCH_VAR_PREFIX endif endif my_module_is_soong := $(if $(filter $(OUT_DIR)/soong/%,$(LOCAL_MODULE_MAKEFILE)),true,false) # Ninja has an implicit dependency on the command being run, and kati will # regenerate the ninja manifest if any read makefile changes, so there is no # need to have dependencies on makefiles. Loading Loading @@ -165,14 +163,6 @@ my_module_path := $(strip $(LOCAL_MODULE_PATH)) endif my_module_path := $(patsubst %/,%,$(my_module_path)) my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH)) # my_module_default_path is the path that is automatically chosen according to the attributes of # a module. It is used when the module does not explicitly specify install path using LOCAL_MODULE_PATH. # If LOCAL_MODULE_PATH is specified, it is always respected and my_module_default_path is # ignored. However, for shared libraries, such conflict generates warning so that module owner # can place the library in the correct location (, stop using LOCAL_MODULE_PATH, or migrate to Soong to # be better). my_module_default_path := ifdef LOCAL_IS_HOST_MODULE partition_tag := else Loading @@ -190,137 +180,20 @@ else partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA) endif endif ifeq ($(my_module_path),) install_path_var := $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS) ifeq (true,$(LOCAL_PRIVILEGED_MODULE)) install_path_var := $(install_path_var)_PRIVILEGED endif my_module_default_path := $($(install_path_var)) ifeq ($(strip $(my_module_path)$(my_module_default_path)),) $(call pretty-error,internal error in base_rules.mk; $(install_path_var) is not defined.) endif # Determine lib_type and do some sanity checks. ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),SHARED_LIBRARIES) ifneq ($(filter $(LOCAL_MODULE),$(addprefix lib,$(NDK_PREBUILT_SHARED_LIBRARIES))),) ifneq ($(partition_tag),) $(call pretty-error,"NDK library must be installed at system partition, where other libraries will look for it. It cannot be moved.") endif lib_type := ndk else ifneq ($(filter $(LOCAL_MODULE),$(VNDK_LIBRARIES) $(VNDK_INDIRECT_LIBRARIES)),) ifneq ($(partition_tag),) $(call pretty-error,"VNDK library must be installed at system partition. DO NOT modify VNDK_LIBRARIES or VNDK_LIBRARIES. \ If your library needs to be shared between system.img and vendor.img then define it as a VNDK-ext library. Use vndk_ext_library {...} \ in Android.bp to do so.") endif lib_type := vndk else ifneq ($(filter $(LOCAL_MODULE),$(BOARD_SAME_PROCESS_HAL_DEPS)),) # List of libraries implementing same-process HALs (and their internal sub-libraries) is # defined by vendors. ifeq ($(partition_tag),) $(call pretty-error,Sameprocess HAL must not be installed at system partition) endif lib_type := sameprocess_hal else ifeq ($(LOCAL_IS_HOST_MODULE)$(partition_tag),) lib_type := framework else ifneq ($(partition_tag),_DATA) # Here, vendor means vendor/oem/odm lib_type := vendor_provided else # Test, samples lib falls into this. No lib_type required for them. ifeq ($(filter tests samples,$(LOCAL_MODULE_TAGS)),) $(call pretty-warning,Cannot determine the type of this library) endif lib_type := my_module_path := $($(install_path_var)) ifeq ($(strip $(my_module_path)),) $(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)") endif else lib_type := endif # This is the default path until N. From O, the default path is changed. # Let's save the old default path in case we need a symlink to it later. my_module_pre_o_default_path := $(my_module_default_path) # Special case for pre_o_default_path of Soong defined modules. # For those modules, we guess their pre_o_default_path by removing /ndk, /vndk, etc. # from their LOCAL_MODULE_PATH. This is because relative_install_path is already # embedded to my_module_path. ifeq ($(my_module_is_soong),true) ifndef LOCAL_IS_HOST_MODULE ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES) my_module_pre_o_default_path := $(my_module_path) my_module_pre_o_default_path := $(subst /vndk-ext,,$(my_module_pre_o_default_path)) my_module_pre_o_default_path := $(subst /vndk,,$(my_module_pre_o_default_path)) my_module_pre_o_default_path := $(subst /ndk,,$(my_module_pre_o_default_path)) my_module_pre_o_default_path := $(subst /sameprocess,,$(my_module_pre_o_default_path)) endif endif endif # Amend the default_path once again depending on lib_type. This is new from O. ifeq ($(lib_type),vndk) my_module_default_path := $(my_module_default_path)/vndk # TODO(b/35020246): before P, we should support installing two snapshots of VNDK # libraries. One for framework libs and execs and the other for vendor libs and execs. else ifeq ($(lib_type),ndk) my_module_default_path := $(my_module_default_path)/ndk else ifeq ($(lib_type),sameprocess_hal) my_module_default_path := $(my_module_default_path)/sameprocess endif # Relative path is appended to path resolved so far ifneq ($(my_module_relative_path),) my_module_default_path := $(my_module_default_path)/$(my_module_relative_path) my_module_pre_o_default_path := $(my_module_pre_o_default_path)/$(my_module_relative_path) ifneq ($(my_module_path),) my_module_path := $(my_module_path)/$(my_module_relative_path) endif endif _lib_moved := ifeq ($(my_module_path),) # If LOCAL_MODULE_PATH is not specified, use the automatically determined path. my_module_path := $(my_module_default_path) # Mark if the lib is installed to a different path than before. With this hint, # a symlink is created if BOARD_SYMLINK_FOR_LIBS is true. ifneq ($(my_module_path),$(my_module_pre_o_default_path)) _lib_moved := true endif else # If LOCAL_MODULE_PATH is specified, we respect it. ifndef LOCAL_IS_HOST_MODULE ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES) ifeq ($(filter $(TARGET_OUT_DATA)%,$(my_module_path)),) # However, we are kind enough to warn if it seems to be wrong. # Warn only for Android.mk defined shared libraries that will be installed # to system or vendor partition. For other types of files - especially # Soong-defined libs -, we don't warn because Soong always gives us correct # paths. ifeq ($(my_module_is_soong),false) ifneq ($(my_module_path),$(my_module_default_path)) ifeq ($(SHOW_MODULE_PATH_WARNINGS),true) # TODO(b/35020635): s/warning/error/ $(call pretty-warning,$(lib_type) library must be installed to \ $(subst $(PRODUCT_OUT)/,,$(my_module_default_path)) but requested to be installed at \ $(subst $(PRODUCT_OUT)/,,$(my_module_path)). Please fix.) endif endif else # For Soong-defined module, symlink is provided if the path has been amended # ...except for vndk-ext libraries because there already is a symlink for the # vndk (unmodified) version of the vndk-ext library. ifneq ($(my_module_path),$(my_module_pre_o_default_path)) ifeq ($(filter vndk-ext,$(subst /,$(space),$(my_module_path))),) _lib_moved := true endif endif endif endif endif endif endif endif # not LOCAL_UNINSTALLABLE_MODULE ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),) Loading Loading @@ -511,30 +384,8 @@ endif # !LOCAL_IS_HOST_MODULE # Rule to install the module's companion symlinks my_installed_symlinks := $(addprefix $(my_module_path)/,$(LOCAL_MODULE_SYMLINKS) $(LOCAL_MODULE_SYMLINKS_$(my_32_64_bit_suffix))) # If this lib is installed to the different directory than before, # make a symlink from the old path to the new path. # This symlink is required because there are so many plances that expect the old # path (e.g. systemproperty rild.libpath). Until that places are all fixed, # we keep this symlink. # TODO(b/34917183): remove symlinks after everything migrations to the new paths; # this should be done before O launch unless it will be a security hole that # we can't restrict access to a certain set of libraries by using the directory # path. ifneq ($(BOARD_SYMLINK_FOR_LIBS),false) ifeq ($(_lib_moved),true) my_installed_symlinks += $(my_module_pre_o_default_path)/$(my_installed_module_stem) endif else # Symlinks for ndk libs are permanent. ifeq ($(lib_type)$(_lib_moved),ndktrue) my_installed_symlinks += $(my_module_pre_o_default_path)/$(my_installed_module_stem) endif endif # Make a symlink $(symlink) -> $(LOCAL_INSTALLED_MODULE) $(foreach symlink,$(my_installed_symlinks),\ $(call symlink-file,$(LOCAL_INSTALLED_MODULE),$(LOCAL_INSTALLED_MODULE),$(symlink),true)) $(call symlink-file,$(LOCAL_INSTALLED_MODULE),$(my_installed_module_stem),$(symlink))) $(my_all_targets) : | $(my_installed_symlinks) Loading core/definitions.mk +3 −7 Original line number Diff line number Diff line Loading @@ -2845,10 +2845,8 @@ endef # Define a rule to create a symlink to a file. # $(1): full path to source # $(2): target of the link # $(3): full path of the symlink # $(4): (optional) when set to true, $(2) is recognized as a path from the build root and # thus -r option is used to link $(3) to $(2). Off by default. # $(2): source (may be relative) # $(3): full path to destination define symlink-file $(eval $(_symlink-file)) endef Loading @@ -2860,9 +2858,7 @@ $(3): | $(1) @echo "Symlink: $$@ -> $(2)" @mkdir -p $(dir $$@) @rm -rf $$@ $(if $(filter true,$(4)),\ $(hide) python -c "import os.path; import os; os.symlink(os.path.relpath('$(2)','$(dir $(3))'), '$$@')",\ $(hide) ln -sf $(2) $$@) $(hide) ln -sf $(2) $$@ endef ########################################################### Loading core/soong_config.mk +1 −3 Original line number Diff line number Diff line Loading @@ -69,9 +69,7 @@ $(SOONG_VARIABLES): FORCE echo ''; \ echo ' "ArtUseReadBarrier": $(if $(filter false,$(PRODUCT_ART_USE_READ_BARRIER)),false,true),'; \ echo ''; \ echo ' "BtConfigIncludeDir": "$(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)",'; \ echo ''; \ echo ' "SameProcessHalDeps": [$(if $(BOARD_SAME_PROCESS_HAL_DEPS),"$(subst $(space),"$(comma)",$(BOARD_SAME_PROCESS_HAL_DEPS))")]'; \ echo ' "BtConfigIncludeDir": "$(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)"'; \ echo '}') > $(SOONG_VARIABLES_TMP); \ if ! cmp -s $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); then \ mv $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); \ Loading Loading
CleanSpec.mk +5 −0 Original line number Diff line number Diff line Loading @@ -405,6 +405,11 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/lib*) # Revert that move $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/lib*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/vendor/lib*) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************
core/base_rules.mk +10 −159 Original line number Diff line number Diff line Loading @@ -78,8 +78,6 @@ ifdef LOCAL_2ND_ARCH_VAR_PREFIX endif endif my_module_is_soong := $(if $(filter $(OUT_DIR)/soong/%,$(LOCAL_MODULE_MAKEFILE)),true,false) # Ninja has an implicit dependency on the command being run, and kati will # regenerate the ninja manifest if any read makefile changes, so there is no # need to have dependencies on makefiles. Loading Loading @@ -165,14 +163,6 @@ my_module_path := $(strip $(LOCAL_MODULE_PATH)) endif my_module_path := $(patsubst %/,%,$(my_module_path)) my_module_relative_path := $(strip $(LOCAL_MODULE_RELATIVE_PATH)) # my_module_default_path is the path that is automatically chosen according to the attributes of # a module. It is used when the module does not explicitly specify install path using LOCAL_MODULE_PATH. # If LOCAL_MODULE_PATH is specified, it is always respected and my_module_default_path is # ignored. However, for shared libraries, such conflict generates warning so that module owner # can place the library in the correct location (, stop using LOCAL_MODULE_PATH, or migrate to Soong to # be better). my_module_default_path := ifdef LOCAL_IS_HOST_MODULE partition_tag := else Loading @@ -190,137 +180,20 @@ else partition_tag := $(if $(call should-install-to-system,$(my_module_tags)),,_DATA) endif endif ifeq ($(my_module_path),) install_path_var := $(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS) ifeq (true,$(LOCAL_PRIVILEGED_MODULE)) install_path_var := $(install_path_var)_PRIVILEGED endif my_module_default_path := $($(install_path_var)) ifeq ($(strip $(my_module_path)$(my_module_default_path)),) $(call pretty-error,internal error in base_rules.mk; $(install_path_var) is not defined.) endif # Determine lib_type and do some sanity checks. ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),SHARED_LIBRARIES) ifneq ($(filter $(LOCAL_MODULE),$(addprefix lib,$(NDK_PREBUILT_SHARED_LIBRARIES))),) ifneq ($(partition_tag),) $(call pretty-error,"NDK library must be installed at system partition, where other libraries will look for it. It cannot be moved.") endif lib_type := ndk else ifneq ($(filter $(LOCAL_MODULE),$(VNDK_LIBRARIES) $(VNDK_INDIRECT_LIBRARIES)),) ifneq ($(partition_tag),) $(call pretty-error,"VNDK library must be installed at system partition. DO NOT modify VNDK_LIBRARIES or VNDK_LIBRARIES. \ If your library needs to be shared between system.img and vendor.img then define it as a VNDK-ext library. Use vndk_ext_library {...} \ in Android.bp to do so.") endif lib_type := vndk else ifneq ($(filter $(LOCAL_MODULE),$(BOARD_SAME_PROCESS_HAL_DEPS)),) # List of libraries implementing same-process HALs (and their internal sub-libraries) is # defined by vendors. ifeq ($(partition_tag),) $(call pretty-error,Sameprocess HAL must not be installed at system partition) endif lib_type := sameprocess_hal else ifeq ($(LOCAL_IS_HOST_MODULE)$(partition_tag),) lib_type := framework else ifneq ($(partition_tag),_DATA) # Here, vendor means vendor/oem/odm lib_type := vendor_provided else # Test, samples lib falls into this. No lib_type required for them. ifeq ($(filter tests samples,$(LOCAL_MODULE_TAGS)),) $(call pretty-warning,Cannot determine the type of this library) endif lib_type := my_module_path := $($(install_path_var)) ifeq ($(strip $(my_module_path)),) $(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)") endif else lib_type := endif # This is the default path until N. From O, the default path is changed. # Let's save the old default path in case we need a symlink to it later. my_module_pre_o_default_path := $(my_module_default_path) # Special case for pre_o_default_path of Soong defined modules. # For those modules, we guess their pre_o_default_path by removing /ndk, /vndk, etc. # from their LOCAL_MODULE_PATH. This is because relative_install_path is already # embedded to my_module_path. ifeq ($(my_module_is_soong),true) ifndef LOCAL_IS_HOST_MODULE ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES) my_module_pre_o_default_path := $(my_module_path) my_module_pre_o_default_path := $(subst /vndk-ext,,$(my_module_pre_o_default_path)) my_module_pre_o_default_path := $(subst /vndk,,$(my_module_pre_o_default_path)) my_module_pre_o_default_path := $(subst /ndk,,$(my_module_pre_o_default_path)) my_module_pre_o_default_path := $(subst /sameprocess,,$(my_module_pre_o_default_path)) endif endif endif # Amend the default_path once again depending on lib_type. This is new from O. ifeq ($(lib_type),vndk) my_module_default_path := $(my_module_default_path)/vndk # TODO(b/35020246): before P, we should support installing two snapshots of VNDK # libraries. One for framework libs and execs and the other for vendor libs and execs. else ifeq ($(lib_type),ndk) my_module_default_path := $(my_module_default_path)/ndk else ifeq ($(lib_type),sameprocess_hal) my_module_default_path := $(my_module_default_path)/sameprocess endif # Relative path is appended to path resolved so far ifneq ($(my_module_relative_path),) my_module_default_path := $(my_module_default_path)/$(my_module_relative_path) my_module_pre_o_default_path := $(my_module_pre_o_default_path)/$(my_module_relative_path) ifneq ($(my_module_path),) my_module_path := $(my_module_path)/$(my_module_relative_path) endif endif _lib_moved := ifeq ($(my_module_path),) # If LOCAL_MODULE_PATH is not specified, use the automatically determined path. my_module_path := $(my_module_default_path) # Mark if the lib is installed to a different path than before. With this hint, # a symlink is created if BOARD_SYMLINK_FOR_LIBS is true. ifneq ($(my_module_path),$(my_module_pre_o_default_path)) _lib_moved := true endif else # If LOCAL_MODULE_PATH is specified, we respect it. ifndef LOCAL_IS_HOST_MODULE ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES) ifeq ($(filter $(TARGET_OUT_DATA)%,$(my_module_path)),) # However, we are kind enough to warn if it seems to be wrong. # Warn only for Android.mk defined shared libraries that will be installed # to system or vendor partition. For other types of files - especially # Soong-defined libs -, we don't warn because Soong always gives us correct # paths. ifeq ($(my_module_is_soong),false) ifneq ($(my_module_path),$(my_module_default_path)) ifeq ($(SHOW_MODULE_PATH_WARNINGS),true) # TODO(b/35020635): s/warning/error/ $(call pretty-warning,$(lib_type) library must be installed to \ $(subst $(PRODUCT_OUT)/,,$(my_module_default_path)) but requested to be installed at \ $(subst $(PRODUCT_OUT)/,,$(my_module_path)). Please fix.) endif endif else # For Soong-defined module, symlink is provided if the path has been amended # ...except for vndk-ext libraries because there already is a symlink for the # vndk (unmodified) version of the vndk-ext library. ifneq ($(my_module_path),$(my_module_pre_o_default_path)) ifeq ($(filter vndk-ext,$(subst /,$(space),$(my_module_path))),) _lib_moved := true endif endif endif endif endif endif endif endif # not LOCAL_UNINSTALLABLE_MODULE ifneq ($(strip $(LOCAL_BUILT_MODULE)$(LOCAL_INSTALLED_MODULE)),) Loading Loading @@ -511,30 +384,8 @@ endif # !LOCAL_IS_HOST_MODULE # Rule to install the module's companion symlinks my_installed_symlinks := $(addprefix $(my_module_path)/,$(LOCAL_MODULE_SYMLINKS) $(LOCAL_MODULE_SYMLINKS_$(my_32_64_bit_suffix))) # If this lib is installed to the different directory than before, # make a symlink from the old path to the new path. # This symlink is required because there are so many plances that expect the old # path (e.g. systemproperty rild.libpath). Until that places are all fixed, # we keep this symlink. # TODO(b/34917183): remove symlinks after everything migrations to the new paths; # this should be done before O launch unless it will be a security hole that # we can't restrict access to a certain set of libraries by using the directory # path. ifneq ($(BOARD_SYMLINK_FOR_LIBS),false) ifeq ($(_lib_moved),true) my_installed_symlinks += $(my_module_pre_o_default_path)/$(my_installed_module_stem) endif else # Symlinks for ndk libs are permanent. ifeq ($(lib_type)$(_lib_moved),ndktrue) my_installed_symlinks += $(my_module_pre_o_default_path)/$(my_installed_module_stem) endif endif # Make a symlink $(symlink) -> $(LOCAL_INSTALLED_MODULE) $(foreach symlink,$(my_installed_symlinks),\ $(call symlink-file,$(LOCAL_INSTALLED_MODULE),$(LOCAL_INSTALLED_MODULE),$(symlink),true)) $(call symlink-file,$(LOCAL_INSTALLED_MODULE),$(my_installed_module_stem),$(symlink))) $(my_all_targets) : | $(my_installed_symlinks) Loading
core/definitions.mk +3 −7 Original line number Diff line number Diff line Loading @@ -2845,10 +2845,8 @@ endef # Define a rule to create a symlink to a file. # $(1): full path to source # $(2): target of the link # $(3): full path of the symlink # $(4): (optional) when set to true, $(2) is recognized as a path from the build root and # thus -r option is used to link $(3) to $(2). Off by default. # $(2): source (may be relative) # $(3): full path to destination define symlink-file $(eval $(_symlink-file)) endef Loading @@ -2860,9 +2858,7 @@ $(3): | $(1) @echo "Symlink: $$@ -> $(2)" @mkdir -p $(dir $$@) @rm -rf $$@ $(if $(filter true,$(4)),\ $(hide) python -c "import os.path; import os; os.symlink(os.path.relpath('$(2)','$(dir $(3))'), '$$@')",\ $(hide) ln -sf $(2) $$@) $(hide) ln -sf $(2) $$@ endef ########################################################### Loading
core/soong_config.mk +1 −3 Original line number Diff line number Diff line Loading @@ -69,9 +69,7 @@ $(SOONG_VARIABLES): FORCE echo ''; \ echo ' "ArtUseReadBarrier": $(if $(filter false,$(PRODUCT_ART_USE_READ_BARRIER)),false,true),'; \ echo ''; \ echo ' "BtConfigIncludeDir": "$(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)",'; \ echo ''; \ echo ' "SameProcessHalDeps": [$(if $(BOARD_SAME_PROCESS_HAL_DEPS),"$(subst $(space),"$(comma)",$(BOARD_SAME_PROCESS_HAL_DEPS))")]'; \ echo ' "BtConfigIncludeDir": "$(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR)"'; \ echo '}') > $(SOONG_VARIABLES_TMP); \ if ! cmp -s $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); then \ mv $(SOONG_VARIABLES_TMP) $(SOONG_VARIABLES); \ Loading