From 40624e35d74e5d200ae689c02753f0d60924e668 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Sun, 1 May 2011 20:18:52 +0000 Subject: Start splitting up Makefile.in --- mk/stage3.mk | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 mk/stage3.mk (limited to 'mk/stage3.mk') diff --git a/mk/stage3.mk b/mk/stage3.mk new file mode 100644 index 00000000..8f56637e --- /dev/null +++ b/mk/stage3.mk @@ -0,0 +1,36 @@ +stage3/std.o: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage2/rustc$(X) $(MKFILES) + @$(call E, compile: $@) + $(STAGE2) -c --shared -o $@ $< + +stage3/$(CFG_STDLIB): stage3/std.o stage3/glue.o + @$(call E, link: $@) + $(Q)gcc $(CFG_GCC_CFLAGS) stage3/glue.o $(CFG_GCC_LINK_FLAGS) -o $@ $< \ + -Lstage3 -Lrt -lrustrt + +stage3/rustc.o: $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ2) + @$(call E, compile: $@) + $(STAGE2) -c -o $@ $< + +stage3/glue.o: stage2/rustc$(X) stage2/$(CFG_STDLIB) \ + rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME) + @$(call E, generate: $@) + $(STAGE2) -c -o $@ --glue + +# Due to make not wanting to run the same implicit rules twice on the same +# rule tree (implicit-rule recursion prevention, see "Chains of Implicit +# Rules" in GNU Make manual) we have to re-state the %.o and %.s patterns here +# for different directories, to handle cases where (say) a test relies on a +# compiler that relies on a .o file. + +stage3/%.o: stage3/%.s + @$(call E, assemble [gcc]: $@) + $(Q)gcc $(CFG_GCC_CFLAGS) -o $@ -c $< + +stage3/%$(X): stage3/%.o $(SREQ2) + @$(call E, link [gcc]: $@) + $(Q)gcc $(CFG_GCC_CFLAGS) stage3/glue.o -o $@ $< \ + -Lstage3 -Lrustllvm -Lrt -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) $@ -- cgit v1.2.3