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.
|
|
|
|
|
2014-01-25 04:27:22 +01:00
|
|
|
# Generic rule for copying any target crate to a host crate. This rule will also
|
|
|
|
# promote any dependent rust crates up to their host locations as well
|
2011-10-02 05:12:08 +02:00
|
|
|
#
|
2014-01-25 04:27:22 +01:00
|
|
|
# $(1) - the stage to copy from
|
|
|
|
# $(2) - the stage to copy to
|
|
|
|
# $(3) - the host triple
|
|
|
|
# $(4) - the target triple (same as $(3))
|
|
|
|
# $(5) - the name of the crate being processed
|
|
|
|
define CP_HOST_STAGE_N_CRATE
|
|
|
|
|
2014-05-01 05:05:14 +02:00
|
|
|
ifeq ($$(ONLY_RLIB_$(5)),)
|
2014-07-23 06:37:05 +02:00
|
|
|
$$(HLIB$(2)_H_$(4))/stamp.$(5): \
|
|
|
|
$$(TLIB$(1)_T_$(3)_H_$(4))/stamp.$(5) \
|
|
|
|
$$(RUST_DEPS_$(5):%=$$(HLIB$(2)_H_$(4))/stamp.%) \
|
2013-05-04 12:46:11 +02:00
|
|
|
| $$(HLIB$(2)_H_$(4))/
|
2014-01-25 04:27:22 +01:00
|
|
|
@$$(call E, cp: $$(@D)/lib$(5))
|
2014-07-23 06:45:08 +02:00
|
|
|
$$(call REMOVE_ALL_OLD_GLOB_MATCHES, \
|
2014-01-25 04:27:22 +01:00
|
|
|
$$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5)))
|
2011-10-02 05:12:08 +02:00
|
|
|
$$(Q)cp $$< $$@
|
2014-01-25 04:27:22 +01:00
|
|
|
$$(Q)cp -R $$(TLIB$(1)_T_$(3)_H_$(4))/$$(call CFG_LIB_GLOB_$(3),$(5)) \
|
2011-12-02 17:51:59 +01:00
|
|
|
$$(HLIB$(2)_H_$(4))
|
2014-07-23 06:45:08 +02:00
|
|
|
$$(call LIST_ALL_OLD_GLOB_MATCHES, \
|
2014-01-25 04:27:22 +01:00
|
|
|
$$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5)))
|
2014-05-01 05:05:14 +02:00
|
|
|
else
|
|
|
|
$$(HLIB$(2)_H_$(4))/stamp.$(5):
|
|
|
|
$$(Q)touch $$@
|
|
|
|
endif
|
2011-10-02 05:12:08 +02:00
|
|
|
|
2014-01-25 04:27:22 +01:00
|
|
|
endef
|
2012-03-22 23:27:35 +01:00
|
|
|
|
2014-01-25 04:27:22 +01:00
|
|
|
# Same as the above macro, but for tools instead of crates
|
|
|
|
define CP_HOST_STAGE_N_TOOL
|
2011-10-02 05:12:08 +02:00
|
|
|
|
2014-01-25 04:27:22 +01:00
|
|
|
$$(HBIN$(2)_H_$(4))/$(5)$$(X_$(3)): \
|
|
|
|
$$(TBIN$(1)_T_$(3)_H_$(4))/$(5)$$(X_$(3)) \
|
|
|
|
$$(TOOL_DEPS_$(5):%=$$(HLIB$(2)_H_$(4))/stamp.%) \
|
|
|
|
| $$(HBIN$(2)_H_$(4))/
|
2011-12-06 01:46:37 +01:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2014-01-25 04:27:22 +01:00
|
|
|
endef
|
2011-12-17 02:21:18 +01:00
|
|
|
|
2013-12-13 03:07:23 +01:00
|
|
|
|
2014-01-25 04:27:22 +01:00
|
|
|
# Miscellaneous rules for just making a few directories.
|
|
|
|
#
|
|
|
|
# $(1) - the stage to copy from
|
|
|
|
# $(2) - the stage to copy to
|
|
|
|
# $(3) - the target triple
|
|
|
|
# $(4) - the host triple (same as $(3))
|
|
|
|
define CP_HOST_STAGE_N
|
2013-12-13 03:07:23 +01:00
|
|
|
|
2014-01-14 01:45:33 +01:00
|
|
|
ifneq ($(CFG_LIBDIR_RELATIVE),bin)
|
2013-05-04 12:46:11 +02:00
|
|
|
$$(HLIB$(2)_H_$(4))/:
|
2014-01-25 04:27:22 +01:00
|
|
|
@mkdir -p $$@
|
2013-05-07 08:29:05 +02:00
|
|
|
endif
|
2013-05-04 12:46:11 +02:00
|
|
|
|
2011-10-02 05:12:08 +02:00
|
|
|
endef
|
|
|
|
|
2014-07-23 06:37:05 +02:00
|
|
|
$(foreach t,$(CFG_HOST), \
|
|
|
|
$(eval $(call CP_HOST_STAGE_N,0,1,$(t),$(t))) \
|
|
|
|
$(eval $(call CP_HOST_STAGE_N,1,2,$(t),$(t))) \
|
2011-11-21 22:11:40 +01:00
|
|
|
$(eval $(call CP_HOST_STAGE_N,2,3,$(t),$(t))))
|
2014-01-25 04:27:22 +01:00
|
|
|
|
2014-07-23 06:37:05 +02:00
|
|
|
$(foreach crate,$(CRATES), \
|
|
|
|
$(foreach t,$(CFG_HOST), \
|
|
|
|
$(eval $(call CP_HOST_STAGE_N_CRATE,0,1,$(t),$(t),$(crate))) \
|
|
|
|
$(eval $(call CP_HOST_STAGE_N_CRATE,1,2,$(t),$(t),$(crate))) \
|
2014-01-25 04:27:22 +01:00
|
|
|
$(eval $(call CP_HOST_STAGE_N_CRATE,2,3,$(t),$(t),$(crate)))))
|
|
|
|
|
2014-07-23 06:37:05 +02:00
|
|
|
$(foreach tool,$(TOOLS), \
|
|
|
|
$(foreach t,$(CFG_HOST), \
|
|
|
|
$(eval $(call CP_HOST_STAGE_N_TOOL,0,1,$(t),$(t),$(tool))) \
|
|
|
|
$(eval $(call CP_HOST_STAGE_N_TOOL,1,2,$(t),$(t),$(tool))) \
|
2014-01-25 04:27:22 +01:00
|
|
|
$(eval $(call CP_HOST_STAGE_N_TOOL,2,3,$(t),$(t),$(tool)))))
|