auto merge of #5264 : brson/rust/cross7, r=brson

Follow up to #5242. All credit to @yichoi.
This commit is contained in:
bors 2013-03-06 23:57:39 -08:00
commit 2bc301fd68
27 changed files with 985 additions and 763 deletions

2
.gitmodules vendored
View File

@ -3,4 +3,4 @@
url = git://github.com/brson/llvm.git
[submodule "src/libuv"]
path = src/libuv
url = git://github.com/joyent/libuv.git
url = git://github.com/brson/libuv.git

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)
@ -124,37 +130,6 @@ else
CFG_VALGRIND_COMPILE :=
endif
CFG_RUNTIME :=$(call CFG_LIB_NAME,rustrt)
CFG_RUSTLLVM :=$(call CFG_LIB_NAME,rustllvm)
CFG_CORELIB :=$(call CFG_LIB_NAME,core)
CFG_STDLIB :=$(call CFG_LIB_NAME,std)
CFG_LIBRUSTC :=$(call CFG_LIB_NAME,rustc)
CFG_LIBSYNTAX :=$(call CFG_LIB_NAME,syntax)
CFG_LIBFUZZER :=$(call CFG_LIB_NAME,fuzzer)
CFG_LIBRUSTPKG :=$(call CFG_LIB_NAME,rustpkg)
CFG_LIBRUSTDOC :=$(call CFG_LIB_NAME,rustdoc)
CFG_LIBRUSTI :=$(call CFG_LIB_NAME,rusti)
CFG_LIBRUST :=$(call CFG_LIB_NAME,rust)
STDLIB_GLOB :=$(call CFG_LIB_GLOB,std)
CORELIB_GLOB :=$(call CFG_LIB_GLOB,core)
LIBRUSTC_GLOB :=$(call CFG_LIB_GLOB,rustc)
LIBSYNTAX_GLOB :=$(call CFG_LIB_GLOB,syntax)
LIBFUZZER_GLOB :=$(call CFG_LIB_GLOB,fuzzer)
LIBRUSTPKG_GLOB :=$(call CFG_LIB_GLOB,rustpkg)
LIBRUSTDOC_GLOB :=$(call CFG_LIB_GLOB,rustdoc)
LIBRUSTI_GLOB :=$(call CFG_LIB_GLOB,rusti)
LIBRUST_GLOB :=$(call CFG_LIB_GLOB,rust)
STDLIB_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,std)
CORELIB_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,core)
LIBRUSTC_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rustc)
LIBSYNTAX_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,syntax)
LIBFUZZER_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,fuzzer)
LIBRUSTPKG_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rustpkg)
LIBRUSTDOC_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rustdoc)
LIBRUSTI_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rusti)
LIBRUST_DSYM_GLOB :=$(call CFG_LIB_DSYM_GLOB,rust)
# version-string calculation
CFG_GIT_DIR := $(CFG_SRC_DIR).git
CFG_RELEASE = 0.6
@ -193,7 +168,12 @@ else
endif
S := $(CFG_SRC_DIR)
X := $(CFG_EXE_SUFFIX)
define DEF_X
X_$(1) := $(CFG_EXE_SUFFIX_$(1))
endef
$(foreach target,$(CFG_TARGET_TRIPLES),\
$(eval $(call DEF_X,$(target))))
# Look in doc and src dirs.
VPATH := $(S)doc $(S)src
@ -209,6 +189,49 @@ GENERATED :=
%:: s.%
%:: SCCS/s.%
######################################################################
# Crates
######################################################################
define DEF_LIBS
CFG_RUNTIME_$(1) :=$(call CFG_LIB_NAME_$(1),rustrt)
CFG_RUSTLLVM_$(1) :=$(call CFG_LIB_NAME_$(1),rustllvm)
CFG_CORELIB_$(1) :=$(call CFG_LIB_NAME_$(1),core)
CFG_STDLIB_$(1) :=$(call CFG_LIB_NAME_$(1),std)
CFG_LIBRUSTC_$(1) :=$(call CFG_LIB_NAME_$(1),rustc)
CFG_LIBSYNTAX_$(1) :=$(call CFG_LIB_NAME_$(1),syntax)
CFG_LIBFUZZER_$(1) :=$(call CFG_LIB_NAME_$(1),fuzzer)
CFG_LIBRUSTPKG_$(1) :=$(call CFG_LIB_NAME_$(1),rustpkg)
CFG_LIBRUSTDOC_$(1) :=$(call CFG_LIB_NAME_$(1),rustdoc)
CFG_LIBRUSTI_$(1) :=$(call CFG_LIB_NAME_$(1),rusti)
CFG_LIBRUST_$(1) :=$(call CFG_LIB_NAME_$(1),rust)
STDLIB_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),std)
CORELIB_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),core)
LIBRUSTC_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustc)
LIBSYNTAX_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),syntax)
LIBFUZZER_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),fuzzer)
LIBRUSTPKG_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustpkg)
LIBRUSTDOC_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rustdoc)
LIBRUSTI_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rusti)
LIBRUST_GLOB_$(1) :=$(call CFG_LIB_GLOB_$(1),rust)
STDLIB_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),std)
CORELIB_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),core)
LIBRUSTC_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustc)
LIBSYNTAX_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),syntax)
LIBFUZZER_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),fuzzer)
LIBRUSTPKG_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustpkg)
LIBRUSTDOC_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rustdoc)
LIBRUSTI_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rusti)
LIBRUST_DSYM_GLOB_$(1) :=$(call CFG_LIB_DSYM_GLOB_$(1),rust)
endef
$(foreach target,$(CFG_TARGET_TRIPLES),\
$(eval $(call DEF_LIBS,$(target))))
######################################################################
# Core library variables
######################################################################
@ -254,8 +277,8 @@ CFG_LLVM_BUILD_DIR_$(1):=$$(CFG_LLVM_BUILD_DIR_$(subst -,_,$(1)))
CFG_LLVM_INST_DIR_$(1):=$$(CFG_LLVM_INST_DIR_$(subst -,_,$(1)))
# Any rules that depend on LLVM should depend on LLVM_CONFIG
LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X)
LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X)
LLVM_CONFIG_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-config$$(X_$(1))
LLVM_MC_$(1):=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-mc$$(X_$(1))
LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
@ -267,13 +290,13 @@ LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
LLVM_CXXFLAGS_$(1)=$$(subst -I, -iquote , $$(shell "$$(LLVM_CONFIG_$(1))" --cxxflags))
LLVM_HOST_TRIPLE_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --host-target)
LLVM_AS_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-as$$(X)
LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X)
LLVM_AS_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llvm-as$$(X_$(1))
LLC_$(1)=$$(CFG_LLVM_INST_DIR_$(1))/bin/llc$$(X_$(1))
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 +308,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
@ -332,26 +355,26 @@ ifdef CFG_DISABLE_SHAREDSTD
$$(TLIB$(1)_T_$(2)_H_$(3))/librustc.rlib
else
HCORELIB_DEFAULT$(1)_H_$(3) = \
$$(HLIB$(1)_H_$(3))/$(CFG_CORELIB)
$$(HLIB$(1)_H_$(3))/$(CFG_CORELIB_$(3))
TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB)
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB_$(2))
HSTDLIB_DEFAULT$(1)_H_$(3) = \
$$(HLIB$(1)_H_$(3))/$(CFG_STDLIB)
$$(HLIB$(1)_H_$(3))/$(CFG_STDLIB_$(3))
TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3) = \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB)
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2))
HLIBRUSTC_DEFAULT$(1)_H_$(3) = \
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTC)
$$(HLIB$(1)_H_$(3))/$(CFG_LIBRUSTC_$(3))
TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3) = \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(2))
endif
# Preqrequisites for using the stageN compiler
HSREQ$(1)_H_$(3) = \
$$(HBIN$(1)_H_$(3))/rustc$$(X) \
$$(HLIB$(1)_H_$(3))/$$(CFG_RUNTIME) \
$$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLLVM) \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
$$(HLIB$(1)_H_$(3))/$(CFG_RUNTIME_$(3)) \
$$(HLIB$(1)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
$$(HCORELIB_DEFAULT$(1)_H_$(3)) \
$$(HSTDLIB_DEFAULT$(1)_H_$(3)) \
$$(HLIBSYNTAX_DEFAULT$(1)_H_$(3)) \
@ -361,37 +384,37 @@ HSREQ$(1)_H_$(3) = \
# Prerequisites for using the stageN compiler to build target artifacts
TSREQ$(1)_T_$(2)_H_$(3) = \
$$(HSREQ$(1)_H_$(3)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUNTIME) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
# Prerequisites for a working stageN compiler and libraries, for a specific target
SREQ$(1)_T_$(2)_H_$(3) = \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB_$(2)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2))
# Prerequisites for a working stageN compiler and libraries, for a specific target
CSREQ$(1)_T_$(2)_H_$(3) = \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
$$(HBIN$(1)_H_$(3))/fuzzer$$(X) \
$$(HBIN$(1)_H_$(3))/rustpkg$$(X) \
$$(HBIN$(1)_H_$(3))/rustdoc$$(X) \
$$(HBIN$(1)_H_$(3))/rusti$$(X) \
$$(HBIN$(1)_H_$(3))/rust$$(X) \
$$(HLIB$(1)_H_$(3))/$$(CFG_LIBFUZZER) \
$$(HLIB$(1)_H_$(3))/$$(CFG_LIBRUSTPKG) \
$$(HLIB$(1)_H_$(3))/$$(CFG_LIBRUSTDOC) \
$$(HLIB$(1)_H_$(3))/$$(CFG_LIBRUSTI) \
$$(HLIB$(1)_H_$(3))/$$(CFG_LIBRUST) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(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compiler under valgrind - that ship has sailed
@ -409,28 +432,30 @@ 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
STAGE$(1)_T_$(2)_H_$(3) := \
$$(Q)$$(call CFG_RUN_TARG,$(1), \
$$(Q)$$(call CFG_RUN_TARG_$(3),$(1), \
$$(CFG_VALGRIND_COMPILE$(1)) \
$$(HBIN$(1)_H_$(3))/rustc$$(X) \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2))
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
$$(RUSTC_FLAGS_$(2))
PERF_STAGE$(1)_T_$(2)_H_$(3) := \
$$(Q)$$(call CFG_RUN_TARG,$(1), \
$$(Q)$$(call CFG_RUN_TARG_$(3),$(1), \
$$(CFG_PERF_TOOL) \
$$(HBIN$(1)_H_$(3))/rustc$$(X) \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
--cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2))
$$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \
$$(RUSTC_FLAGS_$(2))
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 +476,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 +493,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 +514,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

69
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,11 @@ 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"
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
valopt mingw32-cross-path "" "MinGW32 cross compiler path"
# Validate Options
step_msg "validating $CFG_SELF args"
@ -531,11 +534,41 @@ fi
# a little post-processing of various config values
CFG_PREFIX=${CFG_PREFIX%/}
CFG_HOST_TRIPLES="$(echo $CFG_HOST_TRIPLES | tr ',' ' ')"
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
# copy host-triples to target-triples so that hosts are a subset of targets
V_TEMP=""
for i in $CFG_HOST_TRIPLES $CFG_TARGET_TRIPLES;
do
echo "$V_TEMP" | grep -qF $i || V_TEMP="$V_TEMP${V_TEMP:+ }$i"
done
CFG_TARGET_TRIPLES=$V_TEMP
# check target-specific tool-chains
for i in $CFG_TARGET_TRIPLES
do
case $i in
arm-unknown-android)
if [ ! -f $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-gcc ]
then
err "NDK $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-gcc not found"
fi
if [ ! -f $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-g++ ]
then
err "NDK $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-g++ not found"
fi
if [ ! -f $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-ar ]
then
err "NDK $CFG_ANDROID_CROSS_PATH/bin/arm-linux-androideabi-ar not found"
fi
;;
*)
;;
esac
done
if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
then
@ -562,13 +595,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
@ -577,9 +610,10 @@ make_dir rt
for t in $CFG_TARGET_TRIPLES
do
make_dir rt/$t
for i in \
isaac linenoise sync test libuv libuv/src \
arch/i386 arch/x86_64 arch/arm arch/mips
for i in \
isaac linenoise sync test \
arch/i386 arch/x86_64 arch/arm arch/mips \
libuv libuv/src/ares libuv/src/eio libuv/src/ev
do
make_dir rt/$t/$i
done
@ -587,13 +621,14 @@ done
# On windows we just store the libraries in the bin directory because
# there's no rpath
# FIXME: Thise needs to parameterized over target triples. Do it in platform.mk
CFG_LIBDIR=lib
if [ "$CFG_OSTYPE" = "pc-mingw32" ]
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 +704,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,10 +854,14 @@ 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
putvar CFG_DISABLE_MANAGE_SUBMODULES
putvar CFG_ANDROID_CROSS_PATH
putvar CFG_MINGW32_CROSS_PATH
if [ ! -z "$CFG_ENABLE_PAX_FLAGS" ]
then
@ -854,7 +893,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)
@ -62,77 +62,83 @@ clean-misc:
define CLEAN_HOST_STAGE_N
clean$(1)_H_$(2):
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustc$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/fuzzer$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustpkg$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/serializer$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rustdoc$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rusti$(X)
$(Q)rm -f $$(HBIN$(1)_H_$(2))/rust$(X)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBFUZZER)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTPKG)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTDOC)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUNTIME)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_CORELIB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_STDLIB)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTC)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBSYNTAX)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTI)
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(C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))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTC_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBSYNTAX_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUSTI_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_LIBRUST_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CORELIB_GLOB_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(STDLIB_GLOB_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTC_GLOB_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBSYNTAX_GLOB_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBFUZZER_GLOB_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTPKG_GLOB_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTDOC_GLOB_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUSTI_GLOB_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(LIBRUST_GLOB_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/$(CFG_RUSTLLVM_$(2))
$(Q)rm -f $$(HLIB$(1)_H_$(2))/libstd.rlib
endef
$(foreach host, $(CFG_TARGET_TRIPLES), \
$(foreach host, $(CFG_HOST_TRIPLES), \
$(eval $(foreach stage, $(STAGES), \
$(eval $(call CLEAN_HOST_STAGE_N,$(stage),$(host))))))
define CLEAN_TARGET_STAGE_N
clean$(1)_T_$(2)_H_$(3):
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$(X)
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/fuzzer$(X)
$(Q)rm -f $$(TBIN$(1)_T_$(2)_H_$(3))/rustpkg$(X)
$(Q)rm -f $$(TBIN$(1)_T_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$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTPKG_GLOB_$(2))
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTDOC_GLOB_$(2))
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUSTI_GLOB_$(2))
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(LIBRUST_GLOB_$(2))
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(2))
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libstd.rlib
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix
$(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 +148,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

@ -83,7 +83,7 @@ $(PKG_TAR): $(PKG_FILES)
.PHONY: dist distcheck
ifdef CFG_WINDOWSY
ifdef CFG_WINDOWSY_$(CFG_BUILD_TRIPLE)
dist: $(PKG_EXE)

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_$(CFG_BUILD_TRIPLE))
# The library documenting macro
# $(1) - The output directory

