mk: Split target triples into bulid triple + host triples + target triples

For cross compiling to targets that don't want to build a compiler
This commit is contained in:
Brian Anderson 2013-02-21 16:15:01 -08:00
parent e0767bf24f
commit 15c0c35352
18 changed files with 176 additions and 145 deletions

View File

@ -70,16 +70,22 @@ include config.mk
ALL_OBJ_FILES :=
MKFILE_DEPS := config.stamp $(call rwildcard,$(CFG_SRC_DIR)mk/,*)
NON_HOST_TRIPLES = $(filter-out $(CFG_HOST_TRIPLE),$(CFG_TARGET_TRIPLES))
NON_BUILD_HOST_TRIPLES = $(filter-out $(CFG_BUILD_TRIPLE),$(CFG_HOST_TRIPLES))
NON_BUILD_TARGET_TRIPLES = $(filter-out $(CFG_BUILD_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: build triple $(CFG_BUILD_TRIPLE))
CFG_INFO := $(info cfg: host triples $(CFG_HOST_TRIPLES))
CFG_INFO := $(info cfg: target triples $(CFG_TARGET_TRIPLES))
ifneq ($(wildcard $(NON_HOST_TRIPLES)),)
CFG_INFO := $(info cfg: non host triples $(NON_HOST_TRIPLES))
ifneq ($(wildcard $(NON_BUILD_HOST_TRIPLES)),)
CFG_INFO := $(info cfg: non-build host triples $(NON_BUILD_HOST_TRIPLES))
endif
ifneq ($(wildcard $(NON_BUILD_TARGET_TRIPLES)),)
CFG_INFO := $(info cfg: non-build target triples $(NON_BUILD_TARGET_TRIPLES))
endif
CFG_RUSTC_FLAGS := $(RUSTFLAGS)
@ -272,8 +278,8 @@ LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X)
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_LLVM_VARS,$(target))))
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(call DEF_LLVM_VARS,$(host))))
######################################################################
# Exports for sub-utilities
@ -285,7 +291,7 @@ $(foreach target,$(CFG_TARGET_TRIPLES), \
export CFG_SRC_DIR
export CFG_BUILD_DIR
export CFG_VERSION
export CFG_HOST_TRIPLE
export CFG_BUILD_TRIPLE
export CFG_LLVM_ROOT
export CFG_ENABLE_MINGW_CROSS
export CFG_PREFIX
@ -409,7 +415,7 @@ CFGFLAG$(1)_T_$(2)_H_$(3) = stage$(1)
# if you're building a cross config, the host->* parts are
# effectively stage1, since it uses the just-built stage0.
ifeq ($(1),0)
ifneq ($(strip $(CFG_HOST_TRIPLE)),$(strip $(3)))
ifneq ($(strip $(CFG_BUILD_TRIPLE)),$(strip $(3)))
CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
endif
endif
@ -430,7 +436,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \
endef
$(foreach build,$(CFG_TARGET_TRIPLES), \
$(foreach build,$(CFG_HOST_TRIPLES), \
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(foreach stage,$(STAGES), \
$(eval $(call SREQ,$(stage),$(target),$(build))))))))
@ -451,13 +457,13 @@ rustc-stage$(2)-H-$(1): \
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(foreach stage,1 2 3, \
$(eval $(call DEF_RUSTC_STAGE_TARGET,$(host),$(stage))))))
rustc-stage1: rustc-stage1-H-$(CFG_HOST_TRIPLE)
rustc-stage2: rustc-stage2-H-$(CFG_HOST_TRIPLE)
rustc-stage3: rustc-stage3-H-$(CFG_HOST_TRIPLE)
rustc-stage1: rustc-stage1-H-$(CFG_BUILD_TRIPLE)
rustc-stage2: rustc-stage2-H-$(CFG_BUILD_TRIPLE)
rustc-stage3: rustc-stage3-H-$(CFG_BUILD_TRIPLE)
define DEF_RUSTC_TARGET
# $(1) == architecture
@ -468,12 +474,12 @@ endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_RUSTC_TARGET,$(host))))
rustc-stage1: rustc-stage1-H-$(CFG_HOST_TRIPLE)
rustc-stage2: rustc-stage2-H-$(CFG_HOST_TRIPLE)
rustc-stage3: rustc-stage3-H-$(CFG_HOST_TRIPLE)
rustc: rustc-H-$(CFG_HOST_TRIPLE)
rustc-stage1: rustc-stage1-H-$(CFG_BUILD_TRIPLE)
rustc-stage2: rustc-stage2-H-$(CFG_BUILD_TRIPLE)
rustc-stage3: rustc-stage3-H-$(CFG_BUILD_TRIPLE)
rustc: rustc-H-$(CFG_BUILD_TRIPLE)
rustc-H-all: $(foreach host,$(CFG_TARGET_TRIPLES),rustc-H-$(host))
rustc-H-all: $(foreach host,$(CFG_HOST_TRIPLES),rustc-H-$(host))
######################################################################
# Entrypoint rule
@ -489,19 +495,27 @@ CFG_INFO := $(info cfg: *** stage2 and later will not be built ***)
CFG_INFO := $(info cfg:)
#XXX This is surely busted
all: $(SREQ1$(CFG_HOST_TRIPLE)) $(GENERATED) docs
all: $(SREQ1$(CFG_BUILD_TRIPLE)) $(GENERATED) docs
else
define ALL_TARGET_N
ifneq ($$(findstring $(1),$$(CFG_HOST_TRIPLES)),)
# This is a host
all-target-$(1)-host-$(2): $$(CSREQ2_T_$(1)_H_$(2))
else
# This is a target only
all-target-$(1)-host-$(2): $$(SREQ2_T_$(1)_H_$(2))
endif
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call ALL_TARGET_N,$(target),$(CFG_HOST_TRIPLE))))
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(call ALL_TARGET_N,$(target),$(host)))))
ALL_TARGET_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \
all-target-$(target)-host-$(CFG_HOST_TRIPLE))
$(foreach host,$(CFG_HOST_TRIPLES), \
all-target-$(target)-host-$(host)))
all: $(ALL_TARGET_RULES) $(GENERATED) docs

