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.
11 ifdef CFG_DISABLE_VERIFY_INSTALL
12 MAYBE_DISABLE_VERIFY=--disable-verify
17 install: dist-install-dir-$(CFG_BUILD)-with-target-libs
18 $(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
19 # Remove tmp files while we can because they may have been created under sudo
22 uninstall: dist-install-dir-$(CFG_BUILD)-with-target-libs
23 $(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
24 # Remove tmp files while we can because they may have been created under sudo
28 ######################################################################
29 # Android remote installation
30 ######################################################################
32 # Android runtime setup
33 # FIXME: This probably belongs somewhere else
35 # target platform specific variables
36 # for arm-linux-androidabi
37 define DEF_ADB_DEVICE_STATUS
38 CFG_ADB_DEVICE_STATUS=$(1)
41 $(foreach target,$(CFG_TARGET), \
42 $(if $(findstring $(target),"arm-linux-androideabi"), \
43 $(if $(findstring adb,$(CFG_ADB)), \
44 $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
45 $(info install: install-runtime-target for $(target) enabled \
46 $(info install: android device attached) \
47 $(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
48 $(info install: install-runtime-target for $(target) disabled \
49 $(info install: android device not attached) \
50 $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
52 $(info install: install-runtime-target for $(target) disabled \
53 $(info install: adb not found) \
54 $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
59 ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
60 $(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
61 L_TOKEN := $(word 2,$(MAKECMDGOALS))
63 CFG_RUNTIME_PUSH_DIR=/system/lib
65 CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
68 ifeq ($(CFG_ADB_DEVICE_STATUS),true)
71 ADB_PUSH = adb push $(1) $(2)
72 ADB_SHELL = adb shell $(1) $(2)
74 ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
75 ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
76 ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
79 define INSTALL_RUNTIME_TARGET_N
80 install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
81 $$(Q)$$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
82 $$(Q)$$(foreach crate,$$(TARGET_CRATES),\
83 $$(call ADB_PUSH,$$(TL$(1)$(2))/$$(call CFG_LIB_GLOB_$(1),$$(crate)),\
84 $$(CFG_RUNTIME_PUSH_DIR));)
87 define INSTALL_RUNTIME_TARGET_CLEANUP_N
88 install-runtime-target-$(1)-cleanup:
89 $$(Q)$$(call ADB,remount)
90 $$(Q)$$(foreach crate,$$(TARGET_CRATES),\
91 $$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));)
94 $(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD)))
95 $(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
97 install-runtime-target: \
98 install-runtime-target-arm-linux-androideabi-cleanup \
99 install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD)
101 install-runtime-target:
102 @echo "No device to install runtime library"