Switch to using the rustc driver in the bootstrap process.

This commit is contained in:
Rafael Ávila de Espíndola 2011-06-15 19:40:22 -04:00
parent 02c0501a61
commit 32895ad990
5 changed files with 33 additions and 87 deletions

View File

@ -44,7 +44,6 @@ endif
CFG_RUNTIME :=$(call CFG_LIB_NAME,rustrt)
CFG_RUSTLLVM :=$(call CFG_LIB_NAME,rustllvm)
CFG_STDLIB :=$(call CFG_LIB_NAME,std)
CFG_RUSTCLIB :=$(call CFG_LIB_NAME,rustc)
# version-string calculation
CFG_GIT_DIR := $(CFG_SRC_DIR).git
@ -107,12 +106,15 @@ VPATH := $(S)doc $(S)src
# Compilers we build, we now know how to run.
STAGE0 := $(Q)$(call CFG_RUN_TARG,stage0,\
stage0/rustc$(X) $(CFG_RUSTC_FLAGS) -L stage1)
STAGE1 := $(Q)$(call CFG_RUN_TARG,stage1, \
stage0/rustc$(X) $(CFG_RUSTC_FLAGS) -L stage0)
STAGE1 := $(Q)$(call CFG_RUN_TARG,stage0, \
$(CFG_VALGRIND_COMPILE) stage1/rustc$(X) \
$(CFG_RUSTC_FLAGS) -L stage2)
STAGE2 := $(Q)$(call CFG_RUN_TARG,stage2, \
$(CFG_RUSTC_FLAGS) -L stage1)
STAGE2 := $(Q)$(call CFG_RUN_TARG,stage1, \
$(CFG_VALGRIND_COMPILE) stage2/rustc$(X) \
$(CFG_RUSTC_FLAGS) -L stage2)
STAGE3 := $(Q)$(call CFG_RUN_TARG,stage2, \
$(CFG_VALGRIND_COMPILE) stage3/rustc$(X) \
$(CFG_RUSTC_FLAGS) -L stage3)
# "Source" files we generate in builddir along the way.
@ -146,9 +148,9 @@ COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/comp/, \
######################################################################
LREQ := rt/$(CFG_RUNTIME) rustllvm/$(CFG_RUSTLLVM)
SREQ0 := stage0/rustc$(X) $(LREQ) rt/main.o stage1/glue.o stage1/$(CFG_STDLIB)
SREQ1 := stage1/rustc$(X) $(LREQ) rt/main.o stage2/glue.o stage2/$(CFG_STDLIB)
SREQ2 := stage2/rustc$(X) $(LREQ) rt/main.o stage3/glue.o stage3/$(CFG_STDLIB)
SREQ0 := stage0/rustc$(X) $(LREQ) rt/main.o stage0/glue.o stage0/$(CFG_STDLIB)
SREQ1 := stage1/rustc$(X) $(LREQ) rt/main.o stage1/glue.o stage1/$(CFG_STDLIB)
SREQ2 := stage2/rustc$(X) $(LREQ) rt/main.o stage2/glue.o stage2/$(CFG_STDLIB)
######################################################################

View File

@ -5,8 +5,7 @@
FUZZER_CRATE := $(S)src/fuzzer/fuzzer.rc
FUZZER_INPUTS := $(wildcard $(addprefix $(S)src/fuzzer/, *.rs))
stage2/fuzzer.o: $(FUZZER_CRATE) $(FUZZER_INPUTS) $(SREQ1) \
stage2/$(CFG_RUSTCLIB)
stage2/fuzzer.o: $(FUZZER_CRATE) $(FUZZER_INPUTS) $(SREQ1)
@$(call E, compile: $@)
$(STAGE1) -c -o $@ $<

View File

@ -1,31 +1,13 @@
stage1/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) \
stage0/rustc$(X) stage0/$(CFG_STDLIB) stage0/intrinsics.bc \
stage1/$(CFG_STDLIB): $(STDLIB_CRATE) $(STDLIB_INPUTS) \
stage1/rustc$(X) stage0/$(CFG_STDLIB) stage1/intrinsics.bc \
$(LREQ) $(MKFILES)
@$(call E, compile: $@)
$(STAGE0) -c --shared -o $@ $<
@$(call E, compile_and_link: $@)
$(STAGE1) --shared -o $@ $<
stage1/$(CFG_STDLIB): stage1/std.o stage1/glue.o
@$(call E, link: $@)
$(Q)gcc $(CFG_GCCISH_CFLAGS) stage1/glue.o $(CFG_GCCISH_LINK_FLAGS) \
-o $@ $< -Lstage1 -Lrt -lrustrt
stage1/librustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ0)
@$(call E, compile: $@)
$(STAGE0) -c --shared -o $@ $<
stage1/$(CFG_RUSTCLIB): stage1/librustc.o stage1/glue.o
@$(call E, link: $@)
$(Q)gcc $(CFG_GCCISH_CFLAGS) stage1/glue.o $(CFG_GCCISH_LINK_FLAGS) \
-o $@ $< -Lstage1 -Lrustllvm -Lrt -lrustrt -lrustllvm -lstd
stage1/rustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ0)
@$(call E, compile: $@)
$(STAGE0) -c -o $@ $<
stage1/glue.o: stage0/rustc$(X) stage0/$(CFG_STDLIB) stage0/intrinsics.bc \
stage1/glue.o: stage1/rustc$(X) stage0/$(CFG_STDLIB) stage0/intrinsics.bc \
$(LREQ) $(MKFILES)
@$(call E, generate: $@)
$(STAGE0) -c -o $@ --glue
$(STAGE1) -c -o $@ --glue
stage1/intrinsics.bc: $(INTRINSICS_BC)
@$(call E, cp: $@)
@ -41,11 +23,6 @@ stage1/%.o: stage1/%.s
@$(call E, assemble [gcc]: $@)
$(Q)gcc $(CFG_GCCISH_CFLAGS) -o $@ -c $<
stage1/%$(X): stage1/%.o $(SREQ0)
@$(call E, link [gcc]: $@)
$(Q)gcc $(CFG_GCCISH_CFLAGS) stage1/glue.o -o $@ $< \
-Lstage1 -Lrustllvm -Lrt rt/main.o -lrustrt -lrustllvm -lstd -lm
@# dsymutil sometimes fails or prints a warning, but the
@# program still runs. Since it simplifies debugging other
@# programs, I\'ll live with the noise.
-$(Q)$(CFG_DSYMUTIL) $@
stage1/%$(X): $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ0)
@$(call E, compile_and_link: $@)
$(STAGE0) -o $@ $<