View File

@ -21,49 +21,51 @@ define CP_HOST_STAGE_N
# Host libraries and executables (stage$(2)/bin/rustc and its runtime needs)
$$(HBIN$(2)_H_$(4))/rustc$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/rustc$$(X) \
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME) \
$$(HLIB$(2)_H_$(4))/$$(CFG_RUSTLLVM) \
$$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUSTC) \
# Note: $(3) and $(4) are both the same!
$$(HBIN$(2)_H_$(4))/rustc$$(X_$(4)): \
$$(TBIN$(1)_T_$(4)_H_$(3))/rustc$$(X_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)) \
$$(HCORELIB_DEFAULT$(2)_H_$(4)) \
$$(HSTDLIB_DEFAULT$(2)_H_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUSTC): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC) \
$$(HLIB$(2)_H_$(4))/$$(CFG_LIBSYNTAX) \
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME) \
$$(HLIB$(2)_H_$(4))/$$(CFG_RUSTLLVM) \
$$(HCORELIB_DEFAULT$(2)_H_$(3)) \
$$(HSTDLIB_DEFAULT$(2)_H_$(3))
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST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_$(3))/$(LIBSYNTAX_DSYM_GLOB)) \
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBSYNTAX_GLOB_$(4)) \
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBSYNTAX_DSYM_GLOB_$(4))) \
$$(HLIB$(2)_H_$(4))
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_RUNTIME)
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4)): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUNTIME_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(HLIB$(2)_H_$(4))/$$(CFG_CORELIB): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
$$(HLIB$(2)_H_$(4))/$(CFG_CORELIB_$(4)): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_CORELIB_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
# Subtle: We do not let the shell expand $(CORELIB_DSYM_GLOB) directly rather
@ -73,30 +75,30 @@ $$(HLIB$(2)_H_$(4))/$$(CFG_CORELIB): \
# glob, and cp reports an error because libcore-*.dylib.dsym does not exist.
# Make instead expands the glob to nothing, which gives us the correct behavior.
# (Copy .dsym file if it exists, but do nothing otherwise)
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(CORELIB_GLOB) \
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(CORELIB_DSYM_GLOB)) \
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(CORELIB_GLOB_$(4)) \
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(CORELIB_DSYM_GLOB_$(4))) \
$$(HLIB$(2)_H_$(4))
$$(HLIB$(2)_H_$(4))/$$(CFG_STDLIB): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
$$(HLIB$(2)_H_$(4))/$$(CFG_CORELIB) \
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
$$(HLIB$(2)_H_$(4))/$(CFG_STDLIB_$(4)): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_CORELIB_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_RUNTIME_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_GLOB) \
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_DSYM_GLOB)) \
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_GLOB_$(4)) \
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(STDLIB_DSYM_GLOB_$(4))) \
$$(HLIB$(2)_H_$(4))
$$(HLIB$(2)_H_$(4))/libcore.rlib: \
$$(TLIB$(1)_T_$(4)_H_$(3))/libcore.rlib \
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(HLIB$(2)_H_$(4))/libstd.rlib: \
$$(TLIB$(1)_T_$(4)_H_$(3))/libstd.rlib \
$$(HLIB$(2)_H_$(4))/libcore.rlib \
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
@ -104,18 +106,18 @@ $$(HLIB$(2)_H_$(4))/librustc.rlib: \
$$(TLIB$(1)_T_$(4)_H_$(3))/librustc.rlib \
$$(HLIB$(2)_H_$(4))/libcore.rlib \
$$(HLIB$(2)_H_$(4))/libstd.rlib \
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME)
$$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(HLIB$(2)_H_$(4))/$$(CFG_RUSTLLVM): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_RUSTLLVM)
$$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_RUSTLLVM_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
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

