2012-12-10 19:32:48 -06:00
|
|
|
# Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
# file at the top-level directory of this distribution and at
|
|
|
|
# http://rust-lang.org/COPYRIGHT.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
# option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
2015-10-12 19:24:30 -05:00
|
|
|
RUN_INSALLER = cd tmp/empty_dir && \
|
|
|
|
sh ../../tmp/dist/$(1)/install.sh \
|
|
|
|
--prefix="$(DESTDIR)$(CFG_PREFIX)" \
|
|
|
|
--libdir="$(DESTDIR)$(CFG_LIBDIR)" \
|
|
|
|
--mandir="$(DESTDIR)$(CFG_MANDIR)"
|
|
|
|
|
2014-09-05 00:15:02 -05:00
|
|
|
install:
|
|
|
|
ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
|
|
|
|
# Build the dist as the original user
|
|
|
|
$(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_install
|
|
|
|
else
|
|
|
|
$(Q)$(MAKE) prepare_install
|
2014-12-29 13:15:40 -06:00
|
|
|
endif
|
|
|
|
ifeq ($(CFG_DISABLE_DOCS),)
|
2015-10-12 19:24:30 -05:00
|
|
|
$(Q)$(call RUN_INSALLER,$(DOC_PKG_NAME)-$(CFG_BUILD)) --disable-ldconfig
|
2014-09-05 00:15:02 -05:00
|
|
|
endif
|
2015-10-12 19:24:30 -05:00
|
|
|
$(Q)$(foreach target,$(CFG_TARGET),\
|
|
|
|
($(call RUN_INSALLER,$(STD_PKG_NAME)-$(target)) --disable-ldconfig);)
|
|
|
|
$(Q)$(call RUN_INSALLER,$(PKG_NAME)-$(CFG_BUILD))
|
2014-09-05 00:15:02 -05:00
|
|
|
# Remove tmp files because it's a decent amount of disk space
|
2014-03-30 22:14:32 -05:00
|
|
|
$(Q)rm -R tmp/dist
|
2011-09-30 21:00:19 -05:00
|
|
|
|
2015-01-02 13:33:04 -06:00
|
|
|
prepare_install: dist-tar-bins | tmp/empty_dir
|
2014-09-05 00:15:02 -05:00
|
|
|
|
|
|
|
uninstall:
|
|
|
|
ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
|
|
|
|
# Build the dist as the original user
|
|
|
|
$(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_uninstall
|
|
|
|
else
|
|
|
|
$(Q)$(MAKE) prepare_uninstall
|
2014-12-29 13:15:40 -06:00
|
|
|
endif
|
|
|
|
ifeq ($(CFG_DISABLE_DOCS),)
|
2015-10-12 19:24:30 -05:00
|
|
|
$(Q)$(call RUN_INSALLER,$(DOC_PKG_NAME)-$(CFG_BUILD)) --uninstall
|
2014-09-05 00:15:02 -05:00
|
|
|
endif
|
2015-10-12 19:24:30 -05:00
|
|
|
$(Q)$(call RUN_INSALLER,$(PKG_NAME)-$(CFG_BUILD)) --uninstall
|
|
|
|
$(Q)$(foreach target,$(CFG_TARGET),\
|
|
|
|
($(call RUN_INSALLER,$(STD_PKG_NAME)-$(target)) --uninstall);)
|
2014-09-05 00:15:02 -05:00
|
|
|
# Remove tmp files because it's a decent amount of disk space
|
2014-03-30 22:14:32 -05:00
|
|
|
$(Q)rm -R tmp/dist
|
2014-03-25 17:26:51 -05:00
|
|
|
|
2015-01-02 13:33:04 -06:00
|
|
|
prepare_uninstall: dist-tar-bins | tmp/empty_dir
|
2014-09-05 00:15:02 -05:00
|
|
|
|
|
|
|
.PHONY: install prepare_install uninstall prepare_uninstall
|
|
|
|
|
2014-07-10 12:18:46 -05:00
|
|
|
tmp/empty_dir:
|
|
|
|
mkdir -p $@
|
2013-05-01 04:49:19 -05:00
|
|
|
|
2014-03-25 19:54:26 -05:00
|
|
|
######################################################################
|
|
|
|
# Android remote installation
|
|
|
|
######################################################################
|
2014-02-13 01:53:36 -06:00
|
|
|
|
|
|
|
# Android runtime setup
|
|
|
|
# FIXME: This probably belongs somewhere else
|
|
|
|
|
2015-02-02 22:42:05 -06:00
|
|
|
# target platform specific variables for android
|
2013-05-03 10:47:54 -05:00
|
|
|
define DEF_ADB_DEVICE_STATUS
|
|
|
|
CFG_ADB_DEVICE_STATUS=$(1)
|
2013-05-01 04:49:19 -05:00
|
|
|
endef
|
|
|
|
|
2013-10-21 04:18:21 -05:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2015-02-02 22:42:05 -06:00
|
|
|
$(if $(findstring android, $(target)), \
|
2013-05-03 10:47:54 -05:00
|
|
|
$(if $(findstring adb,$(CFG_ADB)), \
|
2013-08-07 06:42:44 -05:00
|
|
|
$(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
|
2013-05-03 10:47:54 -05:00
|
|
|
$(info install: install-runtime-target for $(target) enabled \
|
2013-05-01 04:49:19 -05:00
|
|
|
$(info install: android device attached) \
|
2013-05-03 10:47:54 -05:00
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
|
|
|
|
$(info install: install-runtime-target for $(target) disabled \
|
2013-05-01 04:49:19 -05:00
|
|
|
$(info install: android device not attached) \
|
2013-05-03 10:47:54 -05:00
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
|
2013-05-01 04:49:19 -05:00
|
|
|
), \
|
2013-05-03 10:47:54 -05:00
|
|
|
$(info install: install-runtime-target for $(target) disabled \
|
2013-05-01 04:49:19 -05:00
|
|
|
$(info install: adb not found) \
|
2013-05-03 10:47:54 -05:00
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
|
2013-05-01 04:49:19 -05:00
|
|
|
), \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
|
2013-05-03 10:47:54 -05:00
|
|
|
ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
|
|
|
|
$(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
|
|
|
|
L_TOKEN := $(word 2,$(MAKECMDGOALS))
|
|
|
|
ifeq ($(L_TOKEN),)
|
2013-05-02 21:14:01 -05:00
|
|
|
CFG_RUNTIME_PUSH_DIR=/system/lib
|
2013-05-03 10:47:54 -05:00
|
|
|
else
|
|
|
|
CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
|
|
|
|
endif
|
2013-05-02 21:14:01 -05:00
|
|
|
|
2013-05-03 10:47:54 -05:00
|
|
|
ifeq ($(CFG_ADB_DEVICE_STATUS),true)
|
2013-05-01 04:49:19 -05:00
|
|
|
ifdef VERBOSE
|
|
|
|
ADB = adb $(1)
|
|
|
|
ADB_PUSH = adb push $(1) $(2)
|
2013-05-06 20:09:34 -05:00
|
|
|
ADB_SHELL = adb shell $(1) $(2)
|
2013-05-01 04:49:19 -05:00
|
|
|
else
|
2013-05-06 20:09:34 -05:00
|
|
|
ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
|
2013-05-03 10:47:54 -05:00
|
|
|
ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
|
|
|
|
ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
|
2013-05-01 04:49:19 -05:00
|
|
|
endif
|
|
|
|
|
|
|
|
define INSTALL_RUNTIME_TARGET_N
|
|
|
|
install-runtime-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
|
2014-01-29 01:29:38 -06:00
|
|
|
$$(Q)$$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
|
2014-07-22 23:45:08 -05:00
|
|
|
$$(Q)$$(foreach crate,$$(TARGET_CRATES), \
|
|
|
|
$$(call ADB_PUSH,$$(TL$(1)$(2))/$$(call CFG_LIB_GLOB_$(1),$$(crate)), \
|
2014-01-29 01:29:38 -06:00
|
|
|
$$(CFG_RUNTIME_PUSH_DIR));)
|
2013-05-01 04:49:19 -05:00
|
|
|
endef
|
|
|
|
|
|
|
|
define INSTALL_RUNTIME_TARGET_CLEANUP_N
|
|
|
|
install-runtime-target-$(1)-cleanup:
|
2014-01-29 01:29:38 -06:00
|
|
|
$$(Q)$$(call ADB,remount)
|
2014-07-22 23:45:08 -05:00
|
|
|
$$(Q)$$(foreach crate,$$(TARGET_CRATES), \
|
2014-01-29 01:29:38 -06:00
|
|
|
$$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));)
|
2013-05-01 04:49:19 -05:00
|
|
|
endef
|
|
|
|
|
2015-01-22 06:39:06 -06:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
|
|
|
$(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
|
|
|
|
$(eval $(call INSTALL_RUNTIME_TARGET_N,$(taget),$(CFG_BUILD))) \
|
2015-02-02 02:42:23 -06:00
|
|
|
$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,$(target))) \
|
2015-01-22 06:39:06 -06:00
|
|
|
))
|
2013-05-01 04:49:19 -05:00
|
|
|
|
|
|
|
install-runtime-target: \
|
|
|
|
install-runtime-target-arm-linux-androideabi-cleanup \
|
2013-10-21 04:18:21 -05:00
|
|
|
install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD)
|
2013-05-01 04:49:19 -05:00
|
|
|
else
|
2013-05-06 20:09:34 -05:00
|
|
|
install-runtime-target:
|
2013-05-03 10:47:54 -05:00
|
|
|
@echo "No device to install runtime library"
|
2013-05-06 20:09:34 -05:00
|
|
|
@echo
|
2013-05-03 10:47:54 -05:00
|
|
|
endif
|
2013-05-01 04:49:19 -05:00
|
|
|
endif
|