github.com/westcoastroms/westcoastroms-build@v0.0.0-20190928114312-2350e5a73030/build/make/core/package.mk (about)

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