rust/mk/target.mk

65 lines
2.0 KiB
Makefile
Raw Normal View History

# TARGET_STAGE_N template: This defines how target artifacts are built
2011-11-21 15:11:40 -06:00
# for all stage/target architecture combinations. The arguments:
# $(1) is the stage
# $(2) is the target triple
# $(3) is the host triple
define TARGET_STAGE_N
2011-11-21 15:11:40 -06:00
$$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.ll: \
$$(S)src/rt/intrinsics/intrinsics.$(HOST_$(2)).ll.in
2011-10-14 13:31:40 -05:00
@$$(call E, sed: $$@)
$$(Q)sed s/@CFG_TARGET_TRIPLE@/$(2)/ $$< > $$@
2011-10-14 13:31:40 -05:00
2011-11-21 15:11:40 -06:00
$$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.bc: \
$$(TLIB$(1)_T_$(2)_H_$(3))/intrinsics.ll \
$$(LLVM_CONFIG_$(2))
2011-10-14 13:31:40 -05:00
@$$(call E, llvms-as: $$@)
$$(Q)$$(LLVM_AS_$(2)) -o $$@ $$<
2011-11-21 15:11:40 -06:00
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
rt/$(2)/arch/$$(HOST_$(2))/libmorestack.a
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
2011-11-21 15:11:40 -06:00
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
$$(TSREQ$(1)_T_$(2)_H_$(3))
@$$(call E, compile_and_link: $$@)
2011-11-21 15:11:40 -06:00
$$(STAGE$(1)_T_$(2)_H_$(3)) --lib -o $$@ $$<
2011-11-21 15:11:40 -06:00
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME): \
rt/$(2)/$$(CFG_RUNTIME)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
2011-11-21 15:11:40 -06:00
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM): \
rustllvm/$(2)/$$(CFG_RUSTLLVM)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
2011-11-21 15:11:40 -06:00
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X): \
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM) \
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$<
2011-11-21 15:11:40 -06:00
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC): \
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM) \
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3))
@$$(call E, compile_and_link: $$@)
2011-11-21 15:11:40 -06:00
$$(STAGE$(1)_T_$(2)_H_$(3)) --lib -o $$@ $$<
endef
# Instantiate template for all stages
$(foreach target,$(CFG_TARGET_TRIPLES), \
2011-11-21 15:11:40 -06:00
$(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))))