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.
|
|
|
|
|
|
|
|
# Installation macro. Call with source directory as arg 1,
|
2011-12-02 17:51:59 +01:00
|
|
|
# destination directory as arg 2, and filename/libname-glob as arg 3
|
2011-10-01 04:00:19 +02:00
|
|
|
ifdef VERBOSE
|
2012-01-28 23:32:38 +01:00
|
|
|
INSTALL = install -m755 $(1)/$(3) $(2)/$(3)
|
2012-01-28 02:52:44 +01:00
|
|
|
INSTALL_LIB = install -m644 `ls -rt1 $(1)/$(3) | tail -1` $(2)/
|
2011-10-01 04:00:19 +02:00
|
|
|
else
|
2012-01-28 23:32:38 +01:00
|
|
|
INSTALL = $(Q)$(call E, install: $(2)/$(3)) && install -m755 $(1)/$(3) $(2)/$(3)
|
2011-12-02 17:51:59 +01:00
|
|
|
INSTALL_LIB = $(Q)$(call E, install_lib: $(2)/$(3)) && \
|
2012-01-28 02:52:44 +01:00
|
|
|
install -m644 `ls -rt1 $(1)/$(3) | tail -1` $(2)/
|
2011-10-01 04:00:19 +02:00
|
|
|
endif
|
|
|
|
|
2011-10-02 05:12:08 +02:00
|
|
|
# The stage we install from
|
2012-01-16 06:42:03 +01:00
|
|
|
ISTAGE = 2
|
2011-10-01 04:00:19 +02:00
|
|
|
|
|
|
|
PREFIX_ROOT = $(CFG_PREFIX)
|
|
|
|
PREFIX_BIN = $(PREFIX_ROOT)/bin
|
2012-02-25 03:29:44 +01:00
|
|
|
PREFIX_LIB = $(PREFIX_ROOT)/$(CFG_LIBDIR)
|
2011-10-01 04:00:19 +02:00
|
|
|
|
|
|
|
define INSTALL_TARGET_N
|
2011-11-21 22:11:40 +01:00
|
|
|
# $(1) is the target triple
|
|
|
|
# $(2) is the host triple
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
# T{B,L} == Target {Bin, Lib} for stage ${ISTAGE}
|
2011-11-29 21:42:05 +01:00
|
|
|
TB$(1)$(2) = $$(TBIN$$(ISTAGE)_T_$(1)_H_$(2))
|
|
|
|
TL$(1)$(2) = $$(TLIB$$(ISTAGE)_T_$(1)_H_$(2))
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
# PT{R,B,L} == Prefix Target {Root, Bin, Lib}
|
2011-11-29 21:42:05 +01:00
|
|
|
PTR$(1)$(2) = $$(PREFIX_LIB)/rustc/$(1)
|
|
|
|
PTB$(1)$(2) = $$(PTR$(1)$(2))/bin
|
2012-02-25 03:29:44 +01:00
|
|
|
PTL$(1)$(2) = $$(PTR$(1)$(2))/$(CFG_LIBDIR)
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
install-target-$(1)-host-$(2): $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
|
2011-11-29 21:42:05 +01:00
|
|
|
$$(Q)mkdir -p $$(PTL$(1)$(2))
|
|
|
|
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME))
|
2011-12-02 17:51:59 +01:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CORELIB_GLOB))
|
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(STDLIB_GLOB))
|
2011-12-17 02:21:18 +01:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTC_GLOB))
|
2012-03-22 23:27:35 +01:00
|
|
|
$$(Q)$$(call INSTALL_LIB, \
|
|
|
|
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTSYNTAX_GLOB))
|
2011-11-29 21:42:05 +01:00
|
|
|
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
|
2012-01-31 00:32:04 +01:00
|
|
|
|
2011-10-01 04:00:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
2011-11-21 22:11:40 +01:00
|
|
|
$(eval $(call INSTALL_TARGET_N,$(target),$(CFG_HOST_TRIPLE))))
|
2011-10-01 04:00:19 +02:00
|
|
|
|
|
|
|
INSTALL_TARGET_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \
|
2011-11-21 22:11:40 +01:00
|
|
|
install-target-$(target)-host-$(CFG_HOST_TRIPLE))
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2011-12-30 21:48:07 +01:00
|
|
|
install: all install-host install-targets
|
2011-10-01 04:00:19 +02:00
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
# Shorthand for build/stageN/bin
|
2011-11-29 21:42:05 +01:00
|
|
|
HB = $(HBIN$(ISTAGE)_H_$(CFG_HOST_TRIPLE))
|
2012-01-16 06:42:03 +01:00
|
|
|
HB3 = $(HBIN3_H_$(CFG_HOST_TRIPLE))
|
2011-11-21 22:11:40 +01:00
|
|
|
# Shorthand for build/stageN/lib
|
2011-11-29 21:42:05 +01:00
|
|
|
HL = $(HLIB$(ISTAGE)_H_$(CFG_HOST_TRIPLE))
|
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)
|
|
|
|
|
2011-11-29 21:42:05 +01:00
|
|
|
install-host: $(SREQ$(ISTAGE)_T_$(CFG_HOST_TRIPLE)_H_$(CFG_HOST_TRIPLE))
|
2011-10-01 04:00:19 +02:00
|
|
|
$(Q)mkdir -p $(PREFIX_BIN)
|
|
|
|
$(Q)mkdir -p $(PREFIX_LIB)
|
2011-11-05 00:53:23 +01:00
|
|
|
$(Q)mkdir -p $(PREFIX_ROOT)/share/man/man1
|
2012-01-16 06:42:03 +01:00
|
|
|
$(Q)$(call INSTALL,$(HB3),$(PHB),rustc$(X))
|
|
|
|
$(Q)$(call INSTALL,$(HB3),$(PHB),cargo$(X))
|
|
|
|
$(Q)$(call INSTALL,$(HB3),$(PHB),rustdoc$(X))
|
2011-10-01 04:00:19 +02:00
|
|
|
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUNTIME))
|
2011-12-02 17:51:59 +01:00
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(CORELIB_GLOB))
|
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(STDLIB_GLOB))
|
2011-12-17 02:21:18 +01:00
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTC_GLOB))
|
2012-03-22 23:27:35 +01:00
|
|
|
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTSYNTAX_GLOB))
|
2011-10-01 04:00:19 +02:00
|
|
|
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM))
|
2011-10-26 06:17:57 +02:00
|
|
|
$(Q)$(call INSTALL,$(S)/man, \
|
|
|
|
$(PREFIX_ROOT)/share/man/man1,rustc.1)
|
2011-10-01 04:00:19 +02:00
|
|
|
|
|
|
|
install-targets: $(INSTALL_TARGET_RULES)
|
2012-01-31 00:32:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
HOST_LIB_FROM_HL_GLOB = \
|
|
|
|
$(patsubst $(HL)/%,$(PHL)/%,$(wildcard $(HL)/$(1)))
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
$(Q)rm -f $(PHB)/rustc$(X)
|
|
|
|
$(Q)rm -f $(PHB)/cargo$(X)
|
|
|
|
$(Q)rm -f $(PHB)/rustdoc$(X)
|
|
|
|
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM)
|
|
|
|
$(Q)rm -f $(PHL)/$(CFG_RUNTIME)
|
|
|
|
$(Q)for i in \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(CORELIB_GLOB)) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_GLOB)) \
|
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTC_GLOB)) \
|
2012-03-22 23:27:35 +01:00
|
|
|
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTSYNTAX_GLOB)) \
|
2012-01-31 00:32:04 +01:00
|
|
|
; \
|
|
|
|
do rm -f $$i ; \
|
|
|
|
done
|
|
|
|
$(Q)rm -Rf $(PHL)/rustc
|
|
|
|
$(Q)rm -f $(PREFIX_ROOT)/share/man/man1/rustc.1
|