2011-10-02 05:12:08 +02:00
|
|
|
# TARGET_STAGE_N template: This defines how target artifacts are built
|
2011-11-21 22:11:40 +01: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 05:12:08 +02:00
|
|
|
|
2012-03-16 15:14:33 +01:00
|
|
|
# If you are making non-backwards compatible changes to the runtime
|
|
|
|
# (resp. corelib), set this flag to 1. It will cause stage1 to use
|
|
|
|
# the snapshot runtime (resp. corelib) rather than the runtime
|
|
|
|
# (resp. corelib) from the working directory.
|
2012-05-31 10:27:21 +02:00
|
|
|
USE_SNAPSHOT_RUNTIME=0
|
2012-06-30 00:34:39 +02:00
|
|
|
USE_SNAPSHOT_CORELIB=0
|
2012-05-31 10:27:21 +02:00
|
|
|
USE_SNAPSHOT_STDLIB=0
|
2012-01-09 23:08:08 +01:00
|
|
|
|
2011-10-02 05:12:08 +02:00
|
|
|
define TARGET_STAGE_N
|
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
|
|
|
|
rt/$(2)/arch/$$(HOST_$(2))/libmorestack.a
|
2011-11-29 02:23:13 +01:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM): \
|
|
|
|
rustllvm/$(2)/$$(CFG_RUSTLLVM)
|
2011-10-02 05:12:08 +02:00
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X): \
|
2011-12-20 11:17:13 +01:00
|
|
|
$$(RUSTC_INPUTS) \
|
|
|
|
$$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
|
2011-11-21 22:11:40 +01:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2012-03-22 16:39:41 +01:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$<
|
2011-10-02 05:12:08 +02:00
|
|
|
|
2011-11-21 22:11:40 +01:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC): \
|
|
|
|
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
|
2012-05-30 06:35:12 +02:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX)
|
2012-03-22 23:27:35 +01:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
|
|
|
|
|
2012-05-30 06:35:12 +02:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX): \
|
|
|
|
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
|
2011-12-20 11:17:13 +01:00
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
|
2011-11-21 22:11:40 +01:00
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM) \
|
2011-12-17 02:21:18 +01:00
|
|
|
$$(TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
|
2011-11-21 22:11:40 +01:00
|
|
|
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3))
|
2011-10-02 05:12:08 +02:00
|
|
|
@$$(call E, compile_and_link: $$@)
|
2012-04-27 01:02:01 +02:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) -o $$@ $$< && touch $$@
|
2011-10-02 05:12:08 +02:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
2012-01-06 21:06:35 +01:00
|
|
|
# The stage0 (snapshot) compiler produces binaries that expect the
|
2012-01-09 23:08:08 +01:00
|
|
|
# snapshot runtime. Normally the working directory runtime and
|
|
|
|
# snapshot runtime are compatible, so this is no problem. But
|
|
|
|
# sometimes we want to make non-backwards-compatible changes. In
|
|
|
|
# those cases, 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.
|
|
|
|
#
|
|
|
|
# The catch is that you may not add new functions to the runtime
|
|
|
|
# in this case!
|
2012-01-06 21:06:35 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2012-03-16 15:14:33 +01:00
|
|
|
# As above, but builds the corelib either by taking it out of the
|
|
|
|
# snapshot or from the working directory.
|
|
|
|
|
|
|
|
define TARGET_CORELIB_FROM_SNAPSHOT
|
|
|
|
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB): \
|
|
|
|
$$(HLIB$(1)_H_$(3))/$$(CFG_CORELIB) \
|
|
|
|
$$(CORELIB_INPUTS) \
|
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3))
|
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
$$(Q)cp $$(HLIB$(1)_H_$(3))/$$(CORELIB_GLOB) \
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
define TARGET_CORELIB_FROM_WD
|
|
|
|
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB): \
|
|
|
|
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
|
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3))
|
|
|
|
@$$(call E, compile_and_link: $$@)
|
2012-03-22 16:39:41 +01:00
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
|
2012-03-16 15:14:33 +01:00
|
|
|
|
|
|
|
endef
|
|
|
|
|
2012-05-22 20:40:46 +02:00
|
|
|
define TARGET_STDLIB_FROM_SNAPSHOT
|
|
|
|
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
|
|
|
|
$$(HLIB$(1)_H_$(3))/$$(CFG_STDLIB) \
|
|
|
|
$$(STDLIB_INPUTS) \
|
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3))
|
|
|
|
@$$(call E, cp: $$@)
|
|
|
|
$$(Q)cp $$< $$@
|
|
|
|
$$(Q)cp $$(HLIB$(1)_H_$(3))/$$(STDLIB_GLOB) \
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
define TARGET_STDLIB_FROM_WD
|
|
|
|
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
|
|
|
|
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
|
|
|
|
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
|
|
|
|
$$(TSREQ$(1)_T_$(2)_H_$(3))
|
|
|
|
@$$(call E, compile_and_link: $$@)
|
|
|
|
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
2011-11-22 22:04:52 +01:00
|
|
|
# In principle, each host can build each target:
|
2012-03-16 15:14:33 +01:00
|
|
|
$(foreach source,$(CFG_TARGET_TRIPLES), \
|
|
|
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
2012-01-06 21:06:35 +01: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)))))
|
|
|
|
|
2012-01-09 23:08:08 +01:00
|
|
|
# Host triple either uses the snapshot runtime or runtime from
|
|
|
|
# working directory, depending on the USE_SNAPSHOT_RUNTIME var.
|
|
|
|
ifeq ($(USE_SNAPSHOT_RUNTIME),1)
|
|
|
|
$(foreach src,$(CFG_HOST_TRIPLE),\
|
|
|
|
$(eval $(call TARGET_RT_FROM_SNAPSHOT,0,$(src),$(src))))
|
|
|
|
else
|
|
|
|
$(foreach src,$(CFG_HOST_TRIPLE),\
|
|
|
|
$(eval $(call TARGET_RT_FROM_WD,0,$(src),$(src))))
|
|
|
|
endif
|
2012-01-06 21:06:35 +01:00
|
|
|
|
2012-03-16 15:14:33 +01:00
|
|
|
ifeq ($(USE_SNAPSHOT_CORELIB),1)
|
|
|
|
$(foreach src,$(CFG_HOST_TRIPLE),\
|
|
|
|
$(eval $(call TARGET_CORELIB_FROM_SNAPSHOT,0,$(src),$(src))))
|
|
|
|
else
|
|
|
|
$(foreach src,$(CFG_HOST_TRIPLE),\
|
|
|
|
$(eval $(call TARGET_CORELIB_FROM_WD,0,$(src),$(src))))
|
|
|
|
endif
|
|
|
|
|
2012-05-22 20:40:46 +02:00
|
|
|
ifeq ($(USE_SNAPSHOT_STDLIB),1)
|
|
|
|
$(foreach src,$(CFG_HOST_TRIPLE),\
|
|
|
|
$(eval $(call TARGET_STDLIB_FROM_SNAPSHOT,0,$(src),$(src))))
|
|
|
|
else
|
|
|
|
$(foreach src,$(CFG_HOST_TRIPLE),\
|
|
|
|
$(eval $(call TARGET_STDLIB_FROM_WD,0,$(src),$(src))))
|
|
|
|
endif
|
|
|
|
|
2012-01-09 23:08:08 +01:00
|
|
|
# Non-host triples build the stage0 runtime from the working directory
|
2012-03-16 15:14:33 +01:00
|
|
|
$(foreach source,$(CFG_TARGET_TRIPLES), \
|
|
|
|
$(foreach target,$(NON_HOST_TRIPLES), \
|
2012-03-17 07:33:05 +01:00
|
|
|
$(eval $(call TARGET_RT_FROM_WD,0,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_CORELIB_FROM_WD,0,$(target),$(source))) \
|
2012-05-31 07:55:21 +02:00
|
|
|
$(eval $(call TARGET_STDLIB_FROM_WD,0,$(target),$(source))) \
|
2012-03-17 07:33:05 +01:00
|
|
|
))
|
2012-01-09 23:08:08 +01:00
|
|
|
|
|
|
|
# After stage0, always build the stage0 runtime from the working directory
|
2012-03-16 15:14:33 +01:00
|
|
|
$(foreach source,$(CFG_TARGET_TRIPLES), \
|
|
|
|
$(foreach target,$(CFG_TARGET_TRIPLES), \
|
2012-01-06 21:06:35 +01:00
|
|
|
$(eval $(call TARGET_RT_FROM_WD,1,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_RT_FROM_WD,2,$(target),$(source))) \
|
2012-03-16 15:14:33 +01:00
|
|
|
$(eval $(call TARGET_RT_FROM_WD,3,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_CORELIB_FROM_WD,1,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_CORELIB_FROM_WD,2,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_CORELIB_FROM_WD,3,$(target),$(source))) \
|
2012-05-22 20:40:46 +02:00
|
|
|
$(eval $(call TARGET_STDLIB_FROM_WD,1,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_STDLIB_FROM_WD,2,$(target),$(source))) \
|
|
|
|
$(eval $(call TARGET_STDLIB_FROM_WD,3,$(target),$(source))) \
|
2012-03-16 15:14:33 +01:00
|
|
|
))
|
2012-01-09 22:34:01 +01:00
|
|
|
|