blob: a2b759cf7278161560a72f75f9fe9b02ed69ab75 [file] [log] [blame]
Ying Wang29f0a482014-11-24 15:44:39 -08001# Include this makefile to create the LOCAL_MODULE symlink to the primary version binary.
2# Include this file only after "include $(BUILD_EXECUTABLE)".
3# It requires the primary version name specified via LOCAL_MODULE_STEM_32 or LOCAL_MODULE_STEM_64,
4# and different from the LOCAL_MODULE value.
Yongqin Liud1d42e82014-05-07 12:41:24 +08005#
Ying Wang29f0a482014-11-24 15:44:39 -08006# Note: now only limited to the binaries that will be installed under system/bin directory.
Yongqin Liud1d42e82014-05-07 12:41:24 +08007
Narayan Kamath4fb81222014-05-14 18:26:48 +01008# Create link to the one used depending on the target
9# configuration. Note that we require the TARGET_IS_64_BIT
10# check because 32 bit targets may not define TARGET_PREFER_32_BIT_APPS
11# et al. since those variables make no sense in that context.
Ian Rogerscf331d92014-06-25 00:04:30 -070012ifneq ($(LOCAL_IS_HOST_MODULE),true)
Ying Wang29f0a482014-11-24 15:44:39 -080013 my_symlink := $(TARGET_OUT)/bin/$(LOCAL_MODULE)
Ian Rogerscf331d92014-06-25 00:04:30 -070014 ifeq ($(TARGET_IS_64_BIT),true)
Brian Carlstrom191e5982014-06-28 13:49:26 -070015 ifeq ($(TARGET_SUPPORTS_64_BIT_APPS)|$(TARGET_SUPPORTS_32_BIT_APPS),true|true)
16 # We support both 32 and 64 bit apps, so we will have to
17 # base our decision on whether the target prefers one or the
18 # other.
Narayan Kamath123854d2014-08-14 15:28:48 +010019 ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
Ying Wang29f0a482014-11-24 15:44:39 -080020 my_symlink_tgt := $(LOCAL_MODULE_STEM_32)
Brian Carlstrom191e5982014-06-28 13:49:26 -070021 else
Ying Wang29f0a482014-11-24 15:44:39 -080022 my_symlink_tgt := $(LOCAL_MODULE_STEM_64)
Brian Carlstrom191e5982014-06-28 13:49:26 -070023 endif
24 else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true)
25 # We support only 64 bit apps.
Ying Wang29f0a482014-11-24 15:44:39 -080026 my_symlink_tgt := $(LOCAL_MODULE_STEM_64)
Ian Rogerscf331d92014-06-25 00:04:30 -070027 else
Brian Carlstrom191e5982014-06-28 13:49:26 -070028 # We support only 32 bit apps.
Ying Wang29f0a482014-11-24 15:44:39 -080029 my_symlink_tgt := $(LOCAL_MODULE_STEM_32)
Ian Rogerscf331d92014-06-25 00:04:30 -070030 endif
Narayan Kamath79bc52a2014-06-17 16:36:08 +010031 else
Ying Wang29f0a482014-11-24 15:44:39 -080032 my_symlink_tgt := $(LOCAL_MODULE_STEM_32)
Narayan Kamath79bc52a2014-06-17 16:36:08 +010033 endif
Yongqin Liud1d42e82014-05-07 12:41:24 +080034else
Ying Wang29f0a482014-11-24 15:44:39 -080035 my_symlink := $(HOST_OUT)/bin/$(LOCAL_MODULE)
Ian Rogerscf331d92014-06-25 00:04:30 -070036 ifneq ($(HOST_PREFER_32_BIT),true)
Ying Wang29f0a482014-11-24 15:44:39 -080037 my_symlink_tgt := $(LOCAL_MODULE_STEM_64)
Ian Rogerscf331d92014-06-25 00:04:30 -070038 else
Ying Wang29f0a482014-11-24 15:44:39 -080039 my_symlink_tgt := $(LOCAL_MODULE_STEM_32)
Ian Rogerscf331d92014-06-25 00:04:30 -070040 endif
Yongqin Liud1d42e82014-05-07 12:41:24 +080041endif
Yongqin Liud1d42e82014-05-07 12:41:24 +080042
Ying Wang29f0a482014-11-24 15:44:39 -080043# Create the symlink as a post-install command.
44$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD += \
45 ln -sf $(my_symlink_tgt) $(my_symlink)
Yongqin Liud1d42e82014-05-07 12:41:24 +080046
Ying Wang29f0a482014-11-24 15:44:39 -080047my_symlink_tgt :=
Yongqin Liud1d42e82014-05-07 12:41:24 +080048my_symlink :=