]> git.lizzy.rs Git - rust.git/blob - mk/install.mk
Emit lifetime end markers for function arguments
[rust.git] / mk / install.mk
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.
4 #
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.
10
11 ifdef CFG_DISABLE_VERIFY_INSTALL
12 MAYBE_DISABLE_VERIFY=--disable-verify
13 else
14 MAYBE_DISABLE_VERIFY=
15 endif
16
17 install: dist-install-dir-$(CFG_BUILD) | tmp/empty_dir
18         $(Q)cd tmp/empty_dir && 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
20         $(Q)rm -R tmp/dist
21
22 uninstall: dist-install-dir-$(CFG_BUILD) | tmp/empty_dir
23         $(Q)cd tmp/empty_dir && 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
25         $(Q)rm -R tmp/dist
26
27 tmp/empty_dir:
28         mkdir -p $@
29
30 ######################################################################
31 # Android remote installation
32 ######################################################################
33
34 # Android runtime setup
35 # FIXME: This probably belongs somewhere else
36
37 # target platform specific variables
38 # for arm-linux-androidabi
39 define DEF_ADB_DEVICE_STATUS
40 CFG_ADB_DEVICE_STATUS=$(1)
41 endef
42
43 $(foreach target,$(CFG_TARGET), \
44   $(if $(findstring $(target),"arm-linux-androideabi"), \
45     $(if $(findstring adb,$(CFG_ADB)), \
46       $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
47         $(info install: install-runtime-target for $(target) enabled \
48           $(info install: android device attached) \
49           $(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
50         $(info install: install-runtime-target for $(target) disabled \
51           $(info install: android device not attached) \
52           $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
53       ), \
54       $(info install: install-runtime-target for $(target) disabled \
55         $(info install: adb not found) \
56         $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
57     ), \
58   ) \
59 )
60
61 ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
62 $(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
63 L_TOKEN := $(word 2,$(MAKECMDGOALS))
64 ifeq ($(L_TOKEN),)
65 CFG_RUNTIME_PUSH_DIR=/system/lib
66 else
67 CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
68 endif
69
70 ifeq ($(CFG_ADB_DEVICE_STATUS),true)
71 ifdef VERBOSE
72  ADB = adb $(1)
73  ADB_PUSH = adb push $(1) $(2)
74  ADB_SHELL = adb shell $(1) $(2)
75 else
76  ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
77  ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
78  ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
79 endif
80
81 define INSTALL_RUNTIME_TARGET_N
82 install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
83         $$(Q)$$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
84         $$(Q)$$(foreach crate,$$(TARGET_CRATES), \
85             $$(call ADB_PUSH,$$(TL$(1)$(2))/$$(call CFG_LIB_GLOB_$(1),$$(crate)), \
86                         $$(CFG_RUNTIME_PUSH_DIR));)
87 endef
88
89 define INSTALL_RUNTIME_TARGET_CLEANUP_N
90 install-runtime-target-$(1)-cleanup:
91         $$(Q)$$(call ADB,remount)
92         $$(Q)$$(foreach crate,$$(TARGET_CRATES), \
93             $$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));)
94 endef
95
96 $(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD)))
97 $(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
98
99 install-runtime-target: \
100         install-runtime-target-arm-linux-androideabi-cleanup \
101         install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD)
102 else
103 install-runtime-target:
104         @echo "No device to install runtime library"
105         @echo
106 endif
107 endif