@ -30,7 +30,7 @@ PREFIX_ROOT = $(CFG_PREFIX)
PREFIX_BIN = $(PREFIX_ROOT)/bin
PREFIX_LIB = $(PREFIX_ROOT)/$(CFG_LIBDIR)
define INSTALL_TARGET_N
define INSTALL_PREPARE_N
# $(1) is the target triple
# $(2) is the host triple
@ -43,69 +43,89 @@ PTR$(1)$(2) = $$(PREFIX_LIB)/rustc/$(1)
PTB$(1)$(2) = $$(PTR$(1)$(2))/bin
PTL$(1)$(2) = $$(PTR$(1)$(2))/$(CFG_LIBDIR)
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call INSTALL_PREPARE_N,$(target),$(CFG_BUILD_TRIPLE))))
define INSTALL_TARGET_N
install-target-$(1)-host-$(2): $$(TSREQ$$(ISTAGE)_T_$(1)_H_$(2)) $$(SREQ$$(ISTAGE)_T_$(1)_H_$(2))
$$(Q)mkdir -p $$(PTL$(1)$(2))
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME_$(1)))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CORELIB_GLOB_$(1)))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(STDLIB_GLOB_$(1)))
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
endef
define INSTALL_HOST_N
install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
$$(Q)mkdir -p $$(PTL$(1)$(2))
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME))
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CFG_RUNTIME_$(1)))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CORELIB_GLOB))
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(CORELIB_GLOB_$(1)))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(STDLIB_GLOB))
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(STDLIB_GLOB_$(1)))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTC_GLOB))
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTC_GLOB_$(1)))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBSYNTAX_GLOB))
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBSYNTAX_GLOB_$(1)))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTPKG_GLOB))
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTPKG_GLOB_$(1)))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTDOC_GLOB))
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTDOC_GLOB_$(1)))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTI_GLOB))
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUSTI_GLOB_$(1)))
$$(Q)$$(call INSTALL_LIB, \
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUST_GLOB))
$$(TL$(1)$(2)),$$(PTL$(1)$(2)),$$(LIBRUST_GLOB_$(1)))
$$(Q)$$(call INSTALL,$$(TL$(1)$(2)),$$(PTL$(1)$(2)),libmorestack.a)
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call INSTALL_TARGET_N,$(target),$(CFG_HOST_TRIPLE))))
$(if $(findstring $(target), $(CFG_BUILD_TRIPLE)), \
$(eval $(call INSTALL_HOST_N,$(target),$(CFG_BUILD_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
$(Q)$(call INSTALL,$(HB2),$(PHB),rustc$(X))
$(Q)$(call INSTALL,$(HB2),$(PHB),rustpkg$(X))
$(Q)$(call INSTALL,$(HB2),$(PHB),rustdoc$(X))
$(Q)$(call INSTALL,$(HB2),$(PHB),rusti$(X))
$(Q)$(call INSTALL,$(HB2),$(PHB),rust$(X))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTC))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTPKG))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTDOC))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTI))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUST))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(CORELIB_GLOB))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(STDLIB_GLOB))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTC_GLOB))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBSYNTAX_GLOB))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTI_GLOB))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUST_GLOB))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUNTIME))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM))
$(Q)$(call INSTALL,$(HB2),$(PHB),rustc$(X_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HB2),$(PHB),rustpkg$(X_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HB2),$(PHB),rustdoc$(X_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HB2),$(PHB),rusti$(X_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HB2),$(PHB),rust$(X_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTC_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTPKG_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTDOC_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUSTI_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_LIBRUST_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(CORELIB_GLOB_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(STDLIB_GLOB_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTC_GLOB_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBSYNTAX_GLOB_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUSTI_GLOB_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL_LIB,$(HL),$(PHL),$(LIBRUST_GLOB_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUNTIME_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(HL),$(PHL),$(CFG_RUSTLLVM_$(CFG_BUILD_TRIPLE)))
$(Q)$(call INSTALL,$(S)/man, \
$(PREFIX_ROOT)/share/man/man1,rustc.1)
@ -116,27 +136,27 @@ HOST_LIB_FROM_HL_GLOB = \
$(patsubst $(HL)/%,$(PHL)/%,$(wildcard $(HL)/$(1)))
uninstall:
$(Q)rm -f $(PHB)/rustc$(X)
$(Q)rm -f $(PHB)/rustpkg$(X)
$(Q)rm -f $(PHB)/rusti$(X)
$(Q)rm -f $(PHB)/rust$(X)
$(Q)rm -f $(PHB)/rustdoc$(X)
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM)
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTPKG)
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTC)
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTDOC)
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTI)
$(Q)rm -f $(PHL)/$(CFG_LIBRUST)
$(Q)rm -f $(PHL)/$(CFG_RUNTIME)
$(Q)rm -f $(PHB)/rustc$(X_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHB)/rustpkg$(X_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHB)/rusti$(X_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHB)/rust$(X_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHB)/rustdoc$(X_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHL)/$(CFG_RUSTLLVM_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTPKG_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTC_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTDOC_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHL)/$(CFG_LIBRUSTI_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHL)/$(CFG_LIBRUST_$(CFG_BUILD_TRIPLE))
$(Q)rm -f $(PHL)/$(CFG_RUNTIME_$(CFG_BUILD_TRIPLE))
$(Q)for i in \
$(call HOST_LIB_FROM_HL_GLOB,$(CORELIB_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTC_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBSYNTAX_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTPKG_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTDOC_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTI_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUST_GLOB)) \
$(call HOST_LIB_FROM_HL_GLOB,$(CORELIB_GLOB_$(CFG_BUILD_TRIPLE))) \
$(call HOST_LIB_FROM_HL_GLOB,$(STDLIB_GLOB_$(CFG_BUILD_TRIPLE))) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTC_GLOB_$(CFG_BUILD_TRIPLE))) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBSYNTAX_GLOB_$(CFG_BUILD_TRIPLE))) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTPKG_GLOB_$(CFG_BUILD_TRIPLE))) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTDOC_GLOB_$(CFG_BUILD_TRIPLE))) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUSTI_GLOB_$(CFG_BUILD_TRIPLE))) \
$(call HOST_LIB_FROM_HL_GLOB,$(LIBRUST_GLOB_$(CFG_BUILD_TRIPLE))) \
; \
do rm -f $$i ; \
done

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_$(CFG_BUILD_TRIPLE))
@$(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_$(CFG_BUILD_TRIPLE))
$(Q)touch $@
endif
perf: check-stage2-perf rustc-perf$(X)
$(Q)find $(CFG_HOST_TRIPLE)/test/perf -name \*.err | xargs cat
perf: check-stage2-perf rustc-perf$(X_$(CFG_BUILD_TRIPLE))
$(Q)find $(CFG_BUILD_TRIPLE)/test/perf -name \*.err | xargs cat
$(Q)cat rustc-perf.err

View File

