2012-12-11 02:32:48 +01: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.
|
|
|
|
|
2011-10-26 06:18:22 +02:00
|
|
|
# FIXME: Docs are currently not installed from the stageN dirs.
|
|
|
|
# For consistency it might be desirable for stageN to be an exact
|
|
|
|
# mirror of the installation directory structure.
|
|
|
|
|
2011-10-02 05:12:08 +02:00
|
|
|
# The stage we install from
|
2014-03-20 06:47:37 +01:00
|
|
|
ISTAGE = $(PREPARE_STAGE)
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2014-02-13 08:53:36 +01:00
|
|
|
install: PREPARE_HOST=$(CFG_BUILD)
|
2014-02-16 06:47:28 +01:00
|
|
|
install: PREPARE_TARGETS=$(CFG_TARGET)
|
2014-02-13 08:53:36 +01:00
|
|
|
install: PREPARE_DIR_CMD=$(DEFAULT_PREPARE_DIR_CMD)
|
|
|
|
install: PREPARE_BIN_CMD=$(DEFAULT_PREPARE_BIN_CMD)
|
|
|
|
install: PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
|
|
|
|
install: PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD)
|
|
|
|
install: PREPARE_SOURCE_DIR=$(PREPARE_HOST)/stage$(PREPARE_STAGE)
|
|
|
|
install: PREPARE_SOURCE_BIN_DIR=$(PREPARE_SOURCE_DIR)/bin
|
|
|
|
install: PREPARE_SOURCE_LIB_DIR=$(PREPARE_SOURCE_DIR)/$(CFG_LIBDIR_RELATIVE)
|
|
|
|
install: PREPARE_SOURCE_MAN_DIR=$(S)/man
|
2014-02-16 06:47:28 +01:00
|
|
|
install: PREPARE_DEST_BIN_DIR=$(DESTDIR)$(CFG_PREFIX)/bin
|
|
|
|
install: PREPARE_DEST_LIB_DIR=$(DESTDIR)$(CFG_LIBDIR)
|
|
|
|
install: PREPARE_DEST_MAN_DIR=$(DESTDIR)$(CFG_MANDIR)/man1
|
2014-02-13 08:53:36 +01:00
|
|
|
install: prepare-everything
|
|
|
|
|
|
|
|
|
|
|
|
# Uninstall code
|
|
|
|
|
2011-10-01 04:00:19 +02:00
|
|
|
PREFIX_ROOT = $(CFG_PREFIX)
|
|
|
|
PREFIX_BIN = $(PREFIX_ROOT)/bin
|
2014-01-07 17:51:15 +01:00
|
|
|
PREFIX_LIB = $(CFG_LIBDIR)
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2014-02-13 08:53:36 +01:00
|
|
|
INSTALL_TOOLS := $(PREPARE_TOOLS)
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
# Shorthand for build/stageN/bin
|
2013-10-21 11:18:21 +02:00
|
|
|
HB = $(HBIN$(ISTAGE)_H_$(CFG_BUILD))
|
|
|
|
HB2 = $(HBIN2_H_$(CFG_BUILD))
|
2011-11-21 22:11:40 +01:00
|
|
|
# Shorthand for build/stageN/lib
|
2013-10-21 11:18:21 +02:00
|
|
|
HL = $(HLIB$(ISTAGE)_H_$(CFG_BUILD))
|
2011-11-21 22:11:40 +01:00
|
|
|
# Shorthand for the prefix bin directory
|
|
|
|
PHB = $(PREFIX_BIN)
|
|
|
|
# Shorthand for the prefix bin directory
|
|
|
|
PHL = $(PREFIX_LIB)
|
|
|
|
|
2012-01-31 00:32:04 +01:00
|
|
|
HOST_LIB_FROM_HL_GLOB = \
|
2012-07-12 00:04:32 +02:00
|
|
|
$(patsubst $(HL)/%,$(PHL)/%,$(wildcard $(HL)/$(1)))
|
2012-01-31 00:32:04 +01:00
|
|
|
|
2014-01-25 04:27:22 +01:00
|
|
|
uninstall: $(foreach tool,$(INSTALL_TOOLS),uninstall-tool-$(tool))
|
2014-01-10 20:45:41 +01:00
|
|
|
$(Q)rm -Rf $(PHL)/$(CFG_RUSTLIBDIR)
|
2014-01-25 04:27:22 +01:00
|
|
|
|
|
|
|
define UNINSTALL_TOOL
|
|
|
|
uninstall-tool-$(1): $$(foreach dep,$$(TOOL_DEPS_$(1)),uninstall-lib-$$(dep))
|
|
|
|
$$(Q)rm -f $$(PHB)/$(1)$$(X_$$(CFG_BUILD))
|
|
|
|
$$(Q)rm -f $$(CFG_MANDIR)/man1/$(1).1
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach tool,$(INSTALL_TOOLS),$(eval $(call UNINSTALL_TOOL,$(tool))))
|
|
|
|
|
|
|
|
define UNINSTALL_LIB
|
|
|
|
uninstall-lib-$(1): $$(foreach dep,$$(RUST_DEPS_$(1)),uninstall-lib-$$(dep))
|
|
|
|
$$(Q)rm -f $$(call HOST_LIB_FROM_HL_GLOB,$$(call CFG_LIB_GLOB_$$(CFG_BUILD),$(1)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach lib,$(CRATES),$(eval $(call UNINSTALL_LIB,$(lib))))
|
2013-05-01 11:49:19 +02:00
|
|
|
|
2014-02-13 08:53:36 +01:00
|
|
|
|
|
|
|
# Android runtime setup
|
|
|
|
# FIXME: This probably belongs somewhere else
|
|
|
|
|
2013-05-01 11:49:19 +02:00
|
|
|
# target platform specific variables
|
|
|
|
# for arm-linux-androidabi
|
2013-05-03 17:47:54 +02:00
|
|
|
define DEF_ADB_DEVICE_STATUS
|
|
|
|
CFG_ADB_DEVICE_STATUS=$(1)
|
2013-05-01 11:49:19 +02:00
|
|
|
endef
|
|
|
|
|
2013-10-21 11:18:21 +02:00
|
|
|
$(foreach target,$(CFG_TARGET), \
|
2013-05-01 11:49:19 +02:00
|
|
|
$(if $(findstring $(target),"arm-linux-androideabi"), \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(if $(findstring adb,$(CFG_ADB)), \
|
2013-08-07 13:42:44 +02:00
|
|
|
$(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(info install: install-runtime-target for $(target) enabled \
|
2013-05-01 11:49:19 +02:00
|
|
|
$(info install: android device attached) \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
|
|
|
|
$(info install: install-runtime-target for $(target) disabled \
|
2013-05-01 11:49:19 +02:00
|
|
|
$(info install: android device not attached) \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
|
2013-05-01 11:49:19 +02:00
|
|
|
), \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(info install: install-runtime-target for $(target) disabled \
|
2013-05-01 11:49:19 +02:00
|
|
|
$(info install: adb not found) \
|
2013-05-03 17:47:54 +02:00
|
|
|
$(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
|
2013-05-01 11:49:19 +02:00
|
|
|
), \
|
|
|
|
) \
|
|
|
|
)
|
|
|
|
|
2013-05-03 17:47:54 +02:00
|
|
|
ifeq (install-runtime-target,$(firstword $(MAKECMDGOALS)))
|
|
|
|
$(eval $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)):;@:)
|
|
|
|
L_TOKEN := $(word 2,$(MAKECMDGOALS))
|
|
|
|
ifeq ($(L_TOKEN),)
|
2013-05-03 04:14:01 +02:00
|
|
|
CFG_RUNTIME_PUSH_DIR=/system/lib
|
2013-05-03 17:47:54 +02:00
|
|
|
else
|
|
|
|
CFG_RUNTIME_PUSH_DIR=$(L_TOKEN)
|
|
|
|
endif
|
2013-05-03 04:14:01 +02:00
|
|
|
|
2013-05-03 17:47:54 +02:00
|
|
|
ifeq ($(CFG_ADB_DEVICE_STATUS),true)
|
2013-05-01 11:49:19 +02:00
|
|
|
ifdef VERBOSE
|
|
|
|
ADB = adb $(1)
|
|
|
|
ADB_PUSH = adb push $(1) $(2)
|
2013-05-07 03:09:34 +02:00
|
|
|
ADB_SHELL = adb shell $(1) $(2)
|
2013-05-01 11:49:19 +02:00
|
|
|
else
|
2013-05-07 03:09:34 +02:00
|
|
|
ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
|
2013-05-03 17:47:54 +02: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 11:49:19 +02: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 08:29:38 +01:00
|
|
|
$$(Q)$$(call ADB_SHELL,mkdir,$(CFG_RUNTIME_PUSH_DIR))
|
|
|
|
$$(Q)$$(foreach crate,$$(TARGET_CRATES),\
|
|
|
|
$$(call ADB_PUSH,$$(TL$(1)$(2))/$$(call CFG_LIB_GLOB_$(1),$$(crate)),\
|
|
|
|
$$(CFG_RUNTIME_PUSH_DIR));)
|
2013-05-01 11:49:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define INSTALL_RUNTIME_TARGET_CLEANUP_N
|
|
|
|
install-runtime-target-$(1)-cleanup:
|
2014-01-29 08:29:38 +01:00
|
|
|
$$(Q)$$(call ADB,remount)
|
|
|
|
$$(Q)$$(foreach crate,$$(TARGET_CRATES),\
|
|
|
|
$$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));)
|
2013-05-01 11:49:19 +02:00
|
|
|
endef
|
|
|
|
|
2013-10-21 11:18:21 +02:00
|
|
|
$(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD)))
|
2013-05-01 11:49:19 +02:00
|
|
|
$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
|
|
|
|
|
|
|
|
install-runtime-target: \
|
|
|
|
install-runtime-target-arm-linux-androideabi-cleanup \
|
2013-10-21 11:18:21 +02:00
|
|
|
install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD)
|
2013-05-01 11:49:19 +02:00
|
|
|
else
|
2013-05-07 03:09:34 +02:00
|
|
|
install-runtime-target:
|
2013-05-03 17:47:54 +02:00
|
|
|
@echo "No device to install runtime library"
|
2013-05-07 03:09:34 +02:00
|
|
|
@echo
|
2013-05-03 17:47:54 +02:00
|
|
|
endif
|
2013-05-01 11:49:19 +02:00
|
|
|
endif
|