diff --git a/Makefile.in b/Makefile.in index a52df01ab3751..61d1bb7eeda59 100644 --- a/Makefile.in +++ b/Makefile.in @@ -226,8 +226,8 @@ config.mk: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt ###################################################################### include $(CFG_SRC_DIR)/mk/intrinsics.mk -include $(CFG_SRC_DIR)/mk/stage0.mk include $(CFG_SRC_DIR)/mk/stageN.mk +include $(CFG_SRC_DIR)/mk/stage0.mk include $(CFG_SRC_DIR)/mk/rt.mk include $(CFG_SRC_DIR)/mk/rustllvm.mk include $(CFG_SRC_DIR)/mk/autodep.mk @@ -269,4 +269,4 @@ endif ifneq ($(findstring clean,$(MAKECMDGOALS)),) CFG_INFO := $(info cfg: including clean rules) include $(CFG_SRC_DIR)/mk/clean.mk -endif \ No newline at end of file +endif diff --git a/mk/stage0.mk b/mk/stage0.mk index 0adb220544f13..c125e4a9faf10 100644 --- a/mk/stage0.mk +++ b/mk/stage0.mk @@ -1,18 +1,21 @@ +# FIXME: temporary hack: stdlib comes in the lib/ directory, but we want it in +# the base directory, so we move it out. stage0/rustc$(X): $(S)src/snapshots.txt $(S)src/etc/get-snapshot.py $(MKFILES) @$(call E, fetch: $@) $(Q)$(S)src/etc/get-snapshot.py + $(Q)mv stage0/lib/$(CFG_STDLIB) stage0/$(CFG_STDLIB) $(Q)touch $@ # Host libs will be made in the process of making rustc above. -# FIXME: temporary hack: the first two are currently carried in -# lib/ directory only, so we copy them out. +# FIXME: temporary hack: the runtime is currently carried in +# lib/ directory only, so we copy it out. stage0/$(CFG_RUNTIME): stage0/lib/$(CFG_RUNTIME) $(Q)cp $< $@ -stage0/$(CFG_STDLIB): stage0/lib/$(CFG_STDLIB) - $(Q)cp $< $@ +stage0/$(CFG_STDLIB): stage0/rustc$(X) + $(Q)touch $@ stage0/$(CFG_RUSTLLVM): stage0/rustc$(X) $(Q)touch $@ @@ -28,11 +31,12 @@ stage0/lib/glue.o: stage0/rustc$(X) stage0/lib/main.o: rt/main.o $(Q)cp $< $@ + stage0/lib/$(CFG_RUNTIME): stage0/rustc$(X) $(Q)touch $@ -stage0/lib/$(CFG_STDLIB): stage0/rustc$(X) - $(Q)touch $@ +# Instantiate template (in stageN.mk) for building +# stage0/lib/$(CFG_STDLIB) and stage0/lib/libstd.rlib. +SREQpre = stage0/lib/main.o $(MKFILES) +$(eval $(call STDLIBGEN,pre,0)) -stage0/lib/libstd.rlib: stage0/rustc$(X) - $(Q)touch $@ diff --git a/mk/stageN.mk b/mk/stageN.mk index 6390ac79cc072..52c5893b0264a 100644 --- a/mk/stageN.mk +++ b/mk/stageN.mk @@ -2,6 +2,29 @@ # # The easiest way to read this template is to assume we're building stage2 # using stage1, and mentally gloss $(1) as 1, $(2) as 2. +# +# STDLIBGEN is pulled out seperately because we need to specially invoke +# it to build stage0/lib/libstd using stage0/rustc. + +define STDLIBGEN +stage$(2)/lib/$$(CFG_STDLIB): $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \ + stage$(2)/rustc$$(X) \ + stage$(2)/$$(CFG_RUNTIME) \ + stage$(2)/$$(CFG_RUSTLLVM) \ + stage$(2)/lib/glue.o \ + $$(SREQ$(1)) + @$$(call E, compile_and_link: $$@) + $$(STAGE$(2)) --lib -o $$@ $$< + +stage$(2)/lib/libstd.rlib: $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \ + stage$(2)/rustc$$(X) \ + stage$(2)/$$(CFG_RUNTIME) \ + stage$(2)/$$(CFG_RUSTLLVM) \ + stage$(2)/lib/glue.o \ + $$(SREQ$(1)) + @$$(call E, compile_and_link: $$@) + $$(STAGE$(2)) --lib --static -o $$@ $$< +endef define STAGEN @@ -56,24 +79,7 @@ stage$(2)/lib/glue.o: stage$(2)/rustc$$(X) \ @$$(call E, generate: $$@) $$(STAGE$(2)) -c -o $$@ --glue -stage$(2)/lib/$$(CFG_STDLIB): $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \ - stage$(2)/rustc$$(X) \ - stage$(2)/$$(CFG_RUNTIME) \ - stage$(2)/$$(CFG_RUSTLLVM) \ - stage$(2)/lib/glue.o \ - $$(SREQ$(1)) - @$$(call E, compile_and_link: $$@) - $$(STAGE$(2)) --lib -o $$@ $$< - -stage$(2)/lib/libstd.rlib: $$(STDLIB_CRATE) $$(STDLIB_INPUTS) \ - stage$(2)/rustc$$(X) \ - stage$(2)/$$(CFG_RUNTIME) \ - stage$(2)/$$(CFG_RUSTLLVM) \ - stage$(2)/lib/glue.o \ - $$(SREQ$(1)) - @$$(call E, compile_and_link: $$@) - $$(STAGE$(2)) --lib --static -o $$@ $$< - +$(eval $(call STDLIBGEN,$(1),$(2))) stage$(2)/lib/main.o: rt/main.o @$$(call E, cp: $$@) diff --git a/src/etc/snapshot.py b/src/etc/snapshot.py index 393af1d3d1cb6..54d25b7f9abaf 100644 --- a/src/etc/snapshot.py +++ b/src/etc/snapshot.py @@ -16,11 +16,11 @@ def scrub(b): download_unpack_base = os.path.join(download_dir_base, "unpack") snapshot_files = { - "linux": ["rustc", "lib/glue.o", "lib/libstd.so", "lib/libstd.rlib", + "linux": ["rustc", "lib/glue.o", "lib/libstd.so", "lib/librustrt.so", "librustllvm.so", "lib/intrinsics.bc"], - "macos": ["rustc", "lib/glue.o", "lib/libstd.dylib", "lib/libstd.rlib", + "macos": ["rustc", "lib/glue.o", "lib/libstd.dylib", "lib/librustrt.dylib", "librustllvm.dylib", "lib/intrinsics.bc"], - "winnt": ["rustc.exe", "lib/glue.o", "lib/std.dll", "lib/libstd.rlib", + "winnt": ["rustc.exe", "lib/glue.o", "lib/std.dll", "lib/rustrt.dll", "rustllvm.dll", "lib/intrinsics.bc"] }