23
configure vendored
View File

@ -301,7 +301,7 @@ then
fi
DEFAULT_HOST_TRIPLE="${CFG_CPUTYPE}-${CFG_OSTYPE}"
DEFAULT_BUILD_TRIPLE="${CFG_CPUTYPE}-${CFG_OSTYPE}"
CFG_SRC_DIR="$(cd $(dirname $0) && pwd)/"
CFG_BUILD_DIR="$(pwd)/"
@ -346,8 +346,9 @@ opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-
valopt prefix "/usr/local" "set installation prefix"
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
valopt llvm-root "" "set LLVM root"
valopt host-triple "${DEFAULT_HOST_TRIPLE}" "LLVM host triple"
valopt target-triples "${CFG_HOST_TRIPLE}" "LLVM target triples"
valopt build-triple "${DEFAULT_BUILD_TRIPLE}" "LLVM build triple"
valopt host-triples "${CFG_BUILD_TRIPLE}" "LLVM host triples"
valopt target-triples "${CFG_HOST_TRIPLES}" "LLVM target triples"
# Validate Options
step_msg "validating $CFG_SELF args"
@ -532,10 +533,6 @@ fi
CFG_PREFIX=${CFG_PREFIX%/}
CFG_TARGET_TRIPLES="$(echo $CFG_TARGET_TRIPLES | tr ',' ' ')"
case $CFG_TARGET_TRIPLES in
(*$CFG_HOST_TRIPLE*) ;;
(*) err "Host triple is not among the target triples." ;;
esac
if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
then
@ -562,13 +559,13 @@ do
done
make_dir llvm
for t in $CFG_TARGET_TRIPLES
for t in $CFG_HOST_TRIPLES
do
make_dir llvm/$t
done
make_dir rustllvm
for t in $CFG_TARGET_TRIPLES
for t in $CFG_HOST_TRIPLES
do
make_dir rustllvm/$t
done
@ -593,7 +590,7 @@ then
CFG_LIBDIR=bin
fi
for h in $CFG_TARGET_TRIPLES
for h in $CFG_HOST_TRIPLES
do
for t in $CFG_TARGET_TRIPLES
do
@ -669,7 +666,7 @@ fi
# Configure llvm, only if necessary
step_msg "looking at LLVM"
CFG_LLVM_SRC_DIR=${CFG_SRC_DIR}src/llvm/
for t in $CFG_TARGET_TRIPLES
for t in $CFG_HOST_TRIPLES
do
do_reconfigure=1
@ -819,6 +816,8 @@ putvar CFG_OSTYPE
putvar CFG_CPUTYPE
putvar CFG_CONFIGURE_ARGS
putvar CFG_PREFIX
putvar CFG_BUILD_TRIPLE
putvar CFG_HOST_TRIPLES
putvar CFG_TARGET_TRIPLES
putvar CFG_C_COMPILER
putvar CFG_LIBDIR
@ -854,7 +853,7 @@ fi
putvar CFG_LLVM_ROOT
putvar CFG_LLVM_SRC_DIR
for t in $CFG_TARGET_TRIPLES
for t in $CFG_HOST_TRIPLES
do
CFG_LLVM_BUILD_DIR=$(echo CFG_LLVM_BUILD_DIR_${t} | tr - _)
CFG_LLVM_INST_DIR=$(echo CFG_LLVM_INST_DIR_${t} | tr - _)