@ -19,6 +19,13 @@ endef
$(foreach t,$(CFG_TARGET_TRIPLES),$(eval $(call DEF_HOST_VAR,$(t))))
$(foreach t,$(CFG_TARGET_TRIPLES),$(info cfg: host for $(t) is $(HOST_$(t))))
# Ditto for OSTYPE
define DEF_OSTYPE_VAR
OSTYPE_$(1) = $(subst $(firstword $(subst -, ,$(1)))-,,$(1))
endef
$(foreach t,$(CFG_TARGET_TRIPLES),$(eval $(call DEF_OSTYPE_VAR,$(t))))
$(foreach t,$(CFG_TARGET_TRIPLES),$(info cfg: os for $(t) is $(OSTYPE_$(t))))
# FIXME: no-omit-frame-pointer is just so that task_start_wrapper
# has a frame pointer and the stack walker can understand it. Turning off
# frame pointers everywhere is overkill
@ -29,47 +36,33 @@ CFG_GCCISH_CFLAGS += -fno-omit-frame-pointer
# embedded into the executable, so use a no-op command.
CFG_DSYMUTIL := true
# Add a dSYM glob for all platforms, even though it will do nothing on
# non-Darwin platforms; omitting it causes a full -R copy of lib/
CFG_LIB_DSYM_GLOB=lib$(1)-*.dylib.dSYM
# Hack: not sure how to test if a file exists in make other than this
OS_SUPP = $(patsubst %,--suppressions=%,\
$(wildcard $(CFG_SRC_DIR)src/etc/$(CFG_OSTYPE).supp*))
ifneq ($(findstring freebsd,$(CFG_OSTYPE)),)
CFG_LIB_NAME=lib$(1).so
CFG_LIB_GLOB=lib$(1)-*.so
CFG_GCCISH_CFLAGS += -fPIC -I/usr/local/include
CFG_GCCISH_LINK_FLAGS += -shared -fPIC -lpthread -lrt
CFG_GCCISH_DEF_FLAG := -Wl,--export-dynamic,--dynamic-list=
CFG_GCCISH_PRE_LIB_FLAGS := -Wl,-whole-archive
CFG_GCCISH_POST_LIB_FLAGS := -Wl,-no-whole-archive
CFG_GCCISH_CFLAGS_i386 += -m32
CFG_GCCISH_LINK_FLAGS_i386 += -m32
CFG_GCCISH_CFLAGS_x86_64 += -m64
CFG_GCCISH_LINK_FLAGS_x86_64 += -m64
CFG_UNIXY := 1
CFG_FBSD := 1
CFG_LDENV := LD_LIBRARY_PATH
CFG_DEF_SUFFIX := .bsd.def
CFG_INSTALL_NAME =
CFG_PERF_TOOL := /usr/bin/time
ifdef CFG_DISABLE_OPTIMIZE_CXX
$(info cfg: disabling C++ optimization (CFG_DISABLE_OPTIMIZE_CXX))
CFG_GCCISH_CFLAGS += -O0
else
CFG_GCCISH_CFLAGS += -O2
endif
ifdef CFG_VALGRIND
CFG_VALGRIND += --error-exitcode=100 \
--quiet \
--suppressions=$(CFG_SRC_DIR)src/etc/x86.supp \
$(OS_SUPP)
ifdef CFG_ENABLE_HELGRIND
CFG_VALGRIND += --tool=helgrind
else
CFG_VALGRIND += --tool=memcheck \
--leak-check=full
endif
endif
ifneq ($(findstring linux,$(CFG_OSTYPE)),)
CFG_LIB_NAME=lib$(1).so
CFG_LIB_GLOB=lib$(1)-*.so
CFG_GCCISH_CFLAGS += -fPIC
CFG_GCCISH_LINK_FLAGS += -shared -fPIC -ldl -lpthread -lrt
CFG_GCCISH_DEF_FLAG := -Wl,--export-dynamic,--dynamic-list=
CFG_GCCISH_PRE_LIB_FLAGS := -Wl,-whole-archive
# -znoexecstack is here because librt is for some reason being created
# with executable stack and Fedora (or SELinux) doesn't like that (#798)
CFG_GCCISH_POST_LIB_FLAGS := -Wl,-no-whole-archive -Wl,-znoexecstack
CFG_GCCISH_CFLAGS_i386 = -m32
CFG_GCCISH_LINK_FLAGS_i386 = -m32
CFG_GCCISH_CFLAGS_x86_64 = -m64
CFG_GCCISH_LINK_FLAGS_x86_64 = -m64
CFG_UNIXY := 1
CFG_LDENV := LD_LIBRARY_PATH
CFG_DEF_SUFFIX := .linux.def
ifdef CFG_PERF
ifneq ($(CFG_PERF_WITH_LOGFD),)
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3 --log-fd 2
@ -84,136 +77,13 @@ ifneq ($(findstring linux,$(CFG_OSTYPE)),)
CFG_PERF_TOOL := /usr/bin/time --verbose
endif
endif
CFG_INSTALL_NAME =
# Linux requires LLVM to be built like this to get backtraces into Rust code
CFG_LLVM_BUILD_ENV="CXXFLAGS=-fno-omit-frame-pointer"
endif
ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
CFG_LIB_NAME=lib$(1).dylib
CFG_LIB_GLOB=lib$(1)-*.dylib
CFG_UNIXY := 1
CFG_LDENV := DYLD_LIBRARY_PATH
CFG_GCCISH_LINK_FLAGS += -dynamiclib -lpthread -framework CoreServices -Wl,-no_compact_unwind
CFG_GCCISH_DEF_FLAG := -Wl,-exported_symbols_list,
# Darwin has a very blurry notion of "64 bit", and claims it's running
# "on an i386" when the whole userspace is 64-bit and the compiler
# emits 64-bit binaries by default. So we just force -m32 here. Smarter
# approaches welcome!
#
# NB: Currently GCC's optimizer breaks rustrt (task-comm-1 hangs) on Darwin.
CFG_GCCISH_CFLAGS_i386 := -m32 -arch i386
CFG_GCCISH_CFLAGS_x86_64 := -m64 -arch x86_64
CFG_GCCISH_LINK_FLAGS_i386 := -m32
CFG_GCCISH_LINK_FLAGS_x86_64 := -m64
CFG_DSYMUTIL := dsymutil
CFG_DEF_SUFFIX := .darwin.def
# Mac requires this flag to make rpath work
CFG_INSTALL_NAME = -Wl,-install_name,@rpath/$(1)
endif
# Hack: not sure how to test if a file exists in make other than this
OS_SUPP = $(patsubst %,--suppressions=%,\
$(wildcard $(CFG_SRC_DIR)src/etc/$(CFG_OSTYPE).supp*))
ifneq ($(findstring mingw,$(CFG_OSTYPE)),)
CFG_WINDOWSY := 1
endif
ifdef CFG_DISABLE_OPTIMIZE_CXX
$(info cfg: disabling C++ optimization (CFG_DISABLE_OPTIMIZE_CXX))
CFG_GCCISH_CFLAGS += -O0
else
CFG_GCCISH_CFLAGS += -O2
endif
CFG_TESTLIB=$(CFG_BUILD_DIR)/$(2)/$(strip \
$(if $(findstring stage0,$(1)), \
stage0/$(CFG_LIBDIR), \
$(if $(findstring stage1,$(1)), \
stage1/$(CFG_LIBDIR), \
$(if $(findstring stage2,$(1)), \
stage2/$(CFG_LIBDIR), \
$(if $(findstring stage3,$(1)), \
stage3/$(CFG_LIBDIR), \
)))))/rustc/$(CFG_HOST_TRIPLE)/$(CFG_LIBDIR)
ifdef CFG_UNIXY
CFG_INFO := $(info cfg: unix-y environment)
CFG_PATH_MUNGE := true
CFG_EXE_SUFFIX :=
CFG_LDPATH :=
CFG_RUN=$(2)
CFG_RUN_TARG=$(call CFG_RUN,,$(2))
CFG_RUN_TEST=$(call CFG_RUN,,$(CFG_VALGRIND) $(1))
CFG_LIBUV_LINK_FLAGS=-lpthread
ifdef CFG_FBSD
CFG_LIBUV_LINK_FLAGS=-lpthread -lkvm
endif
ifdef CFG_ENABLE_MINGW_CROSS
CFG_WINDOWSY := 1
CFG_INFO := $(info cfg: mingw-cross)
CFG_GCCISH_CROSS := i586-mingw32msvc-
ifdef CFG_VALGRIND
CFG_VALGRIND += wine
endif
CFG_GCCISH_CFLAGS := -march=i586
CFG_GCCISH_PRE_LIB_FLAGS :=
CFG_GCCISH_POST_LIB_FLAGS :=
CFG_GCCISH_DEF_FLAG :=
CFG_GCCISH_LINK_FLAGS := -shared
ifeq ($(CFG_CPUTYPE), x86_64)
CFG_GCCISH_CFLAGS += -m32
CFG_GCCISH_LINK_FLAGS += -m32
endif
endif
ifdef CFG_VALGRIND
CFG_VALGRIND += --error-exitcode=100 \
--quiet \
--suppressions=$(CFG_SRC_DIR)src/etc/x86.supp \
$(OS_SUPP)
ifdef CFG_ENABLE_HELGRIND
CFG_VALGRIND += --tool=helgrind
else
CFG_VALGRIND += --tool=memcheck \
--leak-check=full
endif
endif
endif
ifdef CFG_WINDOWSY
CFG_INFO := $(info cfg: windows-y environment)
CFG_EXE_SUFFIX := .exe
CFG_LIB_NAME=$(1).dll
CFG_LIB_GLOB=$(1)-*.dll
CFG_DEF_SUFFIX := .def
ifdef MSYSTEM
CFG_LDPATH :=$(CFG_LDPATH):$$PATH
CFG_RUN=PATH="$(CFG_LDPATH):$(1)" $(2)
else
CFG_LDPATH :=
CFG_RUN=$(2)
endif
CFG_RUN_TARG=$(call CFG_RUN,$(HLIB$(1)_H_$(CFG_HOST_TRIPLE)),$(2))
CFG_RUN_TEST=$(call CFG_RUN,$(call CFG_TESTLIB,$(1),$(3)),$(1))
CFG_LIBUV_LINK_FLAGS=-lWs2_32 -lpsapi -liphlpapi
ifndef CFG_ENABLE_MINGW_CROSS
CFG_PATH_MUNGE := $(strip perl -i.bak -p \
-e 's@\\(\S)@/\1@go;' \
-e 's@^/([a-zA-Z])/@\1:/@o;')
CFG_GCCISH_CFLAGS += -march=i686
CFG_GCCISH_LINK_FLAGS += -shared -fPIC
endif
CFG_INSTALL_NAME =
endif
# These flags will cause the compiler to produce a .d file
# next to the .o file that lists header deps.
CFG_DEPEND_FLAGS = -MMD -MP -MT $(1) -MF $(1:%.o=%.d)
AR := ar
CFG_INFO := $(info cfg: using $(CFG_C_COMPILER))
ifeq ($(CFG_C_COMPILER),clang)
@ -224,43 +94,8 @@ ifeq ($(CFG_C_COMPILER),clang)
CXX=clang++
endif
ifeq ($(origin CPP),default)
CPP=clang -E
CPP=clang
endif
CFG_GCCISH_CFLAGS += -Wall -Werror -g
CFG_GCCISH_CXXFLAGS += -fno-rtti
CFG_GCCISH_LINK_FLAGS += -g
# These flags will cause the compiler to produce a .d file
# next to the .o file that lists header deps.
CFG_DEPEND_FLAGS = -MMD -MP -MT $(1) -MF $(1:%.o=%.d)
define CFG_MAKE_CC
CFG_COMPILE_C_$(1) = $$(CFG_GCCISH_CROSS)$$(CC) \
$$(CFG_GCCISH_CFLAGS) $$(CFG_CLANG_CFLAGS) \
$$(CFG_GCCISH_CFLAGS_$$(HOST_$(1))) \
$$(CFG_CLANG_CFLAGS_$$(HOST_$(1))) \
$$(CFG_DEPEND_FLAGS) \
-c -o $$(1) $$(2)
CFG_LINK_C_$(1) = $$(CFG_GCCISH_CROSS)$$(CC) \
$$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
$$(CFG_GCCISH_LINK_FLAGS_$$(HOST_$(1))) \
$$(CFG_GCCISH_DEF_FLAG)$$(3) $$(2) \
$$(call CFG_INSTALL_NAME,$$(4))
CFG_COMPILE_CXX_$(1) = $$(CFG_GCCISH_CROSS)$$(CXX) \
$$(CFG_GCCISH_CFLAGS) $$(CFG_CLANG_CFLAGS) \
$$(CFG_GCCISH_CXXFLAGS) \
$$(CFG_GCCISH_CFLAGS_$$(HOST_$(1))) \
$$(CFG_CLANG_CFLAGS_$$(HOST_$(1))) \
$$(CFG_DEPEND_FLAGS) \
-c -o $$(1) $$(2)
CFG_LINK_CXX_$(1) = $$(CFG_GCCISH_CROSS)$$(CXX) \
$$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
$$(CFG_GCCISH_LINK_FLAGS_$$(HOST_$(1))) \
$$(CFG_GCCISH_DEF_FLAG)$$(3) $$(2) \
$$(call CFG_INSTALL_NAME,$$(4))
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call CFG_MAKE_CC,$(target))))
else
ifeq ($(CFG_C_COMPILER),gcc)
ifeq ($(origin CC),default)
@ -270,60 +105,262 @@ ifeq ($(CFG_C_COMPILER),gcc)
CXX=g++
endif
ifeq ($(origin CPP),default)
CPP=gcc -E
CPP=gcc
endif
CFG_GCCISH_CFLAGS += -Wall -Werror -g
CFG_GCCISH_CXXFLAGS += -fno-rtti
CFG_GCCISH_LINK_FLAGS += -g
# These flags will cause the compiler to produce a .d file
# next to the .o file that lists header deps.
CFG_DEPEND_FLAGS = -MMD -MP -MT $(1) -MF $(1:%.o=%.d)
define CFG_MAKE_CC
CFG_COMPILE_C_$(1) = $$(CFG_GCCISH_CROSS)$$(CC) \
$$(CFG_GCCISH_CFLAGS) \
$$(CFG_GCCISH_CFLAGS_$$(HOST_$(1))) \
$$(CFG_GCC_CFLAGS) \
$$(CFG_GCC_CFLAGS_$$(HOST_$(1))) \
$$(CFG_DEPEND_FLAGS) \
-c -o $$(1) $$(2)
CFG_LINK_C_$(1) = $$(CFG_GCCISH_CROSS)$$(CC) \
$$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
$$(CFG_GCCISH_LINK_FLAGS_$$(HOST_$(1))) \
$$(CFG_GCCISH_DEF_FLAG)$$(3) $$(2) \
$$(call CFG_INSTALL_NAME,$$(4))
CFG_COMPILE_CXX_$(1) = $$(CFG_GCCISH_CROSS)$$(CXX) \
$$(CFG_GCCISH_CFLAGS) \
$$(CFG_GCCISH_CXXFLAGS) \
$$(CFG_GCCISH_CFLAGS_$$(HOST_$(1))) \
$$(CFG_GCC_CFLAGS) \
$$(CFG_GCC_CFLAGS_$$(HOST_$(1))) \
$$(CFG_DEPEND_FLAGS) \
-c -o $$(1) $$(2)
CFG_LINK_CXX_$(1) = $$(CFG_GCCISH_CROSS)$$(CXX) \
$$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
$$(CFG_GCCISH_LINK_FLAGS_$$(HOST_$(1))) \
$$(CFG_GCCISH_DEF_FLAG)$$(3) $$(2) \
$$(call CFG_INSTALL_NAME,$$(4))
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call CFG_MAKE_CC,$(target))))
else
CFG_ERR := $(error please try on a system with gcc or clang)
endif
endif
# We're using llvm-mc as our assembler because it supports
# .cfi pseudo-ops on mac
define CFG_MAKE_ASSEMBLER
CFG_ASSEMBLE_$(1)=$$(CPP) $$(CFG_DEPEND_FLAGS) $$(2) | \
$$(LLVM_MC_$$(CFG_HOST_TRIPLE)) \
# x86_64-unknown-linux-gnu configuration
CC_x86_64-unknown-linux-gnu=$(CC)
CXX_x86_64-unknown-linux-gnu=$(CXX)
CPP_x86_64-unknown-linux-gnu=$(CPP)
AR_x86_64-unknown-linux-gnu=$(AR)
CFG_LIB_NAME_x86_64-unknown-linux-gnu=lib$(1).so
CFG_LIB_GLOB_x86_64-unknown-linux-gnu=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_x86_64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
CFG_GCCISH_CFLAGS_x86_64-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64
CFG_GCCISH_CXXFLAGS_x86_64-unknown-linux-gnu := -fno-rtti
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-linux-gnu := -shared -fPIC -ldl -lpthread -lrt -g -m64
CFG_GCCISH_DEF_FLAG_x86_64-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-linux-gnu := -Wl,-whole-archive
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-linux-gnu := -Wl,-no-whole-archive -Wl,-znoexecstack
CFG_DEF_SUFFIX_x86_64-unknown-linux-gnu := .linux.def
CFG_INSTALL_NAME_x86_64-unknown-linux-gnu =
CFG_LIBUV_LINK_FLAGS_x86_64-unknown-linux-gnu =
CFG_LLVM_BUILD_ENV_x86_64-unknown-linux-gnu="CXXFLAGS=-fno-omit-frame-pointer"
CFG_EXE_SUFFIX_x86_64-unknown-linux-gnu =
CFG_WINDOWSY_x86_64-unknown-linux-gnu :=
CFG_UNIXY_x86_64-unknown-linux-gnu := 1
CFG_PATH_MUNGE_x86_64-unknown-linux-gnu := true
CFG_LDPATH_x86_64-unknown-linux-gnu :=
CFG_RUN_x86_64-unknown-linux-gnu=$(2)
CFG_RUN_TARG_x86_64-unknown-linux-gnu=$(call CFG_RUN_x86_64-unknown-linux-gnu,,$(2))
# i686-unknown-linux-gnu configuration
CC_i686-unknown-linux-gnu=$(CC)
CXX_i686-unknown-linux-gnu=$(CXX)
CPP_i686-unknown-linux-gnu=$(CPP)
AR_i686-unknown-linux-gnu=$(AR)
CFG_LIB_NAME_i686-unknown-linux-gnu=lib$(1).so
CFG_LIB_GLOB_i686-unknown-linux-gnu=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_i686-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
CFG_GCCISH_CFLAGS_i686-unknown-linux-gnu := -Wall -Werror -g -fPIC -m32
CFG_GCCISH_CXXFLAGS_i686-unknown-linux-gnu := -fno-rtti
CFG_GCCISH_LINK_FLAGS_i686-unknown-linux-gnu := -shared -fPIC -ldl -lpthread -lrt -g -m32
CFG_GCCISH_DEF_FLAG_i686-unknown-linux-gnu := -Wl,--export-dynamic,--dynamic-list=
CFG_GCCISH_PRE_LIB_FLAGS_i686-unknown-linux-gnu := -Wl,-whole-archive
CFG_GCCISH_POST_LIB_FLAGS_i686-unknown-linux-gnu := -Wl,-no-whole-archive -Wl,-znoexecstack
CFG_DEF_SUFFIX_i686-unknown-linux-gnu := .linux.def
CFG_INSTALL_NAME_i686-unknown-linux-gnu =
CFG_LIBUV_LINK_FLAGS_i686-unknown-linux-gnu =
CFG_LLVM_BUILD_ENV_i686-unknown-linux-gnu="CXXFLAGS=-fno-omit-frame-pointer"
CFG_EXE_SUFFIX_i686-unknown-linux-gnu =
CFG_WINDOWSY_i686-unknown-linux-gnu :=
CFG_UNIXY_i686-unknown-linux-gnu := 1
CFG_PATH_MUNGE_i686-unknown-linux-gnu := true
CFG_LDPATH_i686-unknown-linux-gnu :=
CFG_RUN_i686-unknown-linux-gnu=$(2)
CFG_RUN_TARG_i686-unknown-linux-gnu=$(call CFG_RUN_i686-unknown-linux-gnu,,$(2))
# x86_64-apple-darwin configuration
CC_x86_64-apple-darwin=$(CC)
CXX_x86_64-apple-darwin=$(CXX)
CPP_x86_64-apple-darwin=$(CPP)
AR_x86_64-apple-darwin=$(AR)
CFG_LIB_NAME_x86_64-apple-darwin=lib$(1).dylib
CFG_LIB_GLOB_x86_64-apple-darwin=lib$(1)-*.dylib
CFG_LIB_DSYM_GLOB_x86_64-apple-darwin=lib$(1)-*.dylib.dSYM
CFG_GCCISH_CFLAGS_x86_64-apple-darwin := -Wall -Werror -g -fPIC -m64 -arch x86_64
CFG_GCCISH_CXXFLAGS_x86_64-apple-darwin := -fno-rtti
CFG_GCCISH_LINK_FLAGS_x86_64-apple-darwin := -dynamiclib -lpthread -framework CoreServices -Wl,-no_compact_unwind -m64
CFG_GCCISH_DEF_FLAG_x86_64-apple-darwin := -Wl,-exported_symbols_list,
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-apple-darwin :=
CFG_GCCISH_POST_LIB_FLAGS_x86_64-apple-darwin :=
CFG_DEF_SUFFIX_x86_64-apple-darwin := .darwin.def
CFG_INSTALL_NAME_x86_64-apple-darwin = -Wl,-install_name,@rpath/$(1)
CFG_LIBUV_LINK_FLAGS_x86_64-apple-darwin =
CFG_EXE_SUFFIX_x86_64-apple-darwin :=
CFG_WINDOWSY_x86_64-apple-darwin :=
CFG_UNIXY_x86_64-apple-darwin := 1
CFG_PATH_MUNGE_x86_64-apple-darwin := true
CFG_LDPATH_x86_64-apple-darwin :=
CFG_RUN_x86_64-apple-darwin=$(2)
CFG_RUN_TARG_x86_64-apple-darwin=$(call CFG_RUN_x86_64-apple-darwin,,$(2))
# i686-apple-darwin configuration
CC_i686-apple-darwin=$(CC)
CXX_i686-apple-darwin=$(CXX)
CPP_i686-apple-darwin=$(CPP)
AR_i686-apple-darwin=$(AR)
CFG_LIB_NAME_i686-apple-darwin=lib$(1).dylib
CFG_LIB_GLOB_i686-apple-darwin=lib$(1)-*.dylib
CFG_LIB_DSYM_GLOB_i686-apple-darwin=lib$(1)-*.dylib.dSYM
CFG_GCCISH_CFLAGS_i686-apple-darwin := -Wall -Werror -g -fPIC -m32 -arch i386
CFG_GCCISH_CXXFLAGS_i686-apple-darwin := -fno-rtti
CFG_GCCISH_LINK_FLAGS_i686-apple-darwin := -dynamiclib -lpthread -framework CoreServices -Wl,-no_compact_unwind -m32
CFG_GCCISH_DEF_FLAG_i686-apple-darwin := -Wl,-exported_symbols_list,
CFG_GCCISH_PRE_LIB_FLAGS_i686-apple-darwin :=
CFG_GCCISH_POST_LIB_FLAGS_i686-apple-darwin :=
CFG_DEF_SUFFIX_i686-apple-darwin := .darwin.def
CFG_INSTALL_NAME_i686-apple-darwin = -Wl,-install_name,@rpath/$(1)
CFG_LIBUV_LINK_FLAGS_i686-apple-darwin =
CFG_EXE_SUFFIX_i686-apple-darwin :=
CFG_WINDOWSY_i686-apple-darwin :=
CFG_UNIXY_i686-apple-darwin := 1
CFG_PATH_MUNGE_i686-apple-darwin := true
CFG_LDPATH_i686-apple-darwin :=
CFG_RUN_i686-apple-darwin=$(2)
CFG_RUN_TARG_i686-apple-darwin=$(call CFG_RUN_i686-apple-darwin,,$(2))
# arm-unknown-android configuration
CC_arm-unknown-android=$(CFG_ANDROID_CROSS_PATH)/bin/arm-linux-androideabi-gcc
CXX_arm-unknown-android=$(CFG_ANDROID_CROSS_PATH)/bin/arm-linux-androideabi-g++
CPP_arm-unknown-android=$(CFG_ANDROID_CROSS_PATH)/bin/arm-linux-androideabi-gcc -E
AR_arm-unknown-android=$(CFG_ANDROID_CROSS_PATH)/bin/arm-linux-androideabi-ar
CFG_LIB_NAME_arm-unknown-android=lib$(1).so
CFG_LIB_GLOB_arm-unknown-android=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_arm-unknown-android=lib$(1)-*.dylib.dSYM
CFG_GCCISH_CFLAGS_arm-unknown-android := -Wall -g -fPIC -D__arm__ -DANDROID -D__ANDROID__
CFG_GCCISH_CXXFLAGS_arm-unknown-android := -fno-rtti
CFG_GCCISH_LINK_FLAGS_arm-unknown-android := -shared -fPIC -ldl -g -lm -lsupc++ -lgnustl_shared
CFG_GCCISH_DEF_FLAG_arm-unknown-android := -Wl,--export-dynamic,--dynamic-list=
CFG_GCCISH_PRE_LIB_FLAGS_arm-unknown-android := -Wl,-whole-archive
CFG_GCCISH_POST_LIB_FLAGS_arm-unknown-android := -Wl,-no-whole-archive -Wl,-znoexecstack
CFG_DEF_SUFFIX_arm-unknown-android := .android.def
CFG_INSTALL_NAME_arm-unknown-android =
CFG_LIBUV_LINK_FLAGS_arm-unknown-android =
CFG_EXE_SUFFIX_arm-unknown-android :=
CFG_WINDOWSY_arm-unknown-android :=
CFG_UNIXY_arm-unknown-android := 1
CFG_PATH_MUNGE_arm-unknown-android := true
CFG_LDPATH_arm-unknown-android :=
CFG_RUN_arm-unknown-android=
CFG_RUN_TARG_arm-unknown-android=
RUSTC_FLAGS_arm-unknown-android :=--android-cross-path='$(CFG_ANDROID_CROSS_PATH)'
# i686-pc-mingw32 configuration
CC_i686-pc-mingw32=$(CC)
CXX_i686-pc-mingw32=$(CXX)
CPP_i686-pc-mingw32=$(CPP)
AR_i686-pc-mingw32=$(AR)
CFG_LIB_NAME_i686-pc-mingw32=$(1).dll
CFG_LIB_GLOB_i686-pc-mingw32=$(1)-*.dll
CFG_LIB_DSYM_GLOB_i686-pc-mingw32=$(1)-*.dylib.dSYM
CFG_GCCISH_CFLAGS_i686-pc-mingw32 := -Wall -Werror -g -march=i686
CFG_GCCISH_CXXFLAGS_i686-pc-mingw32 := -fno-rtti
CFG_GCCISH_LINK_FLAGS_i686-pc-mingw32 := -shared -fPIC -g
CFG_GCCISH_DEF_FLAG_i686-pc-mingw32 :=
CFG_GCCISH_PRE_LIB_FLAGS_i686-pc-mingw32 :=
CFG_GCCISH_POST_LIB_FLAGS_i686-pc-mingw32 :=
CFG_DEF_SUFFIX_i686-pc-mingw32 := .mingw32.def
CFG_INSTALL_NAME_i686-pc-mingw32 =
CFG_LIBUV_LINK_FLAGS_i686-pc-mingw32 := -lWs2_32 -lpsapi -liphlpapi
CFG_EXE_SUFFIX_i686-pc-mingw32 := .exe
CFG_WINDOWSY_i686-pc-mingw32 := 1
CFG_UNIXY_i686-pc-mingw32 :=
CFG_PATH_MUNGE_i686-pc-mingw32 :=
CFG_LDPATH_i686-pc-mingw32 :=$(CFG_LDPATH_i686-pc-mingw32):$(PATH)
CFG_RUN_i686-pc-mingw32=PATH="$(CFG_LDPATH_i686-pc-mingw32):$(1)" $(2)
CFG_RUN_TARG_i686-pc-mingw32=$(call CFG_RUN_i686-pc-mingw32,$(HLIB$(1)_H_$(CFG_BUILD_TRIPLE)),$(2))
# i586-mingw32msvc configuration
CC_i586-mingw32msvc=$(CC)
CXX_i586-mingw32msvc=$(CXX)
CPP_i586-mingw32msvc=$(CPP)
AR_i586-mingw32msvc=$(AR)
CFG_LIB_NAME_i586-mingw32msvc=$(1).dll
CFG_LIB_GLOB_i586-mingw32msvc=$(1)-*.dll
CFG_LIB_DSYM_GLOB_i586-mingw32msvc=$(1)-*.dylib.dSYM
CFG_GCCISH_CFLAGS_i586-mingw32msvc := -Wall -Werror -g -march=586 -m32
CFG_GCCISH_CXXFLAGS_i586-mingw32msvc := -fno-rtti
CFG_GCCISH_LINK_FLAGS_i586-mingw32msvc := -shared -g -m32
CFG_GCCISH_DEF_FLAG_i586-mingw32msvc :=
CFG_GCCISH_PRE_LIB_FLAGS_i586-mingw32msvc :=
CFG_GCCISH_POST_LIB_FLAGS_i586-mingw32msvc :=
CFG_DEF_SUFFIX_i586-mingw32msvc := .mingw32.def
CFG_INSTALL_NAME_i586-mingw32msvc =
CFG_LIBUV_LINK_FLAGS_i586-mingw32msvc := -lWs2_32 -lpsapi -liphlpapi
CFG_EXE_SUFFIX_i586-mingw32msvc := .exe
CFG_WINDOWSY_i586-mingw32msvc := 1
CFG_UNIXY_i586-mingw32msvc :=
CFG_PATH_MUNGE_i586-mingw32msvc := $(strip perl -i.bak -p \
-e 's@\\(\S)@/\1@go;' \
-e 's@^/([a-zA-Z])/@\1:/@o;')
CFG_LDPATH_i586-mingw32msvc :=
CFG_RUN_i586-mingw32msvc=
CFG_RUN_TARG_i586-mingw32msvc=
# x86_64-unknown-freebsd configuration
CC_x86_64-unknown-freebsd=$(CC)
CXX_x86_64-unknown-freebsd=$(CXX)
CPP_x86_64-unknown-freebsd=$(CPP)
AR_x86_64-unknown-freebsd=$(AR)
CFG_LIB_NAME_x86_64-unknown-freebsd=lib$(1).so
CFG_LIB_GLOB_x86_64-unknown-freebsd=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_x86_64-unknown-freebsd=$(1)-*.dylib.dSYM
CFG_GCCISH_CFLAGS_x86_64-unknown-freebsd := -Wall -Werror -g -fPIC -I/usr/local/include
CFG_GCCISH_LINK_FLAGS_x86_64-unknown-freebsd := -shared -fPIC -g -lpthread -lrt
CFG_GCCISH_DEF_FLAG_x86_64-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list=
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-unknown-freebsd := -Wl,-whole-archive
CFG_GCCISH_POST_LIB_FLAGS_x86_64-unknown-freebsd := -Wl,-no-whole-archive
CFG_DEF_SUFFIX_x86_64-unknown-freebsd := .bsd.def
CFG_INSTALL_NAME_x86_64-unknown-freebsd =
CFG_LIBUV_LINK_FLAGS_x86_64-unknown-freebsd := -lpthread -lkvm
CFG_EXE_SUFFIX_x86_64-unknown-freebsd :=
CFG_WINDOWSY_x86_64-unknown-freebsd :=
CFG_UNIXY_x86_64-unknown-freebsd := 1
CFG_PATH_MUNGE_x86_64-unknown-freebsd :=
CFG_LDPATH_x86_64-unknown-freebsd :=
CFG_RUN_x86_64-unknown-freebsd=$(2)
CFG_RUN_TARG_x86_64-unknown-freebsd=$(call CFG_RUN_x86_64-unknown-freebsd,,$(2))
define CFG_MAKE_TOOLCHAIN
CFG_COMPILE_C_$(1) = $$(CC_$(1)) \
$$(CFG_GCCISH_CFLAGS) \
$$(CFG_GCCISH_CFLAGS_$(1)) \
$$(CFG_DEPEND_FLAGS) \
-c -o $$(1) $$(2)
CFG_LINK_C_$(1) = $$(CC_$(1)) \
$$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
$$(CFG_GCCISH_LINK_FLAGS_$(1))) \
$$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
$$(call CFG_INSTALL_NAME_$(1),$$(4))
CFG_COMPILE_CXX_$(1) = $$(CXX_$(1)) \
$$(CFG_GCCISH_CFLAGS) \
$$(CFG_GCCISH_CXXFLAGS) \
$$(CFG_GCCISH_CFLAGS_$(1)) \
$$(CFG_GCCISH_CXXFLAGS_$(1)) \
$$(CFG_DEPEND_FLAGS) \
-c -o $$(1) $$(2)
CFG_LINK_CXX_$(1) = $$(CXX_$(1)) \
$$(CFG_GCCISH_LINK_FLAGS) -o $$(1) \
$$(CFG_GCCISH_LINK_FLAGS_$(1)) \
$$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
$$(call CFG_INSTALL_NAME_$(1),$$(4))
ifneq ($(1),arm-unknown-android)
# We're using llvm-mc as our assembler because it supports
# .cfi pseudo-ops on mac
CFG_ASSEMBLE_$(1)=$$(CPP_$(1)) -E $$(CFG_DEPEND_FLAGS) $$(2) | \
$$(LLVM_MC_$$(CFG_BUILD_TRIPLE)) \
-assemble \
-filetype=obj \
-triple=$(1) \
-o=$$(1)
else
# For the Android cross, use the Android assembler
# XXX: We should be able to use the LLVM assembler
CFG_ASSEMBLE_$(1)=$$(CXX_$(1)) $$(CFG_DEPEND_FLAGS) $$(2) -c -o $$(1)
endif
endef
$(foreach target,$(CFG_TARGET_TRIPLES),\
$(eval $(call CFG_MAKE_ASSEMBLER,$(target))))
$(eval $(call CFG_MAKE_TOOLCHAIN,$(target))))

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_$(CFG_BUILD_TRIPLE),1,$(CFG_BUILD_TRIPLE)/stage1/rustc$(X_$(CFG_BUILD_TRIPLE))) \
--pretty normal $$i >$$i.tmp; \
if [ $$? -ne 0 ]; \
then echo failed to print $$i; rm $$i.tmp; \

