1 # Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 # file at the top-level directory of this distribution and at
3 # http://rust-lang.org/COPYRIGHT.
5 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 # option. This file may not be copied, modified, or distributed
9 # except according to those terms.
11 # Generic rule for copying any target crate to a host crate. This rule will also
12 # promote any dependent rust crates up to their host locations as well
14 # $(1) - the stage to copy from
15 # $(2) - the stage to copy to
16 # $(3) - the host triple
17 # $(4) - the target triple (same as $(3))
18 # $(5) - the name of the crate being processed
19 define CP_HOST_STAGE_N_CRATE
21 $$(HLIB$(2)_H_$(4))/stamp.$(5): \
22 $$(TLIB$(1)_T_$(3)_H_$(4))/stamp.$(5) \
23 $$(RUST_DEPS_$(5):%=$$(HLIB$(2)_H_$(4))/stamp.%) \
24 | $$(HLIB$(2)_H_$(4))/
25 @$$(call E, cp: $$(@D)/lib$(5))
26 $$(call REMOVE_ALL_OLD_GLOB_MATCHES,\
27 $$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5)))
29 $$(Q)cp -R $$(TLIB$(1)_T_$(3)_H_$(4))/$$(call CFG_LIB_GLOB_$(3),$(5)) \
31 $$(call LIST_ALL_OLD_GLOB_MATCHES,\
32 $$(dir $$@)$$(call CFG_LIB_GLOB_$(3),$(5)))
36 # Same as the above macro, but for tools instead of crates
37 define CP_HOST_STAGE_N_TOOL
39 $$(HBIN$(2)_H_$(4))/$(5)$$(X_$(3)): \
40 $$(TBIN$(1)_T_$(3)_H_$(4))/$(5)$$(X_$(3)) \
41 $$(TOOL_DEPS_$(5):%=$$(HLIB$(2)_H_$(4))/stamp.%) \
42 | $$(HBIN$(2)_H_$(4))/
49 # Miscellaneous rules for just making a few directories.
51 # $(1) - the stage to copy from
52 # $(2) - the stage to copy to
53 # $(3) - the target triple
54 # $(4) - the host triple (same as $(3))
55 define CP_HOST_STAGE_N
60 ifneq ($(CFG_LIBDIR_RELATIVE),bin)
67 $(foreach t,$(CFG_HOST), \
68 $(eval $(call CP_HOST_STAGE_N,0,1,$(t),$(t))) \
69 $(eval $(call CP_HOST_STAGE_N,1,2,$(t),$(t))) \
70 $(eval $(call CP_HOST_STAGE_N,2,3,$(t),$(t))))
72 $(foreach crate,$(CRATES), \
73 $(foreach t,$(CFG_HOST), \
74 $(eval $(call CP_HOST_STAGE_N_CRATE,0,1,$(t),$(t),$(crate))) \
75 $(eval $(call CP_HOST_STAGE_N_CRATE,1,2,$(t),$(t),$(crate))) \
76 $(eval $(call CP_HOST_STAGE_N_CRATE,2,3,$(t),$(t),$(crate)))))
78 $(foreach tool,$(TOOLS), \
79 $(foreach t,$(CFG_HOST), \
80 $(eval $(call CP_HOST_STAGE_N_TOOL,0,1,$(t),$(t),$(tool))) \
81 $(eval $(call CP_HOST_STAGE_N_TOOL,1,2,$(t),$(t),$(tool))) \
82 $(eval $(call CP_HOST_STAGE_N_TOOL,2,3,$(t),$(t),$(tool)))))