about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYoung-il Choi <duddlf.choi@samsung.com>2013-05-01 18:49:19 +0900
committerYoung-il Choi <duddlf.choi@samsung.com>2013-05-01 18:49:19 +0900
commitdca88701a311c7dffec1ee5e990df9570647ba03 (patch)
tree86d22c0cb299fa34a0ccc4aae912794a7a9892f0
parentbfccfdc78065752079a3863db19ca7148ade3e6f (diff)
downloadrust-dca88701a311c7dffec1ee5e990df9570647ba03.tar.gz
rust-dca88701a311c7dffec1ee5e990df9570647ba03.zip
mk: install-runtime-target added to install.mk (pushing shared library to android target)
-rw-r--r--mk/install.mk63
1 files changed, 63 insertions, 0 deletions
diff --git a/mk/install.mk b/mk/install.mk
index a84f527a165..693589980ce 100644
--- a/mk/install.mk
+++ b/mk/install.mk
@@ -154,3 +154,66 @@ uninstall:
         done
 	$(Q)rm -Rf $(PHL)/rustc
 	$(Q)rm -f $(PREFIX_ROOT)/share/man/man1/rustc.1
+
+# target platform specific variables
+# for arm-linux-androidabi
+define DEF_ADB_STATUS
+CFG_ADB_DEVICE=$(1)
+endef
+
+$(foreach target,$(CFG_TARGET_TRIPLES), \
+  $(if $(findstring $(target),"arm-linux-androideabi"), \
+    $(if $(findstring adb,$(shell which adb)), \
+      $(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[A-Za-z0-9]+[[:blank:]]+device')), \
+        $(info install: install-runtime-target for arm-linux-androideabi enabled \
+          $(info install: android device attached) \
+          $(eval $(call DEF_ADB_STATUS, true))), \
+        $(info install: install-runtime-target for arm-linux-androideabi disabled \
+          $(info install: android device not attached) \
+          $(eval $(call DEF_ADB_STATUS, false))) \
+      ), \
+      $(info install: install-runtime-target for arm-linux-androideabi disabled \
+        $(info install: adb not found) \
+        $(eval $(call DEF_ADB_STATUS, false))) \
+    ), \
+  ) \
+)
+
+ifeq ($(CFG_ADB_DEVICE),true)
+
+ifdef VERBOSE
+ ADB = adb $(1)
+ ADB_PUSH = adb push $(1) $(2)
+ ADB_SHELL = adb shell $(1) $(2) 
+else
+ ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null 2>/dev/null
+ ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null 2>/dev/null
+ ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null 2>/dev/null
+endif
+
+define INSTALL_RUNTIME_TARGET_N
+install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
+	$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(CFG_RUNTIME_$(1)),/system/lib)
+	$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(CORELIB_GLOB_$(1)),/system/lib)
+	$(Q)$(call ADB_PUSH,$$(TL$(1)$(2))/$$(STDLIB_GLOB_$(1)),/system/lib)
+endef
+
+define INSTALL_RUNTIME_TARGET_CLEANUP_N
+install-runtime-target-$(1)-cleanup:
+	$(Q)$(call ADB,remount)
+	$(Q)$(call ADB_SHELL,rm,/system/lib/$(CFG_RUNTIME_$(1)))
+	$(Q)$(call ADB_SHELL,rm,/system/lib/$(CORELIB_GLOB_$(1)))
+	$(Q)$(call ADB_SHELL,rm,/system/lib/$(STDLIB_GLOB_$(1)))
+endef
+
+$(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD_TRIPLE)))
+$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
+
+install-runtime-target: \
+	install-runtime-target-arm-linux-androideabi-cleanup \
+	install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD_TRIPLE)
+
+else
+install-runtime-target: 
+	@echo
+endif