View File

@ -14,7 +14,7 @@
CLEAN_STAGE_RULES = \
$(foreach stage, $(STAGES), \
$(foreach host, $(CFG_TARGET_TRIPLES), \
$(foreach host, $(CFG_HOST_TRIPLES), \
clean$(stage)_H_$(host) \
$(foreach target, $(CFG_TARGET_TRIPLES), \
clean$(stage)_T_$(target)_H_$(host))))
@ -33,7 +33,7 @@ clean: clean-misc $(CLEAN_STAGE_RULES)
clean-misc:
@$(call E, cleaning)
$(Q)find rustllvm rt $(CFG_HOST_TRIPLE)/test \
$(Q)find rustllvm rt $(CFG_BUILD_TRIPLE)/test \
-name '*.[odasS]' -o \
-name '*.so' -o \
-name '*.dylib' -o \
@ -41,7 +41,7 @@ clean-misc:
-name '*.def' -o \
-name '*.bc' \
| xargs rm -f
$(Q)find rustllvm rt $(CFG_HOST_TRIPLE)\
$(Q)find rustllvm rt $(CFG_BUILD_TRIPLE)\
-name '*.dSYM' \
| xargs rm -Rf
$(Q)rm -f $(RUNTIME_OBJS) $(RUNTIME_DEF)
@ -93,7 +93,7 @@ clean$(1)_H_$(2):
endef
$(foreach host, $(CFG_TARGET_TRIPLES), \
$(foreach host, $(CFG_HOST_TRIPLES), \
$(eval $(foreach stage, $(STAGES), \
$(eval $(call CLEAN_HOST_STAGE_N,$(stage),$(host))))))
@ -127,12 +127,12 @@ clean$(1)_T_$(2)_H_$(3):
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/run_pass_stage* # For windows
endef
$(foreach host, $(CFG_TARGET_TRIPLES), \
$(foreach host, $(CFG_HOST_TRIPLES), \
$(eval $(foreach target, $(CFG_TARGET_TRIPLES), \
$(eval $(foreach stage, 0 1 2 3, \
$(eval $(call CLEAN_TARGET_STAGE_N,$(stage),$(target),$(host))))))))
define DEF_CLEAN_LLVM_TARGET
define DEF_CLEAN_LLVM_HOST
ifeq ($(CFG_LLVM_ROOT),)
clean-llvm$(1):
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1)) clean
@ -142,5 +142,5 @@ clean-llvm$(1): ;
endif
endef
$(foreach target, $(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_CLEAN_LLVM_TARGET,$(target))))
$(foreach host, $(CFG_HOST_TRIPLES), \
$(eval $(call DEF_CLEAN_LLVM_HOST,$(host))))

