1# 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 4# 5# Note: now only limited to the binaries that will be installed under system/bin directory 6 7# 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. 11ifneq ($(LOCAL_IS_HOST_MODULE),true) 12 my_symlink := $(addprefix $(TARGET_OUT)/bin/, $(LOCAL_MODULE)) 13 ifeq ($(TARGET_IS_64_BIT),true) 14 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. 18 ifeq ($(TARGET_PREFER_32_BIT_APPS),true) 19 $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32) 20 else 21 $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64) 22 endif 23 else ifeq ($(TARGET_SUPPORTS_64_BIT_APPS),true) 24 # We support only 64 bit apps. 25 $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64) 26 else 27 # We support only 32 bit apps. 28 $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32) 29 endif 30 else 31 $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32) 32 endif 33else 34 my_symlink := $(addprefix $(HOST_OUT)/bin/, $(LOCAL_MODULE)) 35 ifneq ($(HOST_PREFER_32_BIT),true) 36$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64) 37 else 38$(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32) 39 endif 40endif 41 42# $(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. 45$(my_symlink): $(LOCAL_MODULE_MAKEFILE) 46 @echo "Symlink: $@ -> $(PRIVATE_SRC_BINARY_NAME)" 47 @mkdir -p $(dir $@) 48 @rm -rf $@ 49 $(hide) ln -sf $(PRIVATE_SRC_BINARY_NAME) $@ 50 51# 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 58my_symlink := 59