14
14
# $(2) is the target triple
15
15
# $(3) is the host triple
16
16
17
- # If you are making non-backwards compatible changes to the runtime
18
- # (resp. corelib), set this flag to 1. It will cause stage1 to use
19
- # the snapshot runtime (resp. corelib) rather than the runtime
20
- # (resp. corelib) from the working directory.
21
- USE_SNAPSHOT_RUNTIME =0
22
- USE_SNAPSHOT_CORELIB =0
23
- USE_SNAPSHOT_STDLIB =0
24
17
25
18
define TARGET_STAGE_N
26
19
@@ -59,86 +52,17 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX): \
59
52
@$$(call E, compile_and_link: $$@ )
60
53
$$(STAGE$(1 ) _T_$(2 ) _H_$(3 ) ) $(BORROWCK ) -o $$@ $$< && touch $$@
61
54
62
- endef
63
-
64
- # The stage0 (snapshot) compiler produces binaries that expect the
65
- # snapshot runtime. Normally the working directory runtime and
66
- # snapshot runtime are compatible, so this is no problem. But
67
- # sometimes we want to make non-backwards-compatible changes. In
68
- # those cases, the stage1 compiler and libraries (which are produced
69
- # by stage0) should use the runtime from the snapshot. The stage2
70
- # compiler and libraries (which are produced by stage1) will be the
71
- # first that are expecting to run against the runtime as defined in
72
- # the working directory.
73
- #
74
- # The catch is that you may not add new functions to the runtime
75
- # in this case!
76
- #
77
- # Arguments are the same as for TARGET_BASE_STAGE_N
78
- define TARGET_RT_FROM_SNAPSHOT
79
-
80
- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$$(CFG_RUNTIME ) : \
81
- $$(HLIB$(1 ) _H_$(3 ) ) /$$(CFG_RUNTIME )
82
- @$$(call E, cp: $$@ )
83
- $$(Q ) cp $$< $$@
84
-
85
- endef
86
-
87
- # This rule copies from the runtime for the working directory. It
88
- # applies to targets produced by stage1 or later. See comment on
89
- # previous rule.
90
- #
91
- # Arguments are the same as for TARGET_BASE_STAGE_N
92
- define TARGET_RT_FROM_WD
93
-
94
55
$$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$$(CFG_RUNTIME ) : \
95
56
rt/$(2 ) /$$(CFG_RUNTIME )
96
57
@$$(call E, cp: $$@ )
97
58
$$(Q ) cp $$< $$@
98
59
99
- endef
100
-
101
- # As above, but builds the corelib either by taking it out of the
102
- # snapshot or from the working directory.
103
-
104
- define TARGET_CORELIB_FROM_SNAPSHOT
105
-
106
- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$$(CFG_CORELIB ) : \
107
- $$(HLIB$(1 ) _H_$(3 ) ) /$$(CFG_CORELIB ) \
108
- $$(CORELIB_INPUTS ) \
109
- $$(TSREQ$(1 ) _T_$(2 ) _H_$(3 ) )
110
- @$$(call E, cp: $$@ )
111
- $$(Q ) cp $$< $$@
112
- $$(Q ) cp $$(HLIB$(1 ) _H_$(3 ) ) /$$(CORELIB_GLOB ) \
113
- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) )
114
-
115
- endef
116
-
117
- define TARGET_CORELIB_FROM_WD
118
-
119
60
$$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$$(CFG_CORELIB ) : \
120
61
$$(CORELIB_CRATE ) $$(CORELIB_INPUTS ) \
121
62
$$(TSREQ$(1 ) _T_$(2 ) _H_$(3 ) )
122
63
@$$(call E, compile_and_link: $$@ )
123
64
$$(STAGE$(1 ) _T_$(2 ) _H_$(3 ) ) -o $$@ $$< && touch $$@
124
65
125
- endef
126
-
127
- define TARGET_STDLIB_FROM_SNAPSHOT
128
-
129
- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$$(CFG_STDLIB ) : \
130
- $$(HLIB$(1 ) _H_$(3 ) ) /$$(CFG_STDLIB ) \
131
- $$(STDLIB_INPUTS ) \
132
- $$(TSREQ$(1 ) _T_$(2 ) _H_$(3 ) )
133
- @$$(call E, cp: $$@ )
134
- $$(Q ) cp $$< $$@
135
- $$(Q ) cp $$(HLIB$(1 ) _H_$(3 ) ) /$$(STDLIB_GLOB ) \
136
- $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) )
137
-
138
- endef
139
-
140
- define TARGET_STDLIB_FROM_WD
141
-
142
66
$$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$$(CFG_STDLIB ) : \
143
67
$$(STDLIB_CRATE ) $$(STDLIB_INPUTS ) \
144
68
$$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) /$$(CFG_CORELIB ) \
@@ -155,52 +79,3 @@ $(foreach source,$(CFG_TARGET_TRIPLES), \
155
79
$(eval $(call TARGET_STAGE_N,1,$(target),$(source))) \
156
80
$(eval $(call TARGET_STAGE_N,2,$(target),$(source))) \
157
81
$(eval $(call TARGET_STAGE_N,3,$(target),$(source)))))
158
-
159
- # Host triple either uses the snapshot runtime or runtime from
160
- # working directory, depending on the USE_SNAPSHOT_RUNTIME var.
161
- ifeq ($(USE_SNAPSHOT_RUNTIME ) ,1)
162
- $(foreach src,$(CFG_HOST_TRIPLE),\
163
- $(eval $(call TARGET_RT_FROM_SNAPSHOT,0,$(src),$(src))))
164
- else
165
- $(foreach src,$(CFG_HOST_TRIPLE),\
166
- $(eval $(call TARGET_RT_FROM_WD,0,$(src),$(src))))
167
- endif
168
-
169
- ifeq ($(USE_SNAPSHOT_CORELIB ) ,1)
170
- $(foreach src,$(CFG_HOST_TRIPLE),\
171
- $(eval $(call TARGET_CORELIB_FROM_SNAPSHOT,0,$(src),$(src))))
172
- else
173
- $(foreach src,$(CFG_HOST_TRIPLE),\
174
- $(eval $(call TARGET_CORELIB_FROM_WD,0,$(src),$(src))))
175
- endif
176
-
177
- ifeq ($(USE_SNAPSHOT_STDLIB ) ,1)
178
- $(foreach src,$(CFG_HOST_TRIPLE),\
179
- $(eval $(call TARGET_STDLIB_FROM_SNAPSHOT,0,$(src),$(src))))
180
- else
181
- $(foreach src,$(CFG_HOST_TRIPLE),\
182
- $(eval $(call TARGET_STDLIB_FROM_WD,0,$(src),$(src))))
183
- endif
184
-
185
- # Non-host triples build the stage0 runtime from the working directory
186
- $(foreach source,$(CFG_TARGET_TRIPLES), \
187
- $(foreach target,$(NON_HOST_TRIPLES), \
188
- $(eval $(call TARGET_RT_FROM_WD,0,$(target),$(source))) \
189
- $(eval $(call TARGET_CORELIB_FROM_WD,0,$(target),$(source))) \
190
- $(eval $(call TARGET_STDLIB_FROM_WD,0,$(target),$(source))) \
191
- ))
192
-
193
- # After stage0, always build the stage0 runtime from the working directory
194
- $(foreach source,$(CFG_TARGET_TRIPLES), \
195
- $(foreach target,$(CFG_TARGET_TRIPLES), \
196
- $(eval $(call TARGET_RT_FROM_WD,1,$(target),$(source))) \
197
- $(eval $(call TARGET_RT_FROM_WD,2,$(target),$(source))) \
198
- $(eval $(call TARGET_RT_FROM_WD,3,$(target),$(source))) \
199
- $(eval $(call TARGET_CORELIB_FROM_WD,1,$(target),$(source))) \
200
- $(eval $(call TARGET_CORELIB_FROM_WD,2,$(target),$(source))) \
201
- $(eval $(call TARGET_CORELIB_FROM_WD,3,$(target),$(source))) \
202
- $(eval $(call TARGET_STDLIB_FROM_WD,1,$(target),$(source))) \
203
- $(eval $(call TARGET_STDLIB_FROM_WD,2,$(target),$(source))) \
204
- $(eval $(call TARGET_STDLIB_FROM_WD,3,$(target),$(source))) \
205
- ))
206
-
0 commit comments