2012-12-11 01:32:48 +00: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 04:18:22 +00: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.
|
|
|
|
|
|
|
|
# Installation macro. Call with source directory as arg 1,
|
2011-12-02 16:51:59 +00:00
|
|
|
# destination directory as arg 2, and filename/libname-glob as arg 3
|
2011-10-01 02:00:19 +00:00
|
|
|
ifdef VERBOSE
|
2012-01-28 22:32:38 +00:00
|
|
|
INSTALL = install -m755 $(1)/$(3) $(2)/$(3)
|
2012-07-12 19:41:39 +00:00
|
|
|
INSTALL_LIB = install -m644 `ls -drt1 $(1)/$(3) | tail -1` $(2)/
|
2011-10-01 02:00:19 +00:00
|
|
|
else
|
2012-01-28 22:32:38 +00:00
|
|
|
INSTALL = $(Q)$(call E, install: $(2)/$(3)) && install -m755 $(1)/$(3) $(2)/$(3)
|
2012-07-11 22:04:32 +00:00
|
|
|
INSTALL_LIB = $(Q)$(call E, install_lib: $(2)/$(3)) && \
|
2012-07-12 19:41:39 +00:00
|
|
|
install -m644 `ls -drt1 $(1)/$(3) | tail -1` $(2)/
|
2011-10-01 02:00:19 +00:00
|
|
|
endif
|
|
|
|
|
2011-10-02 03:12:08 +00:00
|
|
|
# The stage we install from
|
2012-01-16 05:42:03 +00:00
|
|
|
ISTAGE = 2
|
2011-10-01 02:00:19 +00:00
|
|
|
|
|
|
|
PREFIX_ROOT = $(CFG_PREFIX)
|
|
|
|
PREFIX_BIN = $(PREFIX_ROOT)/bin
|
2012-02-25 02:29:44 +00:00
|
|
|
PREFIX_LIB = $(PREFIX_ROOT)/$(CFG_LIBDIR)
|
2011-10-01 02:00:19 +00:00
|
|
|
|
2013-03-04 10:14:24 +00:00
|
|
|
define INSTALL_PREPARE_N
|
2011-11-21 21:11:40 +00:00
|
|
|
# $(1) is the target triple
|
|
|
|
# $(2) is the host triple
|
2011-10-01 02:00:19 +00:00
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
# T{B,L} == Target {Bin, Lib} for stage ${ISTAGE}
|
2011-11-29 20:42:05 +00:00
|
|
|
TB$(1)$(2) = $$(TBIN$$(ISTAGE)_T_$(1)_H_$(2))
|
|
|
|
TL$(1)$(2) = $$(TLIB$$(ISTAGE)_T_$(1)_H_$(2))
|
2011-10-01 02:00:19 +00:00
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
# PT{R,B,L} == Prefix Target {Root, Bin, Lib}
|
2011-11-29 20:42:05 +00:00
|
|
|
PTR$(1)$(2) = $$(PREFIX_LIB)/rustc/$(1)
|
|
|
|
PTB$(1)$(2) = $$(PTR$(1)$(2))/bin
|
2012-02-25 02:29:44 +00:00
|
|
|
PTL$(1)$(2) = $$(PTR$(1)$(2))/$(CFG_LIBDIR)
|
2011-10-01 02:00:19 +00:00
|
|
|
|
2013-03-04 10:14:24 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
|
|
|
$(eval $(call INSTALL_PREPARE_N,$(target),$(CFG_BUILD_TRIPLE))))
|
|
|
|
|
|
|
|
define INSTALL_TARGET_N
|
|
|
|
install-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
|
|
|
|
$$(Q)mkdir -p $$(PTL$(1)$(2))
|
2013-03-31 23:14:02 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME_$(1)))
|
2013-03-04 10:14:24 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CORELIB_GLOB_$(1)))
|
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(STDLIB_GLOB_$(1)))
|
2013-03-31 23:14:02 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
|
2013-03-04 10:14:24 +00:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
define INSTALL_HOST_N
|
2012-11-13 21:32:49 +00:00
|
|
|
install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
|
2011-11-29 20:42:05 +00:00
|
|
|
$$(Q)mkdir -p $$(PTL$(1)$(2))
|
2013-03-31 23:14:02 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME_$(1)))
|
2011-12-02 16:51:59 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
2013-03-01 23:48:11 +00:00
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CORELIB_GLOB_$(1)))
|
2011-12-02 16:51:59 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
2013-03-01 23:48:11 +00:00
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(STDLIB_GLOB_$(1)))
|
2011-12-17 01:21:18 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
2013-03-01 23:48:11 +00:00
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTC_GLOB_$(1)))
|
2012-03-22 22:27:35 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
2013-03-01 23:48:11 +00:00
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBSYNTAX_GLOB_$(1)))
|
2012-11-07 22:05:37 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
2013-03-01 23:48:11 +00:00
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTPKG_GLOB_$(1)))
|
2012-11-07 22:05:37 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
2013-03-01 23:48:11 +00:00
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTDOC_GLOB_$(1)))
|
2012-11-07 08:45:42 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
2013-03-01 23:48:11 +00:00
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTI_GLOB_$(1)))
|
2013-02-18 19:18:34 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
2013-03-01 23:48:11 +00:00
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUST_GLOB_$(1)))
|
2013-03-31 23:14:02 +00:00
|
|
|
$$(Q)$$(call INSTALL_LIB,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
|
2012-01-30 23:32:04 +00:00
|
|
|
|
2011-10-01 02:00:19 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
2013-03-04 10:14:24 +00:00
|
|
|
$(if $(findstring $(target), $(CFG_BUILD_TRIPLE)), \
|
|
|
|
$(eval $(call INSTALL_HOST_N,$(target),$(CFG_BUILD_TRIPLE))), \
|
|
|
|
$(eval $(call INSTALL_TARGET_N,$(target),$(CFG_BUILD_TRIPLE)))))
|
2011-10-01 02:00:19 +00:00
|
|
|
|
|
|
|
INSTALL_TARGET_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \
|
2013-02-22 00:15:01 +00:00
|
|
|
install-target-$(target)-host-$(CFG_BUILD_TRIPLE))
|
2011-10-01 02:00:19 +00:00
|
|
|
|
2011-12-30 20:48:07 +00:00
|
|
|
install: all install-host install-targets
|
2011-10-01 02:00:19 +00:00
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
# Shorthand for build/stageN/bin
|
2013-02-22 00:15:01 +00:00
|
|
|
HB = $(HBIN$(ISTAGE)_H_$(CFG_BUILD_TRIPLE))
|
|
|
|
HB2 = $(HBIN2_H_$(CFG_BUILD_TRIPLE))
|
2011-11-21 21:11:40 +00:00
|
|
|
# Shorthand for build/stageN/lib
|
2013-02-22 00:15:01 +00:00
|
|
|
HL = $(HLIB$(ISTAGE)_H_$(CFG_BUILD_TRIPLE))
|
2011-11-21 21:11:40 +00:00
|
|
|
# Shorthand for the prefix bin directory
|
|
|
|
PHB = $(PREFIX_BIN)
|
|
|
|
# Shorthand for the prefix bin directory
|
|
|
|
PHL = $(PREFIX_LIB)
|
|
|
|
|
2013-02-22 00:15:01 +00:00
|
|
|
install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_TRIPLE)_H_$(CFG_BUILD_TRIPLE))
|
2011-10-01 02:00:19 +00:00
|
|
|
$(Q)mkdir -p $(PREFIX_BIN)
|
|
|
|
$(Q)mkdir -p $(PREFIX_LIB)
|
2011-11-04 23:53:23 +00:00
|
|
|
$(Q)mkdir -p $(PREFIX_ROOT)/share/man/man1
|
2013-03-02 12:25:12 +00:00
|
|
|
$(Q)$(call INSTALL,$(HB2),$(PHB),rustc$(X_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL,$(HB2),$(PHB),rustpkg$(X_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL,$(HB2),$(PHB),rustdoc$(X_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL,$(HB2),$(PHB),rusti$(X_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL,$(HB2),$(PHB),rust$(X_$(CFG_BUILD_TRIPLE)))
|
2013-03-01 23:48:11 +00:00
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(CORELIB_GLOB_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(STDLIB_GLOB_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTC_GLOB_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBSYNTAX_GLOB_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTI_GLOB_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUST_GLOB_$(CFG_BUILD_TRIPLE)))
|
2013-04-02 23:25:03 +00:00
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTPKG_GLOB_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTDOC_GLOB_$(CFG_BUILD_TRIPLE)))
|
2013-03-01 23:48:11 +00:00
|
|
|
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUNTIME_$(CFG_BUILD_TRIPLE)))
|
|
|
|
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM_$(CFG_BUILD_TRIPLE)))
|
2011-10-26 04:17:57 +00:00
|
|
|
$(Q)$(call INSTALL,$(S)/man, \
|
|
|
|
$(PREFIX_ROOT)/share/man/man1,rustc.1)
|
2011-10-01 02:00:19 +00:00
|
|
|
|
|
|
|
install-targets: $(INSTALL_TARGET_RULES)
|
2012-01-30 23:32:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
HOST_LIB_FROM_HL_GLOB = \
|
2012-07-11 22:04:32 +00:00
|
|
|
$(patsubst $(HL)/%,$(PHL)/%,$(wildcard $(HL)/$(1)))
|
2012-01-30 23:32:04 +00:00
|
|
|
|
|
|
|
uninstall:
|
2013-03-02 12:25:12 +00:00
|
|
|
$(Q)rm -f $(PHB)/rustc$(X_$(CFG_BUILD_TRIPLE))
|
|
|
|
$(Q)rm -f $(PHB)/rustpkg$(X_$(CFG_BUILD_TRIPLE))
|
|
|
|
$(Q)rm -f $(PHB)/rusti$(X_$(CFG_BUILD_TRIPLE))
|
|
|
|
$(Q)rm -f $(PHB)/rust$(X_$(CFG_BUILD_TRIPLE))
|
|
|
|
$(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD_TRIPLE))
|
2013-03-01 23:48:11 +00:00
|
|
|
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD_TRIPLE))
|
|
|
|
$(Q)rm -f $(PHL)/$(CFG_RUNTIME_$(CFG_BUILD_TRIPLE))
|
2012-01-30 23:32:04 +00:00
|
|
|
$(Q)for i in \
|
2013-03-01 23:48:11 +00:00
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(CORELIB_GLOB_$(CFG_BUILD_TRIPLE))) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_GLOB_$(CFG_BUILD_TRIPLE))) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTC_GLOB_$(CFG_BUILD_TRIPLE))) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBSYNTAX_GLOB_$(CFG_BUILD_TRIPLE))) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD_TRIPLE))) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD_TRIPLE))) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTI_GLOB_$(CFG_BUILD_TRIPLE))) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUST_GLOB_$(CFG_BUILD_TRIPLE))) \
|
2012-01-30 23:32:04 +00:00
|
|
|
; \
|
|
|
|
do rm -f $$i ; \
|
|
|
|
done
|
|
|
|
$(Q)rm -Rf $(PHL)/rustc
|
|
|
|
$(Q)rm -f $(PREFIX_ROOT)/share/man/man1/rustc.1
|