View File

@ -171,7 +171,7 @@ ifeq ($(CFG_PANDOC),)
else
# The rustdoc executable
RUSTDOC = $(HBIN2_H_$(CFG_HOST_TRIPLE))/rustdoc$(X)
RUSTDOC = $(HBIN2_H_$(CFG_BUILD_TRIPLE))/rustdoc$(X)
# The library documenting macro
# $(1) - The output directory

View File

@ -115,7 +115,7 @@ $$(HLIB$(2)_H_$(4))/$$(CFG_RUSTLLVM): \
endef
$(foreach t,$(CFG_TARGET_TRIPLES), \
$(foreach t,$(CFG_HOST_TRIPLES), \
$(eval $(call CP_HOST_STAGE_N,0,1,$(t),$(t))) \
$(eval $(call CP_HOST_STAGE_N,1,2,$(t),$(t))) \
$(eval $(call CP_HOST_STAGE_N,2,3,$(t),$(t))))

View File

@ -67,24 +67,24 @@ install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call INSTALL_TARGET_N,$(target),$(CFG_HOST_TRIPLE))))
$(eval $(call INSTALL_TARGET_N,$(target),$(CFG_BUILD_TRIPLE))))
INSTALL_TARGET_RULES = $(foreach target,$(CFG_TARGET_TRIPLES), \
install-target-$(target)-host-$(CFG_HOST_TRIPLE))
install-target-$(target)-host-$(CFG_BUILD_TRIPLE))
install: all install-host install-targets
# Shorthand for build/stageN/bin
HB = $(HBIN$(ISTAGE)_H_$(CFG_HOST_TRIPLE))
HB2 = $(HBIN2_H_$(CFG_HOST_TRIPLE))
HB = $(HBIN$(ISTAGE)_H_$(CFG_BUILD_TRIPLE))
HB2 = $(HBIN2_H_$(CFG_BUILD_TRIPLE))
# Shorthand for build/stageN/lib
HL = $(HLIB$(ISTAGE)_H_$(CFG_HOST_TRIPLE))
HL = $(HLIB$(ISTAGE)_H_$(CFG_BUILD_TRIPLE))
# Shorthand for the prefix bin directory
PHB = $(PREFIX_BIN)
# Shorthand for the prefix bin directory
PHL = $(PREFIX_LIB)
install-host: $(CSREQ$(ISTAGE)_T_$(CFG_HOST_TRIPLE)_H_$(CFG_HOST_TRIPLE))
install-host: $(CSREQ$(ISTAGE)_T_$(CFG_BUILD_TRIPLE)_H_$(CFG_BUILD_TRIPLE))
$(Q)mkdir -p $(PREFIX_BIN)
$(Q)mkdir -p $(PREFIX_LIB)
$(Q)mkdir -p $(PREFIX_ROOT)/share/man/man1

View File

@ -30,5 +30,5 @@ endif
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_LLVM_RULES,$(target))))
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(call DEF_LLVM_RULES,$(host))))

View File

