Add CFG_USE_SNAP_LIBS_FOR_STAGE1 hack to makefiles

This commit is contained in:
Marijn Haverbeke 2011-08-25 09:49:44 +02:00
parent 4eb86d4978
commit 9db4d9c6fd
2 changed files with 30 additions and 3 deletions

View File

@ -57,6 +57,13 @@ else
CFG_STDLIB_DEFAULT = $(2)/$(CFG_STDLIB)
endif
# Uncomment this to temporarily use the snapshot's runtime for stage1.
# This is useful when making incompatible changes to the parts of the
# runtime used directly by the compiler -- the binaries built by the
# snapshot won't know about the changes yet. Don't leave this on. Turn
# it on, shapshot, and turn it off again.
# CFG_USE_SNAP_LIBS_FOR_STAGE1 = 1
# version-string calculation
CFG_GIT_DIR := $(CFG_SRC_DIR).git
CFG_VERSION = prerelease

View File

@ -8,6 +8,15 @@
# new rustrt in stage0/lib/.
define LIBGEN
ifdef CFG_USE_SNAP_LIBS_FOR_STAGE1
ifeq ($(2), 0)
RUNTIME_SOURCE = stage0/$(CFG_RUNTIME)
stage$(2)/lib/$$(CFG_STDLIB): stage0/$$(CFG_STDLIB)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
else
RUNTIME_SOURCE = rt/$(CFG_RUNTIME)
stage$(2)/lib/$$(CFG_STDLIB): $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
stage$(2)/rustc$$(X) \
stage$(2)/$$(CFG_RUNTIME) \
@ -16,6 +25,8 @@ stage$(2)/lib/$$(CFG_STDLIB): $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
$$(SREQ$(1))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(2)) --lib -o $$@ $$<
endif
endif
stage$(2)/lib/libstd.rlib: $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
stage$(2)/rustc$$(X) \
@ -26,7 +37,7 @@ stage$(2)/lib/libstd.rlib: $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
@$$(call E, compile_and_link: $$@)
$$(STAGE$(2)) --lib --static -o $$@ $$<
stage$(2)/lib/$$(CFG_RUNTIME): rt/$$(CFG_RUNTIME)
stage$(2)/lib/$$(CFG_RUNTIME): $$(RUNTIME_SOURCE)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
@ -58,11 +69,20 @@ stage$(2)/rustc$$(X): $$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) -L stage$(2) -o $$@ $$<
stage$(2)/$$(CFG_RUNTIME): rt/$$(CFG_RUNTIME)
RUNTIME_SOURCE = rt/$(CFG_RUNTIME)
STDLIB_SOURCE = stage$(1)/lib/$$(CFG_STDLIB)
ifdef CFG_USE_SNAP_LIBS_FOR_STAGE1
ifeq ($(2), 1)
RUNTIME_SOURCE = stage0/$(CFG_RUNTIME)
STDLIB_SOURCE = stage0/$(CFG_STDLIB)
endif
endif
stage$(2)/$$(CFG_RUNTIME): $$(RUNTIME_SOURCE)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
stage$(2)/$$(CFG_STDLIB): stage$(1)/lib/$$(CFG_STDLIB)
stage$(2)/$$(CFG_STDLIB): $$(STDLIB_SOURCE)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@