From 8371beb5905158377689b9efb5cdb4a07ae17ada Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 22 Nov 2011 13:04:52 -0800 Subject: [PATCH] makefiles now seem to be working, rustc is not --- Makefile.in | 4 +++- mk/stage0.mk | 32 ++++++++++++++++++++++++++++++++ mk/target.mk | 13 +++++++------ 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Makefile.in b/Makefile.in index bca52e09885b1..0e5670db7fa9c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -59,11 +59,14 @@ GEN_MKFILES := $(wildcard $(CFG_SRC_DIR)/mk/libuv/*/*/*) \ MKFILES := $(OUR_MKFILES) $(3RDPARTY_MKFILES) $(GEN_MKFILES) +NON_HOST_TRIPLES = $(filter-out $(CFG_HOST_TRIPLE),$(CFG_TARGET_TRIPLES)) + ifneq ($(MAKE_RESTARTS),) CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS)) endif CFG_INFO := $(info cfg: shell host triple $(CFG_HOST_TRIPLE)) +CFG_INFO := $(info cfg: non host triples $(NON_HOST_TRIPLES)) ifdef CFG_DISABLE_OPTIMIZE $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE)) @@ -220,7 +223,6 @@ endef $(foreach target,$(CFG_TARGET_TRIPLES), \ $(eval $(call DEF_LLVM_VARS,$(target)))) - ###################################################################### # Exports for sub-utilities ###################################################################### diff --git a/mk/stage0.mk b/mk/stage0.mk index b1a0f1eb3a095..39df29577c5a6 100644 --- a/mk/stage0.mk +++ b/mk/stage0.mk @@ -20,3 +20,35 @@ $(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_STDLIB): \ $(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUSTLLVM): \ $(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X) $(Q)touch $@ + +# For other targets, let the host build the target: + +define BOOTSTRAP_STAGE0 + # $(1) target to bootstrap + # $(2) stage to bootstrap from + # $(3) target to bootstrap from + +$$(HBIN0_H_$(1))/rustc$$(X): \ + $$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X) + @$$(call E, cp: $$@) + $$(Q)cp $$< $$@ + +$$(HLIB0_H_$(1))/$$(CFG_RUNTIME): \ + $$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X) + @$$(call E, cp: $$@) + $$(Q)cp $$< $$@ + +$$(HLIB0_H_$(1))/$(CFG_STDLIB): \ + $$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X) + @$$(call E, cp: $$@) + $$(Q)cp $$< $$@ + +$$(HLIB0_H_$(1))/$(CFG_RUSTLLVM): \ + $$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X) + @$$(call E, cp: $$@) + $$(Q)cp $$< $$@ + +endef + +$(foreach t,$(NON_HOST_TRIPLES), \ + $(eval $(call BOOTSTRAP_STAGE0,$(t),2,$(CFG_HOST_TRIPLE)))) diff --git a/mk/target.mk b/mk/target.mk index 07c9fb03f165b..5b91d70ae9a08 100644 --- a/mk/target.mk +++ b/mk/target.mk @@ -56,9 +56,10 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC): \ endef -# Instantiate template for all stages -$(foreach target,$(CFG_TARGET_TRIPLES), \ - $(eval $(call TARGET_STAGE_N,0,$(target),$(CFG_HOST_TRIPLE))) \ - $(eval $(call TARGET_STAGE_N,1,$(target),$(CFG_HOST_TRIPLE))) \ - $(eval $(call TARGET_STAGE_N,2,$(target),$(CFG_HOST_TRIPLE))) \ - $(eval $(call TARGET_STAGE_N,3,$(target),$(CFG_HOST_TRIPLE)))) +# In principle, each host can build each target: +$(foreach source,$(CFG_TARGET_TRIPLES), \ + $(foreach target,$(CFG_TARGET_TRIPLES), \ + $(eval $(call TARGET_STAGE_N,0,$(source),$(target))) \ + $(eval $(call TARGET_STAGE_N,1,$(source),$(target))) \ + $(eval $(call TARGET_STAGE_N,2,$(source),$(target))) \ + $(eval $(call TARGET_STAGE_N,3,$(source),$(target)))))