Skip to content

Commit a4ba088

Browse files
committed
build: Add USE_SNAPSHOT_STDLIB. Set to 1
1 parent 1523298 commit a4ba088

File tree

1 file changed

+36
-7
lines changed

1 file changed

+36
-7
lines changed

mk/target.mk

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# (resp. corelib) from the working directory.
1111
USE_SNAPSHOT_RUNTIME=1
1212
USE_SNAPSHOT_CORELIB=1
13+
USE_SNAPSHOT_STDLIB=1
1314

1415
define TARGET_STAGE_N
1516

@@ -18,13 +19,6 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
1819
@$$(call E, cp: $$@)
1920
$$(Q)cp $$< $$@
2021

21-
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
22-
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
23-
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
24-
$$(TSREQ$(1)_T_$(2)_H_$(3))
25-
@$$(call E, compile_and_link: $$@)
26-
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
27-
2822
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM): \
2923
rustllvm/$(2)/$$(CFG_RUSTLLVM)
3024
@$$(call E, cp: $$@)
@@ -116,6 +110,30 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB): \
116110

117111
endef
118112

113+
define TARGET_STDLIB_FROM_SNAPSHOT
114+
115+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
116+
$$(HLIB$(1)_H_$(3))/$$(CFG_STDLIB) \
117+
$$(STDLIB_INPUTS) \
118+
$$(TSREQ$(1)_T_$(2)_H_$(3))
119+
@$$(call E, cp: $$@)
120+
$$(Q)cp $$< $$@
121+
$$(Q)cp $$(HLIB$(1)_H_$(3))/$$(STDLIB_GLOB) \
122+
$$(TLIB$(1)_T_$(2)_H_$(3))
123+
124+
endef
125+
126+
define TARGET_STDLIB_FROM_WD
127+
128+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
129+
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
130+
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
131+
$$(TSREQ$(1)_T_$(2)_H_$(3))
132+
@$$(call E, compile_and_link: $$@)
133+
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
134+
135+
endef
136+
119137
# In principle, each host can build each target:
120138
$(foreach source,$(CFG_TARGET_TRIPLES), \
121139
$(foreach target,$(CFG_TARGET_TRIPLES), \
@@ -142,6 +160,14 @@ else
142160
$(eval $(call TARGET_CORELIB_FROM_WD,0,$(src),$(src))))
143161
endif
144162

163+
ifeq ($(USE_SNAPSHOT_STDLIB),1)
164+
$(foreach src,$(CFG_HOST_TRIPLE),\
165+
$(eval $(call TARGET_STDLIB_FROM_SNAPSHOT,0,$(src),$(src))))
166+
else
167+
$(foreach src,$(CFG_HOST_TRIPLE),\
168+
$(eval $(call TARGET_STDLIB_FROM_WD,0,$(src),$(src))))
169+
endif
170+
145171
# Non-host triples build the stage0 runtime from the working directory
146172
$(foreach source,$(CFG_TARGET_TRIPLES), \
147173
$(foreach target,$(NON_HOST_TRIPLES), \
@@ -158,5 +184,8 @@ $(foreach source,$(CFG_TARGET_TRIPLES), \
158184
$(eval $(call TARGET_CORELIB_FROM_WD,1,$(target),$(source))) \
159185
$(eval $(call TARGET_CORELIB_FROM_WD,2,$(target),$(source))) \
160186
$(eval $(call TARGET_CORELIB_FROM_WD,3,$(target),$(source))) \
187+
$(eval $(call TARGET_STDLIB_FROM_WD,1,$(target),$(source))) \
188+
$(eval $(call TARGET_STDLIB_FROM_WD,2,$(target),$(source))) \
189+
$(eval $(call TARGET_STDLIB_FROM_WD,3,$(target),$(source))) \
161190
))
162191

0 commit comments

Comments
 (0)