package.mk revision 6feb6d5607ce86a446645564212043964628f540
1# We don't automatically set up rules to build packages for both
2# TARGET_ARCH and TARGET_2ND_ARCH.
3# By default, an package is built for TARGET_ARCH.
4# To build it for TARGET_2ND_ARCH in a 64bit product, use "LOCAL_MULTILIB := 32".
5
6my_prefix := TARGET_
7include $(BUILD_SYSTEM)/multilib.mk
8
9ifeq ($(TARGET_SUPPORTS_32_BIT_APPS)|$(TARGET_SUPPORTS_64_BIT_APPS),true|true)
10  # packages default to building for either architecture,
11  # the preferred if its supported, otherwise the non-preferred.
12else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true)
13  # only 64-bit apps supported
14  ifeq ($(filter $(my_module_multilib),64 both first),$(my_module_multilib))
15    # if my_module_multilib was 64, both, first, or unset, build for 64-bit
16    my_module_multilib := 64
17  else
18    # otherwise don't build this app
19    my_module_multilib := none
20  endif
21else
22  # only 32-bit apps supported
23  ifeq ($(filter $(my_module_multilib),32 both),$(my_module_multilib))
24    # if my_module_multilib was 32, both, or unset, build for 32-bit
25    my_module_multilib := 32
26  else ifeq ($(my_module_multilib),first)
27    ifndef TARGET_IS_64_BIT
28      # if my_module_multilib was first and this is a 32-bit build, build for
29      # 32-bit
30      my_module_multilib := 32
31    else
32      # if my_module_multilib was first and this is a 64-bit build, don't build
33      # this app
34      my_module_multilib := none
35    endif
36  else
37    # my_module_mulitlib was 64 or none, don't build this app
38    my_module_multilib := none
39  endif
40endif
41
42LOCAL_NO_2ND_ARCH_MODULE_SUFFIX := true
43
44# if TARGET_PREFER_32_BIT_APPS is set, try to build 32-bit first
45ifdef TARGET_2ND_ARCH
46ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
47LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
48else
49LOCAL_2ND_ARCH_VAR_PREFIX :=
50endif
51endif
52
53# check if preferred arch is supported
54include $(BUILD_SYSTEM)/module_arch_supported.mk
55ifeq ($(my_module_arch_supported),true)
56# first arch is supported
57include $(BUILD_SYSTEM)/package_internal.mk
58else ifneq (,$(TARGET_2ND_ARCH))
59# check if the non-preferred arch is the primary or secondary
60ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
61LOCAL_2ND_ARCH_VAR_PREFIX :=
62else
63LOCAL_2ND_ARCH_VAR_PREFIX := $(TARGET_2ND_ARCH_VAR_PREFIX)
64endif
65
66# check if non-preferred arch is supported
67include $(BUILD_SYSTEM)/module_arch_supported.mk
68ifeq ($(my_module_arch_supported),true)
69# secondary arch is supported
70include $(BUILD_SYSTEM)/package_internal.mk
71endif
72endif # TARGET_2ND_ARCH
73
74LOCAL_2ND_ARCH_VAR_PREFIX :=
75LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
76
77my_module_arch_supported :=
78