Support LOCAL_INIT_RC.

A module can install a companion init.rc file,
by specifying:
LOCAL_INIT_RC := <init.rc-file-path-replative-to-LOCAL_PATH>
You can also use the variant with _32 or _64 suffix.

Bug: 23186545
Change-Id: I00a96509f5707ae39361a0c5555fa59d46c90322
This commit is contained in:
Ying Wang 2015-08-20 12:02:10 -07:00
parent b3c585d745
commit 9fe15ac757
2 changed files with 26 additions and 3 deletions

View File

@ -565,8 +565,25 @@ $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE)
$(copy-file-to-target-with-cp)
endif
endif # !LOCAL_UNINSTALLABLE_MODULE
# Rule to install the module's companion init.rc.
my_init_rc := $(LOCAL_INIT_RC_$(my_32_64_bit_suffix))
my_init_rc_src :=
my_init_rc_installed :=
ifndef my_init_rc
my_init_rc := $(LOCAL_INIT_RC)
# Make sure we don't define the rule twice in multilib module.
LOCAL_INIT_RC :=
endif
ifdef my_init_rc
my_init_rc_src := $(LOCAL_PATH)/$(my_init_rc)
my_init_rc_installed := $(TARGET_OUT$(partition_tag)_ETC)/init/$(notdir $(my_init_rc_src))
$(my_init_rc_installed) : $(my_init_rc_src) | $(ACP)
@echo "Install: $@"
$(copy-file-to-new-target)
$(my_register_name) : $(my_init_rc_installed)
endif # my_init_rc
endif # !LOCAL_UNINSTALLABLE_MODULE
###########################################################
## CHECK_BUILD goals
@ -615,9 +632,12 @@ ALL_MODULES.$(my_register_name).BUILT := \
$(ALL_MODULES.$(my_register_name).BUILT) $(LOCAL_BUILT_MODULE)
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
ALL_MODULES.$(my_register_name).INSTALLED := \
$(strip $(ALL_MODULES.$(my_register_name).INSTALLED) $(LOCAL_INSTALLED_MODULE))
$(strip $(ALL_MODULES.$(my_register_name).INSTALLED) \
$(LOCAL_INSTALLED_MODULE) $(my_init_rc_installed))
ALL_MODULES.$(my_register_name).BUILT_INSTALLED := \
$(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) $(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE))
$(strip $(ALL_MODULES.$(my_register_name).BUILT_INSTALLED) \
$(LOCAL_BUILT_MODULE):$(LOCAL_INSTALLED_MODULE) \
$(addprefix $(my_init_rc_src):,$(my_init_rc_installed)))
endif
ifdef LOCAL_PICKUP_FILES
# Files or directories ready to pick up by the build system

View File

@ -181,6 +181,7 @@ LOCAL_DPI_FILE_STEM:=
LOCAL_SANITIZE:=
LOCAL_SANITIZE_RECOVER:=
LOCAL_DBUS_PROXY_PREFIX:=
LOCAL_INIT_RC:=
# arch specific variables
LOCAL_SRC_FILES_$(TARGET_ARCH):=
@ -288,6 +289,8 @@ LOCAL_MODULE_STEM_32:=
LOCAL_MODULE_STEM_64:=
LOCAL_CLANG_32:=
LOCAL_CLANG_64:=
LOCAL_INIT_RC_32:=
LOCAL_INIT_RC_64:=
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.