From dca88701a311c7dffec1ee5e990df9570647ba03 Mon Sep 17 00:00:00 2001 From: Young-il Choi Date: Wed, 1 May 2013 18:49:19 +0900 Subject: [PATCH] mk: install-runtime-target added to install.mk (pushing shared library to android target) --- mk/install.mk | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) 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