blob: 931550f4f7dab20209e9b3d495a71e800ad4f160 [file] [log] [blame]
Nicolas Geoffrayffefd332014-11-25 12:52:26 +00001# include this makefile to create the LOCAL_MODULE symlink to the primary version binary.
2# but this requires the primary version name specified via LOCAL_MODULE_STEM_32 or LOCAL_MODULE_STEM_64,
3# and different with the LOCAL_MODULE value
Yongqin Liud1d42e82014-05-07 12:41:24 +08004#
Nicolas Geoffrayffefd332014-11-25 12:52:26 +00005# Note: now only limited to the binaries that will be installed under system/bin directory
Yongqin Liud1d42e82014-05-07 12:41:24 +08006
Narayan Kamath4fb81222014-05-14 18:26:48 +01007# Create link to the one used depending on the target
8# configuration. Note that we require the TARGET_IS_64_BIT
9# check because 32 bit targets may not define TARGET_PREFER_32_BIT_APPS
10# et al. since those variables make no sense in that context.
Ian Rogerscf331d92014-06-25 00:04:30 -070011ifneq ($(LOCAL_IS_HOST_MODULE),true)
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000012 my_symlink := $(addprefix $(TARGET_OUT)/bin/, $(LOCAL_MODULE))
Ian Rogerscf331d92014-06-25 00:04:30 -070013 ifeq ($(TARGET_IS_64_BIT),true)
Brian Carlstrom191e5982014-06-28 13:49:26 -070014 ifeq ($(TARGET_SUPPORTS_64_BIT_APPS)|$(TARGET_SUPPORTS_32_BIT_APPS),true|true)
15 # We support both 32 and 64 bit apps, so we will have to
16 # base our decision on whether the target prefers one or the
17 # other.
Narayan Kamath123854d2014-08-14 15:28:48 +010018 ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000019 $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
Brian Carlstrom191e5982014-06-28 13:49:26 -070020 else
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000021 $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64)
Brian Carlstrom191e5982014-06-28 13:49:26 -070022 endif
23 else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true)
24 # We support only 64 bit apps.
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000025 $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64)
Ian Rogerscf331d92014-06-25 00:04:30 -070026 else
Brian Carlstrom191e5982014-06-28 13:49:26 -070027 # We support only 32 bit apps.
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000028 $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
Ian Rogerscf331d92014-06-25 00:04:30 -070029 endif
Narayan Kamath79bc52a2014-06-17 16:36:08 +010030 else
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000031 $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
Narayan Kamath79bc52a2014-06-17 16:36:08 +010032 endif
Yongqin Liud1d42e82014-05-07 12:41:24 +080033else
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000034 my_symlink := $(addprefix $(HOST_OUT)/bin/, $(LOCAL_MODULE))
Ian Rogerscf331d92014-06-25 00:04:30 -070035 ifneq ($(HOST_PREFER_32_BIT),true)
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000036$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64)
Ian Rogerscf331d92014-06-25 00:04:30 -070037 else
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000038$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
Ian Rogerscf331d92014-06-25 00:04:30 -070039 endif
Yongqin Liud1d42e82014-05-07 12:41:24 +080040endif
Yongqin Liud1d42e82014-05-07 12:41:24 +080041
Ying Wange25b3982015-02-26 18:47:21 -080042# $(my_symlink) doesn't need to depend on $(PRIVATE_SRC_BINARY_NAME): we can generate symlink to nonexistent file.
43# If you add the dependency, make would compare the timestamp of a file against that of its symlink:
44# they are always equal, because make follows symlink.
Colin Cross7ee3b852015-09-28 18:45:23 -070045$(my_symlink): $(LOCAL_MODULE_MAKEFILE_DEP)
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000046 @echo "Symlink: $@ -> $(PRIVATE_SRC_BINARY_NAME)"
47 @mkdir -p $(dir $@)
48 @rm -rf $@
49 $(hide) ln -sf $(PRIVATE_SRC_BINARY_NAME) $@
Yongqin Liud1d42e82014-05-07 12:41:24 +080050
Nicolas Geoffrayffefd332014-11-25 12:52:26 +000051# We need this so that the installed files could be picked up based on the
52# local module name
53ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_symlink)
54
55# Create the symlink when you run mm/mmm or "make <module_name>"
56$(LOCAL_MODULE) : $(my_symlink)
57
Yongqin Liud1d42e82014-05-07 12:41:24 +080058my_symlink :=