rust/mk/host.mk
Brian Anderson 6e654564db Lots of build system cleanup and documentation
This splits mk/stageN.mk into host.mk and target.mk and makes
the build rules somewhat simpler - there's no more building from stageN
into stageN+1; instead we always build from stageN(host) to
stageN(target) then promote from stageN(target) to stageN+1(host).

Add a big honkin explaination right at the top of Makefile.in
2011-10-02 00:57:53 -07:00

57 lines
1.6 KiB
Makefile

# HOST_STAGE_N template: arg 1 is the N we're promoting *from*, arg 2
# is N+1. Must be invoked to promote target artifacts to host artifacts
# for stage 1-3 (stage0 host artifacts come from the snapshot).
#
# The easiest way to read this template is to assume we're promoting
# stage1 to stage2 and mentally gloss $(1) as 1, $(2) as 2.
define HOST_STAGE_N
# Host libraries and executables (stage$(2)/bin/rustc and its runtime needs)
$$(HOST_BIN$(2))/rustc$$(X): \
$$(TARGET_HOST_BIN$(1))/rustc$$(X) \
$$(HOST_LIB$(2))/$$(CFG_RUNTIME) \
$$(HOST_LIB$(2))/$$(CFG_RUSTLLVM) \
$$(HOST_STDLIB_DEFAULT$(2))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
# FIXME: The fuzzer depends on this. Remove once it's rpathed to correctly
# find it in the appropriate target directory
$$(HOST_LIB$(2))/$$(CFG_LIBRUSTC): \
$$(TARGET_HOST_LIB$(1))/$$(CFG_LIBRUSTC) \
$$(HOST_LIB$(2))/$$(CFG_RUNTIME) \
$$(HOST_LIB$(2))/$$(CFG_RUSTLLVM) \
$$(HOST_STDLIB_DEFAULT$(2))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(HOST_LIB$(2))/$$(CFG_RUNTIME): \
$$(TARGET_HOST_LIB$(1))/$$(CFG_RUNTIME)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(HOST_LIB$(2))/$$(CFG_STDLIB): \
$$(TARGET_HOST_LIB$(1))/$$(CFG_STDLIB) \
$$(HOST_LIB$(2))/$$(CFG_RUNTIME)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(HOST_LIB$(2))/libstd.rlib: \
$$(TARGET_HOST_LIB$(1))/libstd.rlib \
$$(HOST_LIB$(2))/$$(CFG_RUNTIME)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(HOST_LIB$(2))/$$(CFG_RUSTLLVM): \
$$(TARGET_HOST_LIB$(1))/$$(CFG_RUSTLLVM)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
endef
$(eval $(call HOST_STAGE_N,0,1))
$(eval $(call HOST_STAGE_N,1,2))
$(eval $(call HOST_STAGE_N,2,3))