summaryrefslogtreecommitdiffstats
path: root/core/executable_prefer_symlink.mk
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2014-05-07 12:41:24 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2014-05-09 14:08:49 +0800
commitd1d42e88dcbabb72d7834c3a7f986d7055e546bb (patch)
tree51977c70fe783e96fbba924d7154013ffb2b495b /core/executable_prefer_symlink.mk
parenta16583a0880f574937f08bf2c86be72b0f4b9274 (diff)
downloadbuild-d1d42e88dcbabb72d7834c3a7f986d7055e546bb.zip
build-d1d42e88dcbabb72d7834c3a7f986d7055e546bb.tar.gz
build-d1d42e88dcbabb72d7834c3a7f986d7055e546bb.tar.bz2
executable_prefer_symlink: add makefile for creating symlink to prefer version
For a 64bit target, we can have support for both 32bit and 64bit version binary(like app_process, dalvikvm), and there are some commands like am/pm will call these commands to implement it's function. In some targets it will prefer to use the 32bit version, and in other targets it will prefer to use the 64bit version. So this change is to add the common work for creating the symlink to the prefer version binary,and avoid the change on the caller commands side like am/pm. In this change, it uses TARGET_PREFER_32_BIT_APPS to decide linking to 32bit version or 64bit version. Change-Id: I96f041c0e0ededd953feead30ec63ad63e945a6f Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'core/executable_prefer_symlink.mk')
-rw-r--r--core/executable_prefer_symlink.mk25
1 files changed, 25 insertions, 0 deletions
diff --git a/core/executable_prefer_symlink.mk b/core/executable_prefer_symlink.mk
new file mode 100644
index 0000000..c6abed4
--- /dev/null
+++ b/core/executable_prefer_symlink.mk
@@ -0,0 +1,25 @@
+# include this makefile to create the LOCAL_MODULE symlink to the primary version binary.
+# but this requires the primary version name specified via LOCAL_MODULE_STEM_32 or LOCAL_MODULE_STEM_64,
+# and different with the LOCAL_MODULE value
+#
+# Note: now only limited to the binaries that will be installed under system/bin directory
+
+my_symlink := $(addprefix $(TARGET_OUT)/bin/, $(LOCAL_MODULE))
+# create link to the one used for prefer version
+ifneq ($(TARGET_PREFER_32_BIT_APPS),true)
+ $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_64)
+else
+ $(my_symlink): PRIVATE_SRC_BINARY_NAME := $(LOCAL_MODULE_STEM_32)
+endif
+
+$(my_symlink): $(LOCAL_INSTALLED_MODULE) $(LOCAL_MODULE_MAKEFILE)
+ @echo "Symlink: $@ -> $(PRIVATE_SRC_BINARY_NAME)"
+ @mkdir -p $(dir $@)
+ @rm -rf $@
+ $(hide) ln -sf $(PRIVATE_SRC_BINARY_NAME) $@
+
+# We need this so that the installed files could be picked up based on the
+# local module name
+ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(my_symlink)
+
+my_symlink :=