@ -10,16 +10,16 @@
ifdef CFG_PERF_TOOL
rustc-perf$(X): $(CFG_HOST_TRIPLE)/stage2/bin/rustc$(X)
rustc-perf$(X): $(CFG_BUILD_TRIPLE)/stage2/bin/rustc$(X)
@$(call E, perf compile: $@)
$(PERF_STAGE2_T_$(CFG_HOST_TRIPLE)_H_$(CFG_HOST_TRIPLE)) \
$(PERF_STAGE2_T_$(CFG_BUILD_TRIPLE)_H_$(CFG_BUILD_TRIPLE)) \
-o $@ $(COMPILER_CRATE) >rustc-perf.err 2>&1
$(Q)rm -f $(LIBRUSTC_GLOB)
else
rustc-perf$(X): $(CFG_HOST_TRIPLE)/stage2/bin/rustc$(X)
rustc-perf$(X): $(CFG_BUILD_TRIPLE)/stage2/bin/rustc$(X)
$(Q)touch $@
endif
perf: check-stage2-perf rustc-perf$(X)
$(Q)find $(CFG_HOST_TRIPLE)/test/perf -name \*.err | xargs cat
$(Q)find $(CFG_BUILD_TRIPLE)/test/perf -name \*.err | xargs cat
$(Q)cat rustc-perf.err

View File

@ -136,7 +136,7 @@ CFG_TESTLIB=$(CFG_BUILD_DIR)/$(2)/$(strip \
stage2/$(CFG_LIBDIR), \
$(if $(findstring stage3,$(1)), \
stage3/$(CFG_LIBDIR), \
)))))/rustc/$(CFG_HOST_TRIPLE)/$(CFG_LIBDIR)
)))))/rustc/$(CFG_BUILD_TRIPLE)/$(CFG_LIBDIR)
ifdef CFG_UNIXY
CFG_INFO := $(info cfg: unix-y environment)
@ -200,7 +200,7 @@ else
CFG_LDPATH :=
CFG_RUN=$(2)
endif
CFG_RUN_TARG=$(call CFG_RUN,$(HLIB$(1)_H_$(CFG_HOST_TRIPLE)),$(2))
CFG_RUN_TARG=$(call CFG_RUN,$(HLIB$(1)_H_$(CFG_BUILD_TRIPLE)),$(2))
CFG_RUN_TEST=$(call CFG_RUN,$(call CFG_TESTLIB,$(1),$(3)),$(1))
CFG_LIBUV_LINK_FLAGS=-lWs2_32 -lpsapi -liphlpapi
@ -318,7 +318,7 @@ endif
# .cfi pseudo-ops on mac
define CFG_MAKE_ASSEMBLER
CFG_ASSEMBLE_$(1)=$$(CPP) $$(CFG_DEPEND_FLAGS) $$(2) | \
$$(LLVM_MC_$$(CFG_HOST_TRIPLE)) \
$$(LLVM_MC_$$(CFG_BUILD_TRIPLE)) \
-assemble \
-filetype=obj \
-triple=$(1) \

View File

@ -26,10 +26,10 @@ else
"no-reformat\|xfail-pretty\|xfail-test")
endif
reformat: $(SREQ1$(CFG_HOST_TRIPLE))
reformat: $(SREQ1$(CFG_BUILD_TRIPLE))
@$(call E, reformat [stage1]: $@)
for i in $(PP_INPUTS_FILTERED); \
do $(call CFG_RUN_TARG,1,$(CFG_HOST_TRIPLE)/stage1/rustc$(X)) \
do $(call CFG_RUN_TARG,1,$(CFG_BUILD_TRIPLE)/stage1/rustc$(X)) \
--pretty normal $$i >$$i.tmp; \
if [ $$? -ne 0 ]; \
then echo failed to print $$i; rm $$i.tmp; \

View File

@ -127,7 +127,7 @@ rt/$(1)/%.o: rt/%.c $$(MKFILE_DEPS)
$$(SNAP_DEFINES)) $$<
rt/$(1)/%.o: rt/%.S $$(MKFILE_DEPS) \
$$(LLVM_CONFIG_$$(CFG_HOST_TRIPLE))
$$(LLVM_CONFIG_$$(CFG_BUILD_TRIPLE))
@$$(call E, compile: $$@)
$$(Q)$$(call CFG_ASSEMBLE_$(1),$$@,$$<)