View File

@ -26,6 +26,7 @@
# Hack for passing flags into LIBUV, see below.
LIBUV_FLAGS_i386 = -m32 -fPIC
LIBUV_FLAGS_x86_64 = -m64 -fPIC
LIBUV_FLAGS_arm = -fPIC -DANDROID -std=gnu99
# when we're doing a snapshot build, we intentionally degrade as many
# features in libuv and the runtime as possible, to ease portability.
@ -73,7 +74,8 @@ RUNTIME_CXXS_$(1) := \
rt/memory_region.cpp \
rt/boxed_region.cpp \
rt/arch/$$(HOST_$(1))/context.cpp \
rt/arch/$$(HOST_$(1))/gpr.cpp
rt/arch/$$(HOST_$(1))/gpr.cpp \
rt/rust_android_dummy.cpp
RUNTIME_CS_$(1) := rt/linenoise/linenoise.c rt/linenoise/utf8.c
@ -81,31 +83,24 @@ RUNTIME_S_$(1) := rt/arch/$$(HOST_$(1))/_context.S \
rt/arch/$$(HOST_$(1))/ccall.S \
rt/arch/$$(HOST_$(1))/record_sp.S
ifeq ($$(HOST_$(1)), i386)
LIBUV_ARCH_$(1) := ia32
else ifeq ($$(HOST_$(1)), x86_64)
LIBUV_ARCH_$(1) := x86_64
else ifeq ($$(HOST_$(1)), arm)
LIBUV_ARCH_$(1) := arm
else ifeq ($$(HOST_$(1)), mips)
LIBUV_ARCH_$(1) := mips
endif
ifeq ($$(CFG_WINDOWSY), 1)
ifeq ($$(CFG_WINDOWSY_$(1)), 1)
LIBUV_OSTYPE_$(1) := win
LIBUV_LIB_$(1) := rt/$(1)/libuv/libuv.a
else ifeq ($(CFG_OSTYPE), apple-darwin)
else ifeq ($(OSTYPE_$(1)), apple-darwin)
LIBUV_OSTYPE_$(1) := mac
LIBUV_LIB_$(1) := rt/$(1)/libuv/libuv.a
else ifeq ($(CFG_OSTYPE), unknown-freebsd)
else ifeq ($(OSTYPE_$(1)), unknown-freebsd)
LIBUV_OSTYPE_$(1) := unix/freebsd
LIBUV_LIB_$(1) := rt/$(1)/libuv/libuv.a
else ifeq ($(OSTYPE_$(1)), unknown-android)
LIBUV_OSTYPE_$(1) := unix/android
LIBUV_LIB_$(1) := rt/$(1)/libuv/libuv.a
else
LIBUV_OSTYPE_$(1) := unix/linux
LIBUV_LIB_$(1) := rt/$(1)/libuv/libuv.a
endif
RUNTIME_DEF_$(1) := rt/rustrt$$(CFG_DEF_SUFFIX)
RUNTIME_DEF_$(1) := rt/rustrt$(CFG_DEF_SUFFIX_$(1))
RUNTIME_INCS_$(1) := -I $$(S)src/rt -I $$(S)src/rt/isaac -I $$(S)src/rt/uthash \
-I $$(S)src/rt/arch/$$(HOST_$(1)) \
-I $$(S)src/rt/linenoise \
@ -131,7 +126,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),$$@,$$<)
@ -139,13 +134,13 @@ rt/$(1)/arch/$$(HOST_$(1))/libmorestack.a: $$(MORESTACK_OBJ_$(1))
@$$(call E, link: $$@)
$$(Q)ar rcs $$@ $$<
rt/$(1)/$(CFG_RUNTIME): $$(RUNTIME_OBJS_$(1)) $$(MKFILE_DEPS) \
rt/$(1)/$(CFG_RUNTIME_$(1)): $$(RUNTIME_OBJS_$(1)) $$(MKFILE_DEPS) \
$$(RUNTIME_DEF_$(1)) \
$$(RUNTIME_LIBS_$(1))
@$$(call E, link: $$@)
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@, $$(RUNTIME_OBJS_$(1)) \
$$(CFG_GCCISH_POST_LIB_FLAGS) $$(RUNTIME_LIBS_$(1)) \
$$(CFG_LIBUV_LINK_FLAGS),$$(RUNTIME_DEF_$(1)),$$(CFG_RUNTIME))
$$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) $$(RUNTIME_LIBS_$(1)) \
$$(CFG_LIBUV_LINK_FLAGS_$(1)),$$(RUNTIME_DEF_$(1)),$$(CFG_RUNTIME_$(1)))
# FIXME: For some reason libuv's makefiles can't figure out the
# correct definition of CC on the mingw I'm using, so we are
@ -162,12 +157,25 @@ LIBUV_DEPS := $$(wildcard \
$$(S)src/libuv/*/*/*/*)
endif
ifdef CFG_WINDOWSY
# XXX: Shouldn't need platform-specific conditions here
ifdef CFG_WINDOWSY_$(1)
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
OS=mingw \
V=$$(VERBOSE)
else ifeq ($(OSTYPE_$(1)), unknown-android)
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
CFLAGS="$$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
LDFLAGS="$$(LIBUV_FLAGS_$$(HOST_$(1)))" \
CC="$$(CC_$(1))" \
CXX="$$(CXX_$(1))" \
AR="$$(AR_$(1))" \
BUILDTYPE=Release \
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
host=android OS=linux \
V=$$(VERBOSE)
else
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
@ -196,13 +204,17 @@ endif
@$$(call E, def: $$@)
$$(Q)sed 's/^./_&/' $$< > $$@
ifdef CFG_WINDOWSY
%.def: %.def.in $$(MKFILE_DEPS)
%.android.def: %.def.in $$(MKFILE_DEPS)
@$$(call E, def: $$@)
$$(Q)echo "{" > $$@
$$(Q)sed 's/.$$$$/&;/' $$< >> $$@
$$(Q)echo "};" >> $$@
%.mingw32.def: %.def.in $$(MKFILE_DEPS)
@$$(call E, def: $$@)
$$(Q)echo LIBRARY $$* > $$@
$$(Q)echo EXPORTS >> $$@
$$(Q)sed 's/^./ &/' $$< >> $$@
endif
endef

View File

@ -17,14 +17,14 @@ define DEF_RUSTLLVM_TARGETS
# FIXME: Lately, on windows, llvm-config --includedir is not enough
# to find the llvm includes (probably because we're not actually installing
# llvm, but using it straight out of the build directory)
ifdef CFG_WINDOWSY
ifdef CFG_WINDOWSY_$(1)
LLVM_EXTRA_INCDIRS_$(1)= -iquote $(S)src/llvm/include \
-iquote llvm/$(1)/include
endif
RUSTLLVM_OBJS_CS_$(1) := $$(addprefix rustllvm/, RustWrapper.cpp)
RUSTLLVM_DEF_$(1) := rustllvm/rustllvm$$(CFG_DEF_SUFFIX)
RUSTLLVM_DEF_$(1) := rustllvm/rustllvm$(CFG_DEF_SUFFIX_$(1))
RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
-iquote $$(LLVM_INCDIR_$(1)) \
@ -32,13 +32,13 @@ RUSTLLVM_INCS_$(1) = $$(LLVM_EXTRA_INCDIRS_$(1)) \
RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=rustllvm/$(1)/%.o)
ALL_OBJ_FILES += $$(RUSTLLVM_OBJS_OBJS_$(1))
rustllvm/$(1)/$(CFG_RUSTLLVM): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
rustllvm/$(1)/$(CFG_RUSTLLVM_$(1)): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
$$(MKFILE_DEPS) $$(RUSTLLVM_DEF_$(1))
@$$(call E, link: $$@)
$$(Q)$$(call CFG_LINK_CXX_$(1),$$@,$$(RUSTLLVM_OBJS_OBJS_$(1)) \
$$(CFG_GCCISH_PRE_LIB_FLAGS) $$(LLVM_LIBS_$(1)) \
$$(CFG_GCCISH_POST_LIB_FLAGS) \
$$(LLVM_LDFLAGS_$(1)),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM))
$$(CFG_GCCISH_PRE_LIB_FLAGS_$(1)) $$(LLVM_LIBS_$(1)) \
$$(CFG_GCCISH_POST_LIB_FLAGS_$(1)) \
$$(LLVM_LDFLAGS_$(1)),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM_$(1)))
rustllvm/$(1)/%.o: rustllvm/%.cpp $$(MKFILE_DEPS) $$(LLVM_CONFIG_$(1))
@$$(call E, compile: $$@)
@ -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_$(CFG_BUILD_TRIPLE)): \
$(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_$(CFG_BUILD_TRIPLE)): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE))
$(Q)touch $@
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_CORELIB): \
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/$(CFG_CORELIB_$(CFG_BUILD_TRIPLE)): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE))
$(Q)touch $@
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_STDLIB): \
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/$(CFG_STDLIB_$(CFG_BUILD_TRIPLE)): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE))
$(Q)touch $@
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_LIBRUSTC): \
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/$(CFG_LIBRUSTC_$(CFG_BUILD_TRIPLE)): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE))
$(Q)touch $@
$(HLIB0_H_$(CFG_HOST_TRIPLE))/$(CFG_RUSTLLVM): \
$(HBIN0_H_$(CFG_HOST_TRIPLE))/rustc$(X)
$(HLIB0_H_$(CFG_BUILD_TRIPLE))/$(CFG_RUSTLLVM_$(CFG_BUILD_TRIPLE)): \
$(HBIN0_H_$(CFG_BUILD_TRIPLE))/rustc$(X_$(CFG_BUILD_TRIPLE))
$(Q)touch $@
# For other targets, let the host build the target:
@ -48,33 +48,33 @@ define BOOTSTRAP_STAGE0
# $(2) stage to bootstrap from
# $(3) target to bootstrap from
$$(HBIN0_H_$(1))/rustc$$(X): \
$$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X)
$$(HBIN0_H_$(1))/rustc$$(X_$(1)): \
$$(TBIN$(2)_T_$(1)_H_$(3))/rustc$$(X_$(1))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(HLIB0_H_$(1))/$$(CFG_RUNTIME): \
$$(TLIB$(2)_T_$(1)_H_$(3))/$$(CFG_RUNTIME)
$$(HLIB0_H_$(1))/$(CFG_RUNTIME_$(1)): \
$$(TLIB$(2)_T_$(1)_H_$(3))/$(CF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TLLVM_$(1))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
@ -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,20 +22,50 @@ $$(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)
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUNTIME_$(2)): \
rt/$(2)/$(CFG_RUNTIME_$(2))
@$$(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_CORELIB_$(2)): \
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
$$(TSREQ$(1)_T_$(2)_H_$(3))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X): \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)): \
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_CORELIB_$(2)) \
$$(TSREQ$(1)_T_$(2)_H_$(3))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)): \
$$(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_$(3)): \
rustllvm/$(2)/$(CFG_RUSTLLVM_$(3))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
$$(DRIVER_CRATE) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) --cfg rustc -o $$@ $$<
ifdef CFG_ENABLE_PAX_FLAGS
@ -43,37 +73,12 @@ ifdef CFG_ENABLE_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: $$@)
$$(Q)cp $$< $$@
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_CORELIB): \
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
$$(TSREQ$(1)_T_$(2)_H_$(3))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< && touch $$@
$$(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 $$@
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
@ -48,13 +50,6 @@ ifdef VERBOSE
CTEST_TESTARGS += --verbose
endif
# Run the compiletest runner itself under valgrind
ifdef CTEST_VALGRIND
CFG_RUN_CTEST=$(call CFG_RUN_TEST,$(2),$(3))
else
CFG_RUN_CTEST=$(call CFG_RUN,$(TLIB$(1)_T_$(3)_H_$(3)),$(2))
endif
# If we're running perf then set this environment variable
# to put the benchmarks into 'hard mode'
ifeq ($(MAKECMDGOALS),perf)
@ -65,6 +60,39 @@ endif
TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok
define DEF_TARGET_COMMANDS
ifdef CFG_UNIXY_$(1)
CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
endif
ifdef CFG_WINDOWSY_$(1)
CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)/$$(2)/$$(strip \
$$(if $$(findstring stage0,$$(1)), \
stage0/$$(CFG_LIBDIR), \
$$(if $$(findstring stage1,$$(1)), \
stage1/$$(CFG_LIBDIR), \
$$(if $$(findstring stage2,$$(1)), \
stage2/$$(CFG_LIBDIR), \
$$(if $$(findstring stage3,$$(1)), \
stage3/$$(CFG_LIBDIR), \
)))))/rustc/$$(CFG_BUILD_TRIPLE)/$$(CFG_LIBDIR)
CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(3)),$$(1))
endif
# Run the compiletest runner itself under valgrind
ifdef CTEST_VALGRIND
CFG_RUN_CTEST_$(1)=$$(call CFG_RUN_TEST_$$(CFG_BUILD_TRIPLE),$$(2),$$(3))
else
CFG_RUN_CTEST_$(1)=$$(call CFG_RUN_$$(CFG_BUILD_TRIPLE),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
endif
endef
$(foreach target,$(CFG_TARGET_TRIPLES), \
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
######################################################################
# Main test targets
######################################################################
@ -93,7 +121,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 +203,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 +232,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))))))
@ -204,58 +244,58 @@ $(foreach host,$(CFG_TARGET_TRIPLES), \
define TEST_RUNNER
$(3)/test/coretest.stage$(1)-$(2)$$(X): \
$(3)/test/coretest.stage$(1)-$(2)$$(X_$(2)): \
$$(CORELIB_CRATE) $$(CORELIB_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/test/stdtest.stage$(1)-$(2)$$(X): \
$(3)/test/stdtest.stage$(1)-$(2)$$(X_$(2)): \
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/test/syntaxtest.stage$(1)-$(2)$$(X): \
$(3)/test/syntaxtest.stage$(1)-$(2)$$(X_$(2)): \
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB)
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_STDLIB_$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/test/rustctest.stage$(1)-$(2)$$(X): \
$(3)/test/rustctest.stage$(1)-$(2)$$(X_$(2)): \
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX)
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM_$(2)) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/test/rustpkgtest.stage$(1)-$(2)$$(X): \
$(3)/test/rustpkgtest.stage$(1)-$(2)$$(X_$(2)): \
$$(RUSTPKG_LIB) $$(RUSTPKG_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/test/rustitest.stage$(1)-$(2)$$(X): \
$(3)/test/rustitest.stage$(1)-$(2)$$(X_$(2)): \
$$(RUSTI_LIB) $$(RUSTI_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/test/rusttest.stage$(1)-$(2)$$(X): \
$(3)/test/rusttest.stage$(1)-$(2)$$(X_$(2)): \
$$(RUST_LIB) $$(RUST_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
$(3)/test/rustdoctest.stage$(1)-$(2)$$(X): \
$(3)/test/rustdoctest.stage$(1)-$(2)$$(X_$(2)): \
$$(RUSTDOC_LIB) $$(RUSTDOC_INPUTS) \
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
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))))))))
@ -264,14 +304,14 @@ define DEF_TEST_CRATE_RULES
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
$(3)/test/$(4)test.stage$(1)-$(2)$$(X)
$(3)/test/$(4)test.stage$(1)-$(2)$$(X_$(2))
@$$(call E, run: $$<)
$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) $$(TESTARGS) \
$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) $$(TESTARGS) \
--logfile $$(call TEST_LOG_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), \
@ -357,7 +397,7 @@ define DEF_CTEST_VARS
# Prerequisites for compiletest tests
TEST_SREQ$(1)_T_$(2)_H_$(3) = \
$$(HBIN$(1)_H_$(3))/compiletest$$(X) \
$$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
$$(SREQ$(1)_T_$(2)_H_$(3))
# Rules for the cfail/rfail/rpass/bench/perf test runner
@ -365,7 +405,7 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X) \
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
--aux-base $$(S)src/test/auxiliary/ \
--stage-id stage$(1)-$(2) \
--rustcflags "$$(CFG_RUSTC_FLAGS) --target=$(2)" \
@ -381,7 +421,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))))))))
@ -403,7 +443,7 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
@$$(call E, run $(4): $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
$$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
&& touch $$@
@ -423,7 +463,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), \
@ -455,14 +495,14 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
$$(PRETTY_DEPS_$(4))
@$$(call E, run pretty-rpass: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
$$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
--logfile $$(call TEST_LOG_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 pretty-name,$(PRETTY_NAMES), \
@ -482,14 +522,14 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): \
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
doc-$(4)-extract$(3)
@$$(call E, run doc-$(4): $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(1),$$<,$(3)) \
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
$$(DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-doc-$(4)) \
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),doc-$(4)) \
&& touch $$@
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 +551,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 +586,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,12 +595,12 @@ 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): check-stage$(1)-H-$$(CFG_BUILD_TRIPLE)
check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET_TRIPLES), \
check-stage$(1)-H-$$(target))
endef
@ -569,7 +609,7 @@ $(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)-$(2): check-stage$(1)-H-$$(CFG_BUILD_TRIPLE)-$(2)
check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET_TRIPLES), \
check-stage$(1)-H-$$(target)-$(2))
endef
@ -585,7 +625,7 @@ check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET_TRIPLES), \
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
@ -594,17 +634,16 @@ check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET_TRIPLES), \
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
######################################################################
FT := run_pass_stage2
FT_LIB := $(call CFG_LIB_NAME,$(FT))
FT_LIB := $(call CFG_LIB_NAME_$(CFG_BUILD_TRIPLE),$(FT))
FT_DRIVER := $(FT)_driver
GENERATED += tmp/$(FT).rc tmp/$(FT_DRIVER).rs
@ -626,7 +665,7 @@ $$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB): \
@$$(call E, compile_and_link: $$@)
$$(STAGE2_T_$(2)_H_$(3)) --lib -o $$@ $$<
$(3)/test/$$(FT_DRIVER)-$(2)$$(X): \
$(3)/test/$$(FT_DRIVER)-$(2)$$(X_$(2)): \
tmp/$$(FT_DRIVER).rs \
$$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB) \
$$(SREQ2_T_$(2)_H_$(3))
@ -634,9 +673,9 @@ $(3)/test/$$(FT_DRIVER)-$(2)$$(X): \
$$(STAGE2_T_$(2)_H_$(3)) -o $$@ $$<
$(3)/test/$$(FT_DRIVER)-$(2).out: \
$(3)/test/$$(FT_DRIVER)-$(2)$$(X) \
$(3)/test/$$(FT_DRIVER)-$(2)$$(X_$(2)) \
$$(SREQ2_T_$(2)_H_$(3))
$$(Q)$$(call CFG_RUN_TEST,$$<,$(2),$(3)) \
$$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) \
--logfile tmp/$$(FT_DRIVER)-$(2).log
check-fast-T-$(2)-H-$(3): \
@ -644,11 +683,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 +695,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

@ -38,86 +38,86 @@ RUST_INPUTS := $(wildcard $(S)src/librust/*.rs)
# have tools that need to built for other targets.
define TOOLS_STAGE_N_TARGET
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBFUZZER): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBFUZZER_$(4)): \
$$(FUZZER_LIB) $$(FUZZER_INPUTS) \
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_CORELIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
$$(TBIN$(1)_T_$(4)_H_$(3))/fuzzer$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/fuzzer$$(X_$(4)): \
$$(DRIVER_CRATE) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBFUZZER)
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBFUZZER_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg fuzzer -o $$@ $$<
$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X_$(4)): \
$$(COMPILETEST_CRATE) $$(COMPILETEST_INPUTS) \
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB)
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_CORELIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$<
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTPKG): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)): \
$$(RUSTPKG_LIB) $$(RUSTPKG_INPUTS) \
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_CORELIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
$$(TBIN$(1)_T_$(4)_H_$(3))/rustpkg$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/rustpkg$$(X_$(4)): \
$$(DRIVER_CRATE) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTPKG)
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rustpkg -o $$@ $$<
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTDOC): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)): \
$$(RUSTDOC_LIB) $$(RUSTDOC_INPUTS) \
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_CORELIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
$$(TBIN$(1)_T_$(4)_H_$(3))/rustdoc$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/rustdoc$$(X_$(4)): \
$$(DRIVER_CRATE) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTDOC)
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rustdoc -o $$@ $$<
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTI): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTI_$(4)): \
$$(RUSTI_LIB) $$(RUSTI_INPUTS) \
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_CORELIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
$$(TBIN$(1)_T_$(4)_H_$(3))/rusti$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/rusti$$(X_$(4)): \
$$(DRIVER_CRATE) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTI)
$$(TLIB$(1)_T_$(4)_H_$(4))/$(CFG_LIBRUSTI_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rusti -o $$@ $$<
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUST): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)): \
$$(RUST_LIB) $$(RUST_INPUTS) \
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_CORELIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_STDLIB) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUSTC)
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_CORELIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$< && touch $$@
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)): \
$$(DRIVER_CRATE) \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBRUST)
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rust -o $$@ $$<
@ -129,107 +129,107 @@ define TOOLS_STAGE_N_HOST
# Promote the stageN target to stageN+1 host
# FIXME: Shouldn't need to depend on host/librustc.so once
# rpath is working
$$(HLIB$(2)_H_$(4))/$$(CFG_LIBFUZZER): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$$(CFG_LIBFUZZER) \
$$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUSTC) \
$$(HLIB$(2)_H_$(4))/$(CFG_LIBFUZZER_$(4)): \
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBFUZZER_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUSTC_$(4)) \
$$(HSREQ$(2)_H_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBFUZZER_GLOB) \
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBFUZZER_DSYM_GLOB)) \
$$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBFUZZER_GLOB_$(4)) \
$$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(LIBFUZZER_DSYM_GLOB_$(4))) \
$$(HLIB$(2)_H_$(4))
$$(HBIN$(2)_H_$(4))/fuzzer$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/fuzzer$$(X) \
$$(HLIB$(2)_H_$(4))/$$(CFG_LIBFUZZER) \
$$(HBIN$(2)_H_$(4))/fuzzer$$(X_$(4)): \
$$(TBIN$(1)_T_$(4)_H_$(3))/fuzzer$$(X_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_LIBFUZZER_$(4)) \
$$(HSREQ$(2)_H_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(HBIN$(2)_H_$(4))/compiletest$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X) \
$$(HBIN$(2)_H_$(4))/compiletest$$(X_$(4)): \
$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X_$(4)) \
$$(HSREQ$(2)_H_$(4))
@$$(call E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_H_$(4))/rust$$(X): \
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X) \
$$(HLIB$(2)_H_$(4))/$$(CFG_LIBRUST) \
$$(HBIN$(2)_H_$(4))/rust$$(X_$(4)): \
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)) \
$$(HLIB$(2)_H_$(4))/$(CFG_LIBRUST_$(4)) \
$$(HSREQ$(2)_H_$(4))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
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

@ -767,11 +767,18 @@ pub fn link_binary(sess: Session,
// instead of hard-coded gcc.
// For win32, there is no cc command,
// so we add a condition to make it use gcc.
let cc_prog: ~str =
if sess.targ_cfg.os == session::os_android {
~"arm-linux-androideabi-g++"
} else if sess.targ_cfg.os == session::os_win32 { ~"gcc" }
else { ~"cc" };
let cc_prog: ~str = if sess.targ_cfg.os == session::os_android {
match &sess.opts.android_cross_path {
&Some(copy path) => {
fmt!("%s/bin/arm-linux-androideabi-gcc", path)
}
&None => {
sess.fatal(~"need Android NDK path for linking \
(--android-cross-path)")
}
}
} else if sess.targ_cfg.os == session::os_win32 { ~"gcc" }
else { ~"cc" };
// The invocations of cc share some flags across platforms
let mut cc_args =
@ -866,9 +873,7 @@ pub fn link_binary(sess: Session,
}
// Stack growth requires statically linking a __morestack function
if sess.targ_cfg.os != session::os_android {
cc_args.push(~"-lmorestack");
}
// Always want the runtime linked in
cc_args.push(~"-lrustrt");

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")
};
}
@ -641,6 +641,8 @@ pub fn build_session_options(+binary: ~str,
.map(|s| Path(*s));
let cfg = parse_cfgspecs(getopts::opt_strs(matches, ~"cfg"));
let test = opt_present(matches, ~"test");
let android_cross_path = getopts::opt_maybe_str(
matches, ~"android-cross-path");
let sopts = @session::options {
crate_type: crate_type,
is_static: static,
@ -660,7 +662,8 @@ pub fn build_session_options(+binary: ~str,
test: test,
parse_only: parse_only,
no_trans: no_trans,
debugging_opts: debugging_opts
debugging_opts: debugging_opts,
android_cross_path: android_cross_path
};
return sopts;
}
@ -764,6 +767,8 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
to compile for (see
http://sources.redhat.com/autobook/autobook/autobook_17.html
for detail)", ~"TRIPLE"),
optopt(~"", ~"android-cross-path",
~"The path to the Android NDK", "PATH"),
optmulti(~"W", ~"warn",
~"Set lint warnings", ~"OPT"),
optmulti(~"A", ~"allow",

View File

@ -138,6 +138,7 @@ pub struct options {
parse_only: bool,
no_trans: bool,
debugging_opts: uint,
android_cross_path: Option<~str>
}
pub struct crate_metadata {
@ -297,7 +298,8 @@ pub fn basic_options() -> @options {
test: false,
parse_only: false,
no_trans: false,
debugging_opts: 0u
debugging_opts: 0u,
android_cross_path: None
}
}

@ -1 +1 @@
Subproject commit da33bba7c04e0873b457a9a4290bed2adf620154
Subproject commit 576ab1db8ea03889eb7b2274654afe7c5c867230

View File

@ -0,0 +1,8 @@
.text
.code 32
.arm
.align
.globl __morestack
.hidden __morestack
__morestack:

View File

@ -4,6 +4,7 @@
#include "rust_android_dummy.h"
#include <math.h>
#include <errno.h>
#ifdef __ANDROID__
@ -13,6 +14,9 @@ char **backtrace_symbols(void *const *array, int size) { return 0; }
void backtrace_symbols_fd (void *const *array, int size, int fd) {}
extern "C" volatile int* __errno_location() {
return &errno;
}
extern "C" float log2f(float f)
{

View File

@ -49,6 +49,7 @@ public:
case 0: return NULL;
case 1: return m_annihilate_fn;
default: assert(false && "Unknown crate map version!");
return NULL; // Appease -Werror=return-type
}
}
@ -57,6 +58,7 @@ public:
case 0: return reinterpret_cast<const cratemap_v0 *>(this)->m_entries;
case 1: return m_entries;
default: assert(false && "Unknown crate map version!");
return NULL; // Appease -Werror=return-type
}
}
@ -68,6 +70,7 @@ public:
case 1:
return &m_children[1];
default: assert(false && "Unknown crate map version!");
return NULL; // Appease -Werror=return-type
}
}

View File

@ -314,9 +314,11 @@ void update_log_settings(void* crate_map, char* settings) {
n_dirs, &n_matches);
if (n_matches < n_dirs) {
printf("warning: got %" PRIdPTR " RUST_LOG specs, "
// NOTE: Android compiler is complaining about format specifiers here
// and I don't understand why
/*printf("warning: got %" PRIdPTR " RUST_LOG specs, "
"enabled %" PRIdPTR " flags.",
(uintptr_t)n_dirs, (uintptr_t)n_matches);
(uintptr_t)n_dirs, (uintptr_t)n_matches);*/
}
free(buffer);