View File

@ -1,31 +1,13 @@
stage2/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) \
stage1/rustc$(X) stage1/$(CFG_STDLIB) stage1/intrinsics.bc \
stage2/$(CFG_STDLIB): $(STDLIB_CRATE) $(STDLIB_INPUTS) \
stage2/rustc$(X) stage1/$(CFG_STDLIB) stage2/intrinsics.bc \
$(LREQ) $(MKFILES)
@$(call E, compile: $@)
$(STAGE1) -c --shared -o $@ $<
@$(call E, compile_and_link: $@)
$(STAGE2) --shared -o $@ $<
stage2/$(CFG_STDLIB): stage2/std.o stage2/glue.o
@$(call E, link: $@)
$(Q)gcc $(CFG_GCCISH_CFLAGS) stage2/glue.o $(CFG_GCCISH_LINK_FLAGS) -o \
$@ $< -Lstage2 -Lrt -lrustrt
stage2/librustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ1)
@$(call E, compile: $@)
$(STAGE1) -c --shared -o $@ $<
stage2/$(CFG_RUSTCLIB): stage2/librustc.o stage2/glue.o
@$(call E, link: $@)
$(Q)gcc $(CFG_GCCISH_CFLAGS) stage2/glue.o $(CFG_GCCISH_LINK_FLAGS) \
-o $@ $< -Lstage2 -Lrustllvm -Lrt -lrustrt -lrustllvm -lstd
stage2/rustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ1)
@$(call E, compile: $@)
$(STAGE1) -c -o $@ $<
stage2/glue.o: stage1/rustc$(X) stage1/$(CFG_STDLIB) stage1/intrinsics.bc \
stage2/glue.o: stage2/rustc$(X) stage1/$(CFG_STDLIB) stage1/intrinsics.bc \
rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
@$(call E, generate: $@)
$(STAGE1) -c -o $@ --glue
$(STAGE2) -c -o $@ --glue
stage2/intrinsics.bc: $(INTRINSICS_BC)
@$(call E, cp: $@)
@ -41,11 +23,6 @@ stage2/%.o: stage2/%.s
@$(call E, assemble [gcc]: $@)
$(Q)gcc $(CFG_GCCISH_CFLAGS) -o $@ -c $<
stage2/%$(X): stage2/%.o $(SREQ1)
@$(call E, link [gcc]: $@)
$(Q)gcc $(CFG_GCCISH_CFLAGS) stage2/glue.o -o $@ $< \
-Lstage2 -Lrustllvm -Lrt rt/main.o -lrustrt -lrustllvm -lstd -lm
@# dsymutil sometimes fails or prints a warning, but the
@# program still runs. Since it simplifies debugging other
@# programs, I\'ll live with the noise.
-$(Q)$(CFG_DSYMUTIL) $@
stage2/%$(X): $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ1)
@$(call E, compile_and_link: $@)
$(STAGE1) -o $@ $<

View File

@ -1,22 +1,13 @@
stage3/$(CFG_STDLIB): $(STDLIB_CRATE) $(STDLIB_INPUTS) \
stage2/rustc$(X) stage2/$(CFG_STDLIB) stage2/intrinsics.bc \
stage3/rustc$(X) stage2/$(CFG_STDLIB) stage3/intrinsics.bc \
$(LREQ) $(MKFILES)
@$(call E, compile_and_link: $@)
$(STAGE2) --shared -o $@ $<
$(STAGE3) --shared -o $@ $<
stage3/librustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ2)
@$(call E, compile: $@)
$(STAGE2) -c --shared -o $@ $<
stage3/$(CFG_RUSTCLIB): stage2/librustc.o stage2/glue.o
@$(call E, link: $@)
$(Q)gcc $(CFG_GCCISH_CFLAGS) stage2/glue.o $(CFG_GCCISH_LINK_FLAGS) \
-o $@ $< -Lstage2 -Lrustllvm -Lrt -lrustrt -lrustllvm -lstd
stage3/glue.o: stage2/rustc$(X) stage2/$(CFG_STDLIB) stage2/intrinsics.bc \
stage3/glue.o: stage3/rustc$(X) stage2/$(CFG_STDLIB) stage3/intrinsics.bc \
rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
@$(call E, generate: $@)
$(STAGE2) -c -o $@ --glue
$(STAGE3) -c -o $@ --glue
stage3/intrinsics.bc: $(INTRINSICS_BC)
@$(call E, cp: $@)