View File

@ -46,5 +46,5 @@ rustllvm/$(1)/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
endef
# Instantiate template for all stages
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_RUSTLLVM_TARGETS,$(target))))
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(call DEF_RUSTLLVM_TARGETS,$(host))))

View File

@ -22,12 +22,12 @@ endif
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(foreach stage,1 2 3, \
$(eval $(call DEF_SNAP_FOR_STAGE_H,$(stage),$(host))))))
snap-stage1: snap-stage1-H-$(CFG_HOST_TRIPLE)
snap-stage1: snap-stage1-H-$(CFG_BUILD_TRIPLE)
snap-stage2: snap-stage2-H-$(CFG_HOST_TRIPLE)
snap-stage2: snap-stage2-H-$(CFG_BUILD_TRIPLE)
snap-stage3: snap-stage3-H-$(CFG_HOST_TRIPLE)
snap-stage3: snap-stage3-H-$(CFG_BUILD_TRIPLE)

View File

@ -2,16 +2,16 @@
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X): \
$(S)src/snapshots.txt \
$(S)src/etc/get-snapshot.py $(MKFILE_DEPS)
@$(call E, fetch: $@)
# Note: the variable "SNAPSHOT_FILE" is generally not set, and so
# we generally only pass one argument to this script.
ifdef CFG_ENABLE_LOCAL_RUST
$(Q)$(S)src/etc/local_stage0.sh $(CFG_HOST_TRIPLE) $(CFG_LOCAL_RUST_ROOT)
$(Q)$(S)src/etc/local_stage0.sh $(CFG_BUILD_TRIPLE) $(CFG_LOCAL_RUST_ROOT)
else
$(Q)$(CFG_PYTHON) $(S)src/etc/get-snapshot.py $(CFG_HOST_TRIPLE) $(SNAPSHOT_FILE)
$(Q)$(CFG_PYTHON) $(S)src/etc/get-snapshot.py $(CFG_BUILD_TRIPLE) $(SNAPSHOT_FILE)
ifdef CFG_ENABLE_PAX_FLAGS
@$(call E, apply PaX flags: $@)
@"$(CFG_PAXCTL)" -cm "$@"
@ -21,24 +21,24 @@ endif
# Host libs will be extracted by the above rule
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUNTIME): \
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/$(CFG_RUNTIME): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X)
$(Q)touch $@
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_CORELIB): \
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/$(CFG_CORELIB): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X)
$(Q)touch $@
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_STDLIB): \
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/$(CFG_STDLIB): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X)
$(Q)touch $@
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_LIBRUSTC): \
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/$(CFG_LIBRUSTC): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X)
$(Q)touch $@
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUSTLLVM): \
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/$(CFG_RUSTLLVM): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X)
$(Q)touch $@
# For other targets, let the host build the target:
@ -82,5 +82,5 @@ endef
# Use stage1 to build other architectures: then you don't have to wait
# for stage2, but you get the latest updates to the compiler source.
$(foreach t,$(NON_HOST_TRIPLES), \
$(eval $(call BOOTSTRAP_STAGE0,$(t),1,$(CFG_HOST_TRIPLE))))
$(foreach t,$(NON_BUILD_HOST_TRIPLES), \
$(eval $(call BOOTSTRAP_STAGE0,$(t),1,$(CFG_BUILD_TRIPLE))))

View File

