1 # Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 # file at the top-level directory of this distribution and at
3 # http://rust-lang.org/COPYRIGHT.
5 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 # option. This file may not be copied, modified, or distributed
9 # except according to those terms.
12 install: dist-install-dir-$(CFG_BUILD)
13 $(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(CFG_PREFIX)"
15 uninstall: dist-install-dir-$(CFG_BUILD)
16 $(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(CFG_PREFIX)" --uninstall
19 ######################################################################
20 # Android remote installation
21 ######################################################################
23 # Android runtime setup
24 # FIXME: This probably belongs somewhere else
26 # target platform specific variables
27 # for arm-linux-androidabi
28 define DEF_ADB_DEVICE_STATUS
29 CFG_ADB_DEVICE_STATUS=$(1)
32 $(foreach target,$(CFG_TARGET), \
33 $(if $(findstring $(target),"arm-linux-androideabi"), \
34 $(if $(findstring adb,$(CFG_ADB)), \
35 $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
36 $(info install: install-runtime-target for $(target) enabled \
37 $(info install: android device attached) \
38 $(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
39 $(info install: install-runtime-target for $(target) disabled \
40 $(info install: android device not attached) \
41 $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
43 $(info install: install-runtime-target for $(target) disabled \
44 $(info install: adb not found) \
45 $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
50 ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
51 $(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
52 L_TOKEN := $(word 2,$(MAKECMDGOALS))
54 CFG_RUNTIME_PUSH_DIR=/system/lib
56 CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
59 ifeq ($(CFG_ADB_DEVICE_STATUS),true)
62 ADB_PUSH = adb push $(1) $(2)
63 ADB_SHELL = adb shell $(1) $(2)
65 ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
66 ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
67 ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
70 define INSTALL_RUNTIME_TARGET_N
71 install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
72 $$(Q)$$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
73 $$(Q)$$(foreach crate,$$(TARGET_CRATES),\
74 $$(call ADB_PUSH,$$(TL$(1)$(2))/$$(call CFG_LIB_GLOB_$(1),$$(crate)),\
75 $$(CFG_RUNTIME_PUSH_DIR));)
78 define INSTALL_RUNTIME_TARGET_CLEANUP_N
79 install-runtime-target-$(1)-cleanup:
80 $$(Q)$$(call ADB,remount)
81 $$(Q)$$(foreach crate,$$(TARGET_CRATES),\
82 $$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));)
85 $(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD)))
86 $(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
88 install-runtime-target: \
89 install-runtime-target-arm-linux-androideabi-cleanup \
90 install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD)
92 install-runtime-target:
93 @echo "No device to install runtime library"