am e778ec89: Merge "Support arch-specific LOCAL_ variables"
* commit 'e778ec89fd249e15608b7629963619d99e8a34bf':
Support arch-specific LOCAL_ variables
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 64ca5b2..260e836 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -98,8 +98,8 @@
endif
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
-LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH))
-ifeq ($(LOCAL_MODULE_PATH),)
+my_module_path := $(strip $(LOCAL_MODULE_PATH))
+ifeq ($(my_module_path),)
ifdef LOCAL_IS_HOST_MODULE
partition_tag :=
else
@@ -116,9 +116,9 @@
install_path_var := $(install_path_var)_PRIVILEGED
endif
- LOCAL_MODULE_PATH := $($(install_path_var))
- ifeq ($(strip $(LOCAL_MODULE_PATH)),)
- $(error $(LOCAL_PATH): unhandled install path "$(install_path_var)")
+ my_module_path := $($(install_path_var))
+ ifeq ($(strip $(my_module_path)),)
+ $(error $(LOCAL_PATH): unhandled install path "$(install_path_var) for $(LOCAL_MODULE)")
endif
endif
endif # not LOCAL_UNINSTALLABLE_MODULE
@@ -172,7 +172,7 @@
built_module_path :=
ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
- LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_INSTALLED_MODULE_STEM)
+ LOCAL_INSTALLED_MODULE := $(my_module_path)/$(LOCAL_INSTALLED_MODULE_STEM)
endif
# Assemble the list of targets to create PRIVATE_ variables for.
diff --git a/core/binary.mk b/core/binary.mk
index 7912fb4..a3a9c16 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -85,12 +85,13 @@
# The following LOCAL_ variables will be modified in this file.
# Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch,
# we can't modify them in place.
+my_src_files := $(LOCAL_SRC_FILES) $(LOCAL_SRC_FILES_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
my_static_libraries := $(LOCAL_STATIC_LIBRARIES)
my_shared_libraries := $(LOCAL_SHARED_LIBRARIES)
-my_cflags := $(LOCAL_CFLAGS)
+my_cflags := $(LOCAL_CFLAGS) $(LOCAL_CFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
my_cppflags := $(LOCAL_CPPFLAGS)
-my_ldflags := $(LOCAL_LDFLAGS)
-my_asflags := $(LOCAL_ASFLAGS)
+my_ldflags := $(LOCAL_LDFLAGS) $(LOCAL_LDFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+my_asflags := $(LOCAL_ASFLAGS) $(LOCAL_ASFLAGS_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
my_cc := $(LOCAL_CC)
my_cxx := $(LOCAL_CXX)
my_c_includes := $(LOCAL_C_INCLUDES)
@@ -318,7 +319,7 @@
## Compile RenderScript with reflected C++
####################################################
-renderscript_sources := $(filter %.rs %.fs,$(LOCAL_SRC_FILES))
+renderscript_sources := $(filter %.rs %.fs,$(my_src_files))
ifneq (,$(renderscript_sources))
@@ -382,7 +383,7 @@
###########################################################
## Compile the .proto files to .cc and then to .o
###########################################################
-proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
+proto_sources := $(filter %.proto,$(my_src_files))
proto_generated_objects :=
proto_generated_headers :=
ifneq ($(proto_sources),)
@@ -421,7 +422,7 @@
## YACC: Compile .y files to .cpp and the to .o.
###########################################################
-yacc_sources := $(filter %.y,$(LOCAL_SRC_FILES))
+yacc_sources := $(filter %.y,$(my_src_files))
yacc_cpps := $(addprefix \
$(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
@@ -444,7 +445,7 @@
## LEX: Compile .l files to .cpp and then to .o.
###########################################################
-lex_sources := $(filter %.l,$(LOCAL_SRC_FILES))
+lex_sources := $(filter %.l,$(my_src_files))
lex_cpps := $(addprefix \
$(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
@@ -469,10 +470,10 @@
# we also do this on host modules, even though
# it's not really arm, because there are files that are shared.
-cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(LOCAL_SRC_FILES)))
+cpp_arm_sources := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(my_src_files)))
cpp_arm_objects := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
-cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(LOCAL_SRC_FILES))
+cpp_normal_sources := $(filter %$(LOCAL_CPP_EXTENSION),$(my_src_files))
cpp_normal_objects := $(addprefix $(intermediates)/,$(cpp_normal_sources:$(LOCAL_CPP_EXTENSION)=.o))
$(cpp_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
@@ -551,10 +552,10 @@
## C: Compile .c files to .o.
###########################################################
-c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(LOCAL_SRC_FILES)))
+c_arm_sources := $(patsubst %.c.arm,%.c,$(filter %.c.arm,$(my_src_files)))
c_arm_objects := $(addprefix $(intermediates)/,$(c_arm_sources:.c=.o))
-c_normal_sources := $(filter %.c,$(LOCAL_SRC_FILES))
+c_normal_sources := $(filter %.c,$(my_src_files))
c_normal_objects := $(addprefix $(intermediates)/,$(c_normal_sources:.c=.o))
$(c_arm_objects): PRIVATE_ARM_MODE := $(arm_objects_mode)
@@ -595,7 +596,7 @@
## ObjC: Compile .m files to .o
###########################################################
-objc_sources := $(filter %.m,$(LOCAL_SRC_FILES))
+objc_sources := $(filter %.m,$(my_src_files))
objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
ifneq ($(strip $(objc_objects)),)
@@ -610,7 +611,7 @@
## AS: Compile .S files to .o.
###########################################################
-asm_sources_S := $(filter %.S,$(LOCAL_SRC_FILES))
+asm_sources_S := $(filter %.S,$(my_src_files))
asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
ifneq ($(strip $(asm_objects_S)),)
@@ -621,7 +622,7 @@
-include $(asm_objects_S:%.o=%.P)
endif
-asm_sources_s := $(filter %.s,$(LOCAL_SRC_FILES))
+asm_sources_s := $(filter %.s,$(my_src_files))
asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
ifneq ($(strip $(asm_objects_s)),)
@@ -801,7 +802,7 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(LOCAL_NO_CRT)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(strip $(LOCAL_NO_CRT) $(LOCAL_NO_CRT_$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
# this is really the way to get the files onto the command line instead
# of using $^, because then LOCAL_ADDITIONAL_DEPENDENCIES doesn't work
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 381d9a5..42ce742 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -145,6 +145,20 @@
LOCAL_32BIT_ONLY:= # '',true
LOCAL_NO_2ND_ARCH:= # '',true
+# arch specific variables
+LOCAL_SRC_FILES_$(TARGET_ARCH):=
+LOCAL_CFLAGS_$(TARGET_ARCH):=
+LOCAL_ASFLAGS_$(TARGET_ARCH):=
+LOCAL_NO_CRT_$(TARGET_ARCH):=
+LOCAL_LDFLAGS_$(TARGET_ARCH):=
+ifdef TARGET_2ND_ARCH
+LOCAL_SRC_FILES_$(TARGET_2ND_ARCH):=
+LOCAL_CFLAGS_$(TARGET_2ND_ARCH):=
+LOCAL_ASFLAGS_$(TARGET_2ND_ARCH):=
+LOCAL_NO_CRT_$(TARGET_2ND_ARCH):=
+LOCAL_LDFLAGS_$(TARGET_2ND_ARCH):=
+endif
+
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
# Leave the current makefile to make sure we don't break anything
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 38dd0c9..6d3d2b5 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -87,10 +87,12 @@
## Store a copy with symbols for symbolic debugging
###########################################################
ifeq ($(LOCAL_UNSTRIPPED_PATH),)
-LOCAL_UNSTRIPPED_PATH := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(LOCAL_MODULE_PATH))
+my_unstripped_path := $(TARGET_OUT_UNSTRIPPED)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
+else
+my_unstripped_path := $(LOCAL_UNSTRIPPED_PATH)
endif
symbolic_input := $(compress_output)
-symbolic_output := $(LOCAL_UNSTRIPPED_PATH)/$(LOCAL_INSTALLED_MODULE_STEM)
+symbolic_output := $(my_unstripped_path)/$(LOCAL_INSTALLED_MODULE_STEM)
$(symbolic_output) : $(symbolic_input) | $(ACP)
@echo "target Symbolic: $(PRIVATE_MODULE) ($@)"
$(copy-file-to-target)
@@ -108,9 +110,9 @@
ifeq ($(LOCAL_STRIP_MODULE),true)
# Strip the binary
-$(strip_output): PRIVATE_STRIP := $(TARGET_STRIP)
-$(strip_output): PRIVATE_OBJCOPY := $(TARGET_OBJCOPY)
-$(strip_output): $(strip_input) | $(TARGET_STRIP)
+$(strip_output): PRIVATE_STRIP := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
+$(strip_output): PRIVATE_OBJCOPY := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY)
+$(strip_output): $(strip_input) | $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(transform-to-stripped)
else
# Don't strip the binary, just copy it. We can't skip this step
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 2fba82d..fb524a4 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -251,6 +251,9 @@
TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest
TARGET_OUT_DATA_FAKE := $(TARGET_OUT_DATA)/fake_packages
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_EXECUTABLES := $(TARGET_OUT_DATA_EXECUTABLES)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_SHARED_LIBRARIES := $($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SHARED_LIBRARIES)
+
TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache
TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
@@ -265,6 +268,7 @@
TARGET_OUT_VENDOR_APPS := $(TARGET_OUT_VENDOR)/app
TARGET_OUT_VENDOR_ETC := $(TARGET_OUT_VENDOR)/etc
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_EXECUTABLES := $(TARGET_OUT_VENDOR_EXECUTABLES)
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_SHARED_LIBRARIES := $(TARGET_OUT_VENDOR)/lib
TARGET_OUT_UNSTRIPPED := $(PRODUCT_OUT)/symbols