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)" --libdir="$(CFG_LIBDIR)" --mandir="$(CFG_MANDIR)"
14 # Remove tmp files while we can because they may have been created under sudo
15 $(Q)rm -R tmp/dist/$(PKG_NAME)-$(CFG_BUILD/
17 uninstall: dist-install-dir-$(CFG_BUILD)
18 $(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(CFG_PREFIX)" --libdir="$(CFG_LIBDIR)" --mandir="$(CFG_MANDIR)"
21 ######################################################################
22 # Android remote installation
23 ######################################################################
25 # Android runtime setup
26 # FIXME: This probably belongs somewhere else
28 # target platform specific variables
29 # for arm-linux-androidabi
30 define DEF_ADB_DEVICE_STATUS
31 CFG_ADB_DEVICE_STATUS=$(1)
34 $(foreach target,$(CFG_TARGET), \
35 $(if $(findstring $(target),"arm-linux-androideabi"), \
36 $(if $(findstring adb,$(CFG_ADB)), \
37 $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
38 $(info install: install-runtime-target for $(target) enabled \
39 $(info install: android device attached) \
40 $(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
41 $(info install: install-runtime-target for $(target) disabled \
42 $(info install: android device not attached) \
43 $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
45 $(info install: install-runtime-target for $(target) disabled \
46 $(info install: adb not found) \
47 $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
52 ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
53 $(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
54 L_TOKEN := $(word 2,$(MAKECMDGOALS))
56 CFG_RUNTIME_PUSH_DIR=/system/lib
58 CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
61 ifeq ($(CFG_ADB_DEVICE_STATUS),true)
64 ADB_PUSH = adb push $(1) $(2)
65 ADB_SHELL = adb shell $(1) $(2)
67 ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
68 ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
69 ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
72 define INSTALL_RUNTIME_TARGET_N
73 install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
74 $$(Q)$$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
75 $$(Q)$$(foreach crate,$$(TARGET_CRATES),\
76 $$(call ADB_PUSH,$$(TL$(1)$(2))/$$(call CFG_LIB_GLOB_$(1),$$(crate)),\
77 $$(CFG_RUNTIME_PUSH_DIR));)
80 define INSTALL_RUNTIME_TARGET_CLEANUP_N
81 install-runtime-target-$(1)-cleanup:
82 $$(Q)$$(call ADB,remount)
83 $$(Q)$$(foreach crate,$$(TARGET_CRATES),\
84 $$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));)
87 $(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD)))
88 $(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
90 install-runtime-target: \
91 install-runtime-target-arm-linux-androideabi-cleanup \
92 install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD)
94 install-runtime-target:
95 @echo "No device to install runtime library"