@@ -47,9 +47,9 @@ DEFAULT_PREPARE_MAN_CMD = install -m755
47
47
# Because of the way these rules are organized, preparing from any
48
48
# stage requires all these stages to be built
49
49
ifdef CFG_WINDOWSY_$(CFG_BUILD)
50
- PREPARE_STAGES =1 2 3
50
+ PREPARE_STAGES =3
51
51
else
52
- PREPARE_STAGES =1 2
52
+ PREPARE_STAGES =2
53
53
endif
54
54
55
55
# Create a directory
@@ -98,25 +98,26 @@ endef
98
98
99
99
PREPARE_TOOLS = $(filter-out compiletest, $(TOOLS ) )
100
100
101
- prepare-host : prepare-host-dirs prepare-host- tools
101
+ prepare-host : prepare-host-tools
102
102
103
- prepare-host-dirs :
104
- $(call PREPARE_DIR,$(PREPARE_DEST_BIN_DIR ) )
105
- $(call PREPARE_DIR,$(PREPARE_DEST_LIB_DIR ) )
106
- $(call PREPARE_DIR,$(PREPARE_DEST_MAN_DIR ) )
107
-
108
- prepare-host-tools :\
103
+ prepare-host-tools : \
109
104
$(foreach tool, $(PREPARE_TOOLS),\
110
105
$(foreach stage,$(PREPARE_STAGES),\
111
106
$(foreach host,$(CFG_HOST),\
112
107
prepare-host-tool-$(tool)-$(stage)-$(host))))
113
108
109
+ prepare-host-dirs :
110
+ $(call PREPARE_DIR,$(PREPARE_DEST_BIN_DIR ) )
111
+ $(call PREPARE_DIR,$(PREPARE_DEST_LIB_DIR ) )
112
+ $(call PREPARE_DIR,$(PREPARE_DEST_MAN_DIR ) )
113
+
114
114
# $(1) is tool
115
115
# $(2) is stage
116
116
# $(3) is host
117
117
define DEF_PREPARE_HOST_TOOL
118
118
prepare-host-tool-$(1 ) -$(2 ) -$(3 ) : $$(foreach dep,$$(TOOL_DEPS_$(1 ) ) ,prepare-host-lib-$$(dep ) -$(2 ) -$(3 ) ) \
119
- $$(HBIN$(2 ) _H_$(3 ) ) /$(1 )$$(X_$(3 ) )
119
+ $$(HBIN$(2 ) _H_$(3 ) ) /$(1 )$$(X_$(3 ) ) \
120
+ prepare-host-dirs
120
121
$$(if $$(findstring $(2 ) , $$(PREPARE_STAGE ) ) ,\
121
122
$$(if $$(findstring $(3 ) , $$(PREPARE_HOST ) ) ,\
122
123
$$(call PREPARE_BIN,$(1 )$$(X_$$(PREPARE_HOST ) ) ) ,) ,)
@@ -130,14 +131,18 @@ $(foreach tool,$(PREPARE_TOOLS),\
130
131
$(foreach host,$(CFG_HOST),\
131
132
$(eval $(call DEF_PREPARE_HOST_TOOL,$(tool),$(stage),$(host))))))
132
133
134
+ # For host libraries only install dylibs, not rlibs since the host libs are only
135
+ # used to support rustc and rustc uses dynamic linking
136
+ #
133
137
# $(1) is tool
134
138
# $(2) is stage
135
139
# $(3) is host
136
140
define DEF_PREPARE_HOST_LIB
137
141
prepare-host-lib-$(1 ) -$(2 ) -$(3 ) : PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR )
138
142
prepare-host-lib-$(1 ) -$(2 ) -$(3 ) : PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR )
139
143
prepare-host-lib-$(1 ) -$(2 ) -$(3 ) : $$(foreach dep,$$(RUST_DEPS_$(1 ) ) ,prepare-host-lib-$$(dep ) -$(2 ) -$(3 ) ) \
140
- $$(HLIB$(2 ) _H_$(3 ) ) /stamp.$(1 )
144
+ $$(HLIB$(2 ) _H_$(3 ) ) /stamp.$(1 ) \
145
+ prepare-host-dirs
141
146
$$(if $$(findstring $(2 ) , $$(PREPARE_STAGE ) ) ,\
142
147
$$(if $$(findstring $(3 ) , $$(PREPARE_HOST ) ) ,\
143
148
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$$(PREPARE_HOST ) ,$(1 ) ) ) ,) ,)
@@ -154,30 +159,36 @@ prepare-targets:\
154
159
$(foreach stage,$(PREPARE_STAGES),\
155
160
prepare-target-$(target)-host-$(host)-$(stage))))
156
161
157
- # $(1) is target
158
- # $(2) is host
159
- # $(3) is stage
162
+ # $(1) is stage
163
+ # $(2) is target
164
+ # $(3) is host
160
165
define DEF_PREPARE_TARGET_N
161
166
# Rebind PREPARE_*_LIB_DIR to point to rustlib, then install the libs for the targets
162
- prepare-target-$(1 ) -host-$(2 ) -$(3 ) : PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR ) /rustlib /$(1 ) /lib
163
- prepare-target-$(1 ) -host-$(2 ) -$(3 ) : PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR ) /rustlib /$(1 ) /lib
164
- prepare-target-$(1 ) -host-$(2 ) -$(3 ) : \
167
+ prepare-target-$(2 ) -host-$(3 ) -$(1 ) : PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR ) /$$( CFG_RUSTLIBDIR ) /$(2 ) /lib
168
+ prepare-target-$(2 ) -host-$(3 ) -$(1 ) : PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR ) /$$( CFG_RUSTLIBDIR ) /$(2 ) /lib
169
+ prepare-target-$(2 ) -host-$(3 ) -$(1 ) : \
165
170
$$(foreach crate,$$(TARGET_CRATES ) , \
166
- $$(TLIB$(3 ) _T_$(1 ) _H_$(2 ) ) /stamp.$$(crate ) )
171
+ $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /stamp.$$(crate ) ) \
172
+ $$(if $$(findstring $(2 ) ,$$(CFG_HOST ) ) , \
173
+ $$(foreach crate,$$(HOST_CRATES ) , \
174
+ $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /stamp.$$(crate ) ) ,)
167
175
# Only install if this host and target combo is being prepared
168
- $$(if $$(findstring $(2 ) , $$(PREPARE_HOST ) ) ,\
169
- $$(if $$(findstring $(1 ) , $$(PREPARE_TARGETS ) ) ,\
170
- $$(if $$(findstring $(3 ) , $$(PREPARE_STAGE ) ) ,\
176
+ $$(if $$(findstring $(1 ) , $$(PREPARE_STAGE ) ) ,\
177
+ $$(if $$(findstring $(2 ) , $$(PREPARE_TARGETS ) ) ,\
178
+ $$(if $$(findstring $(3 ) , $$(PREPARE_HOST ) ) ,\
171
179
$$(call PREPARE_DIR,$$(PREPARE_WORKING_DEST_LIB_DIR ) ) \
172
180
$$(foreach crate,$$(TARGET_CRATES ) ,\
173
- $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(1 ) ,$$(crate ) ) ) ) \
174
- $$(foreach crate,$$(TARGET_CRATES ) ,\
181
+ $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2 ) ,$$(crate ) ) ) \
175
182
$$(call PREPARE_LIB,$$(call CFG_RLIB_GLOB,$$(crate ) ) ) ) \
176
- $$(call PREPARE_LIB,libmorestack.a)
183
+ $$(if $$(findstring $(2 ) ,$$(CFG_HOST ) ) ,\
184
+ $$(foreach crate,$$(HOST_CRATES ) ,\
185
+ $$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2 ) ,$$(crate ) ) ) \
186
+ $$(call PREPARE_LIB,$$(call CFG_RLIB_GLOB,$$(crate ) ) ) ) ,) \
187
+ $$(call PREPARE_LIB,libmorestack.a) \
177
188
$$(call PREPARE_LIB,libcompiler-rt.a) ,) ,) ,)
178
189
endef
179
190
180
191
$(foreach host,$(CFG_HOST),\
181
192
$(foreach target,$(CFG_TARGET), \
182
193
$(foreach stage,$(PREPARE_STAGES),\
183
- $(eval $(call DEF_PREPARE_TARGET_N,$(target ),$(host ),$(stage ))))))
194
+ $(eval $(call DEF_PREPARE_TARGET_N,$(stage ),$(target ),$(host ))))))
0 commit comments