@ -22,36 +22,6 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM): \
rustllvm/$(2)/$$(CFG_RUSTLLVM)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC): \
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X): \
$$(DRIVER_CRATE) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$<
ifdef CFG_ENABLE_PAX_FLAGS
@$$(call E, apply PaX flags: $$@)
@"$(CFG_PAXCTL)" -cm "$$@"
endif
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX): \
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM) \
$$(TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) -o $$@ $$< && touch $$@
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME): \
rt/$(2)/$$(CFG_RUNTIME)
@$$(call E, cp: $$@)
@ -70,10 +40,45 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB): \
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX): \
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
$$(TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) $(BORROWCK) -o $$@ $$< && touch $$@
# Only build the compiler for host triples
ifneq ($$(findstring $(2),$$(CFG_HOST_TRIPLES)),)
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM): \
rustllvm/$(2)/$$(CFG_RUSTLLVM)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC): \
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X): \
$$(DRIVER_CRATE) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$<
ifdef CFG_ENABLE_PAX_FLAGS
@$$(call E, apply PaX flags: $$@)
@"$(CFG_PAXCTL)" -cm "$$@"
endif
endif
endef
# In principle, each host can build each target:
$(foreach source,$(CFG_TARGET_TRIPLES), \
$(foreach source,$(CFG_HOST_TRIPLES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call TARGET_STAGE_N,0,$(target),$(source))) \
$(eval $(call TARGET_STAGE_N,1,$(target),$(source))) \

View File

@ -14,7 +14,9 @@
######################################################################
# The names of crates that must be tested
TEST_CRATES = core std syntax rustc rustdoc rusti rust rustpkg
TEST_TARGET_CRATES = core std
TEST_HOST_CRATES = syntax rustc rustdoc rusti rust rustpkg
TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
# Markdown files under doc/ that should have their code extracted and run
DOC_TEST_NAMES = tutorial tutorial-ffi tutorial-macros tutorial-borrowed-ptr tutorial-tasks rust
@ -93,7 +95,7 @@ cleantmptestlogs:
$(Q)rm -f tmp/*.log
cleantestlibs:
$(Q)find $(CFG_HOST_TRIPLE)/test \
$(Q)find $(CFG_BUILD_TRIPLE)/test \
-name '*.[odasS]' -o \
-name '*.so' -o \
-name '*.dylib' -o \
@ -175,10 +177,22 @@ check-stage$(1)-T-$(2)-H-$(3)-exec: \
check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
# Only test the compiler-dependent crates when the target is
# able to build a compiler (when the target triple is in the set of host triples)
ifneq ($$(findstring $(2),$$(CFG_HOST_TRIPLES)),)
check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
$$(foreach crate,$$(TEST_CRATES), \
check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
else
check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
$$(foreach crate,$$(TEST_TARGET_CRATES), \
check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
endif
check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \
$$(foreach docname,$$(DOC_TEST_NAMES), \
check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec)
@ -192,7 +206,7 @@ check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach stage,$(STAGES), \
$(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
@ -255,7 +269,7 @@ $(3)/test/rustdoctest.stage$(1)-$(2)$$(X): \
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(foreach stage,$(STAGES), \
$(eval $(call TEST_RUNNER,$(stage),$(target),$(host))))))))
@ -271,7 +285,7 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
&& touch $$@
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach stage,$(STAGES), \
$(foreach crate, $(TEST_CRATES), \
@ -381,7 +395,7 @@ CTEST_DEPS_debuginfo_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_TESTS)
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(foreach stage,$(STAGES), \
$(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host))))))))
@ -423,7 +437,7 @@ endef
CTEST_NAMES = rpass rpass-full rfail cfail bench perf debuginfo
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(foreach stage,$(STAGES), \
$(eval $(foreach name,$(CTEST_NAMES), \
@ -462,7 +476,7 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach stage,$(STAGES), \
$(foreach pretty-name,$(PRETTY_NAMES), \
@ -489,7 +503,7 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): \
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach stage,$(STAGES), \
$(foreach docname,$(DOC_TEST_NAMES), \
@ -511,7 +525,7 @@ doc-$(2)-extract$(1):
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(foreach docname,$(DOC_TEST_NAMES), \
$(eval $(call DEF_DOC_TEST_HOST,$(host),$(docname)))))
@ -546,7 +560,7 @@ endef
$(foreach stage,$(STAGES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP
@ -555,13 +569,13 @@ endef
$(foreach stage,$(STAGES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(foreach group,$(TEST_GROUPS), \
$(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group)))))))
define DEF_CHECK_FOR_STAGE
check-stage$(1): check-stage$(1)-H-$$(CFG_HOST_TRIPLE)
check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET_TRIPLES), \
check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD_TRIPLE)
check-stage$(1)-H-all: $$(foreach target,$$(CFG_HOST_TRIPLES), \
check-stage$(1)-H-$$(target))
endef
@ -569,8 +583,8 @@ $(foreach stage,$(STAGES), \
$(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
define DEF_CHECK_FOR_STAGE_AND_GROUP
check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_HOST_TRIPLE)-$(2)
check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET_TRIPLES), \
check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD_TRIPLE)-$(2)
check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_HOST_TRIPLES), \
check-stage$(1)-H-$$(target)-$(2))
endef
@ -580,25 +594,24 @@ $(foreach stage,$(STAGES), \
define DEF_CHECK_FOR_STAGE_AND_HOSTS
check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET_TRIPLES), \
check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_HOST_TRIPLES), \
check-stage$(1)-T-$$(target)-H-$(2))
endef
$(foreach stage,$(STAGES), \
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host)))))
define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP
check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET_TRIPLES), \
check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_HOST_TRIPLES), \
check-stage$(1)-T-$$(target)-H-$(2)-$(3))
endef
$(foreach stage,$(STAGES), \
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(foreach group,$(TEST_GROUPS), \
$(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group))))))
######################################################################
# check-fast rules
######################################################################
@ -644,11 +657,11 @@ check-fast-T-$(2)-H-$(3): \
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_CHECK_FAST_FOR_T_H,,$(target),$(host))))))
check-fast: tidy check-fast-H-$(CFG_HOST_TRIPLE)
check-fast: tidy check-fast-H-$(CFG_BUILD_TRIPLE)
define DEF_CHECK_FAST_FOR_H
@ -656,6 +669,6 @@ check-fast-H-$(1): check-fast-T-$(1)-H-$(1)
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_CHECK_FAST_FOR_H,$(target))))
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(call DEF_CHECK_FAST_FOR_H,$(host))))

View File

@ -223,13 +223,13 @@ $$(HBIN$(2)_H_$(4))/rust$$(X): \
endef
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call TOOLS_STAGE_N_TARGET,0,1,$(target),$(host))) \
$(eval $(call TOOLS_STAGE_N_TARGET,1,2,$(target),$(host))) \
$(eval $(call TOOLS_STAGE_N_TARGET,2,3,$(target),$(host)))))
$(eval $(call TOOLS_STAGE_N_TARGET,0,1,$(host),$(target))) \
$(eval $(call TOOLS_STAGE_N_TARGET,1,2,$(host),$(target))) \
$(eval $(call TOOLS_STAGE_N_TARGET,2,3,$(host),$(target)))))
$(foreach host,$(CFG_TARGET_TRIPLES), \
$(foreach host,$(CFG_HOST_TRIPLES), \
$(eval $(call TOOLS_STAGE_N_HOST,0,1,$(host),$(host))) \
$(eval $(call TOOLS_STAGE_N_HOST,1,2,$(host),$(host))) \
$(eval $(call TOOLS_STAGE_N_HOST,2,3,$(host),$(host))))

View File

@ -516,11 +516,11 @@ pub fn host_triple() -> ~str {
// FIXME (#2400): Instead of grabbing the host triple we really should
// be grabbing (at compile time) the target triple that this rustc is
// built with and calling that (at runtime) the host triple.
let ht = env!("CFG_HOST_TRIPLE");
let ht = env!("CFG_BUILD_TRIPLE");
return if ht != ~"" {
ht
} else {
fail!(~"rustc built without CFG_HOST_TRIPLE")
fail!(~"rustc built without CFG_BUILD_TRIPLE")
};
}