2011-10-02 03:12:08 +00:00
|
|
|
# TARGET_STAGE_N template: This defines how target artifacts are built
|
2011-11-21 21:11:40 +00:00
|
|
|
# for all stage/target architecture combinations. The arguments:
|
|
|
|
# $(1) is the stage
|
|
|
|
# $(2) is the target triple
|
|
|
|
# $(3) is the host triple
|
2011-10-02 03:12:08 +00:00
|
|
|
|
|
|
|
define TARGET_STAGE_N
|
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.ll: \
|
2011-11-01 23:50:47 +00:00
|
|
|
$$(S)src/rt/intrinsics/intrinsics.$(HOST_$(2)).ll.in
|
2011-10-14 18:31:40 +00:00
|
|
|
@$$(call E, sed: $$@)
|
2011-10-14 19:22:20 +00:00
|
|
|
$$(Q)sed s/@CFG_TARGET_TRIPLE@/$(2)/ $$< > $$@
|
2011-10-14 18:31:40 +00:00
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.bc: \
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.ll \
|
2011-11-02 23:21:17 +00:00
|
|
|
$$(LLVM_CONFIG_$(2))
|
2011-10-14 18:31:40 +00:00
|
|
|
@$$(call E, llvms-as: $$@)
|
2011-11-02 23:21:17 +00:00
|
|
|
$$(Q)$$(LLVM_AS_$(2)) -o $$@ $$<
|
2011-10-02 03:12:08 +00:00
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
|
|
|
|
rt/$(2)/arch/$$(HOST_$(2))/libmorestack.a
|
2011-11-29 01:23:13 +00:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2011-12-06 00:46:37 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB): \
|
|
|
|
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
|
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3))
|
|
|
|
@$$(call E, compile_and_link: $$@)
|
2011-12-02 16:51:59 +00:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) --no-core --lib -o $$@ $$< && touch $$@
|
2011-12-06 00:46:37 +00:00
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
|
|
|
|
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
|
2011-12-06 00:46:37 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3))
|
2011-10-02 03:12:08 +00:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2011-12-02 16:51:59 +00:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) --lib -o $$@ $$< && touch $$@
|
2011-10-02 03:12:08 +00:00
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM): \
|
|
|
|
rustllvm/$(2)/$$(CFG_RUSTLLVM)
|
2011-10-02 03:12:08 +00:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X): \
|
2011-12-20 10:17:13 +00:00
|
|
|
$$(RUSTC_INPUTS) \
|
|
|
|
$$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
|
2011-11-21 21:11:40 +00:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$<
|
2011-10-02 03:12:08 +00:00
|
|
|
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC): \
|
|
|
|
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
|
2011-12-20 10:17:13 +00:00
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM) \
|
2011-12-17 01:21:18 +00:00
|
|
|
$$(TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
|
2011-11-21 21:11:40 +00:00
|
|
|
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3))
|
2011-10-02 03:12:08 +00:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2011-12-02 16:51:59 +00:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) --lib -o $$@ $$< && touch $$@
|
2011-10-02 03:12:08 +00:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
2012-01-06 20:06:35 +00:00
|
|
|
# The stage0 (snapshot) compiler produces binaries that expect the
|
|
|
|
# snapshot runtime. Therefore, the stage1 compiler and libraries
|
|
|
|
# (which are produced by stage0) should use the runtime from the
|
|
|
|
# snapshot. The stage2 compiler and libraries (which are produced by
|
|
|
|
# stage1) will be the first that are expecting to run against the
|
|
|
|
# runtime as defined in the working directory.
|
|
|
|
#
|
|
|
|
# Arguments are the same as for TARGET_BASE_STAGE_N
|
|
|
|
define TARGET_RT_FROM_SNAPSHOT
|
|
|
|
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME): \
|
|
|
|
$$(HLIB$(1)_H_$(3))/$$(CFG_RUNTIME)
|
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
# This rule copies from the runtime for the working directory. It
|
|
|
|
# applies to targets produced by stage1 or later. See comment on
|
|
|
|
# previous rule.
|
|
|
|
#
|
|
|
|
# Arguments are the same as for TARGET_BASE_STAGE_N
|
|
|
|
define TARGET_RT_FROM_WD
|
|
|
|
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME): \
|
|
|
|
rt/$(2)/$$(CFG_RUNTIME)
|
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2011-11-22 21:04:52 +00:00
|
|
|
# In principle, each host can build each target:
|
|
|
|
$(foreach source,$(CFG_TARGET_TRIPLES), \
|
|
|
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
2012-01-06 20:06:35 +00:00
|
|
|
$(eval $(call TARGET_STAGE_N,0,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_STAGE_N,1,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_STAGE_N,2,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_STAGE_N,3,$(target),$(source)))))
|
|
|
|
|
|
|
|
$(eval $(call TARGET_RT_FROM_SNAPSHOT,0,$(CFG_HOST_TRIPLE),$(CFG_HOST_TRIPLE)))
|
|
|
|
|
|
|
|
$(foreach source,$(CFG_TARGET_TRIPLES), \
|
|
|
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
|
|
|
$(eval $(call TARGET_RT_FROM_WD,1,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_RT_FROM_WD,2,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_RT_FROM_WD,3,$(target),$(source)))))
|