2011-05-04 01:09:18 +00:00
|
|
|
|
2011-11-01 23:50:47 +00:00
|
|
|
# Create variables HOST_<triple> containing the host part
|
|
|
|
# of each target triple. For example, the triple i686-darwin-macos
|
|
|
|
# would create a variable HOST_i686-darwin-macos with the value
|
|
|
|
# i386.
|
|
|
|
define DEF_HOST_VAR
|
|
|
|
HOST_$(1) = $(subst i686,i386,$(word 1,$(subst -, ,$(1))))
|
|
|
|
endef
|
|
|
|
$(foreach t,$(CFG_TARGET_TRIPLES),$(eval $(call DEF_HOST_VAR,$(t))))
|
2011-11-03 18:26:52 +00:00
|
|
|
$(foreach t,$(CFG_TARGET_TRIPLES),$(info cfg: host for $(t) is $(HOST_$(t))))
|
2011-11-01 23:50:47 +00:00
|
|
|
|
2012-03-30 02:10:38 +00:00
|
|
|
CFG_GCCISH_FLAGS += -fno-strict-aliasing
|
2011-05-01 20:18:52 +00:00
|
|
|
|
|
|
|
# On Darwin, we need to run dsymutil so the debugging information ends
|
|
|
|
# up in the right place. On other platforms, it automatically gets
|
|
|
|
# embedded into the executable, so use a no-op command.
|
|
|
|
CFG_DSYMUTIL := true
|
|
|
|
|
2011-09-21 19:34:30 +00:00
|
|
|
ifneq ($(findstring freebsd,$(CFG_OSTYPE)),)
|
2011-05-01 20:18:52 +00:00
|
|
|
CFG_LIB_NAME=lib$(1).so
|
2011-12-02 16:51:59 +00:00
|
|
|
CFG_LIB_GLOB=lib$(1)-*.so
|
2011-12-30 08:18:55 +00:00
|
|
|
CFG_GCCISH_CFLAGS += -fPIC -I/usr/local/include
|
2012-01-01 17:24:07 +00:00
|
|
|
CFG_GCCISH_LINK_FLAGS += -shared -fPIC -lpthread -lrt
|
2011-12-30 08:18:55 +00:00
|
|
|
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
|
2011-05-01 20:18:52 +00:00
|
|
|
CFG_UNIXY := 1
|
|
|
|
CFG_LDENV := LD_LIBRARY_PATH
|
|
|
|
CFG_DEF_SUFFIX := .bsd.def
|
2011-10-06 20:09:00 +00:00
|
|
|
CFG_INSTALL_NAME =
|
2011-11-29 19:06:08 +00:00
|
|
|
CFG_PERF_TOOL := /usr/bin/time
|
2012-02-13 02:23:23 +00:00
|
|
|
|
|
|
|
# FIXME (1825): We're deadlocking on FreeBSD
|
|
|
|
ifndef RUST_THREADS
|
|
|
|
RUST_THREADS=1
|
|
|
|
export RUST_THREADS
|
|
|
|
endif
|
2011-05-01 20:18:52 +00:00
|
|
|
endif
|
|
|
|
|
2011-09-21 18:24:59 +00:00
|
|
|
ifneq ($(findstring linux,$(CFG_OSTYPE)),)
|
2011-05-01 20:18:52 +00:00
|
|
|
CFG_LIB_NAME=lib$(1).so
|
2011-12-02 16:51:59 +00:00
|
|
|
CFG_LIB_GLOB=lib$(1)-*.so
|
2011-11-02 22:10:19 +00:00
|
|
|
CFG_GCCISH_CFLAGS += -fPIC
|
2011-05-09 04:10:04 +00:00
|
|
|
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
|
2011-10-24 02:07:55 +00:00
|
|
|
# -znoexecstack is here because librt is for some reason being created
|
|
|
|
# with executable stack and Fedora (or SELinux) doesn't like that (#798)
|
2011-10-24 01:52:31 +00:00
|
|
|
CFG_GCCISH_POST_LIB_FLAGS := -Wl,-no-whole-archive -Wl,-znoexecstack
|
2011-11-01 23:50:47 +00:00
|
|
|
CFG_GCCISH_CFLAGS_i386 = -m32
|
|
|
|
CFG_GCCISH_LINK_FLAGS_i386 = -m32
|
|
|
|
CFG_GCCISH_CFLAGS_x86_64 = -m64
|
|
|
|
CFG_GCCISH_LINK_FLAGS_x86_64 = -m64
|
2011-05-01 20:18:52 +00:00
|
|
|
CFG_UNIXY := 1
|
|
|
|
CFG_LDENV := LD_LIBRARY_PATH
|
|
|
|
CFG_DEF_SUFFIX := .linux.def
|
2011-09-13 22:06:21 +00:00
|
|
|
ifdef CFG_PERF
|
2012-01-16 11:20:07 +00:00
|
|
|
ifneq ($(CFG_PERF_WITH_LOGFD),)
|
|
|
|
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3 --log-fd 2
|
|
|
|
else
|
|
|
|
CFG_PERF_TOOL := $(CFG_PERF) stat -r 3
|
|
|
|
endif
|
2011-09-13 22:06:21 +00:00
|
|
|
else
|
|
|
|
ifdef CFG_VALGRIND
|
|
|
|
CFG_PERF_TOOL :=\
|
|
|
|
$(CFG_VALGRIND) --tool=cachegrind --cache-sim=yes --branch-sim=yes
|
|
|
|
else
|
|
|
|
CFG_PERF_TOOL := /usr/bin/time --verbose
|
|
|
|
endif
|
|
|
|
endif
|
2011-10-06 20:09:00 +00:00
|
|
|
CFG_INSTALL_NAME =
|
2011-11-03 23:13:22 +00:00
|
|
|
# Linux requires LLVM to be built like this to get backtraces into Rust code
|
|
|
|
CFG_LLVM_BUILD_ENV="CXXFLAGS=-fno-omit-frame-pointer"
|
2011-05-01 20:18:52 +00:00
|
|
|
endif
|
|
|
|
|
2011-09-21 18:24:59 +00:00
|
|
|
ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
|
2011-05-01 20:18:52 +00:00
|
|
|
CFG_LIB_NAME=lib$(1).dylib
|
2011-12-02 16:51:59 +00:00
|
|
|
CFG_LIB_GLOB=lib$(1)-*.dylib
|
2012-03-21 22:56:20 +00:00
|
|
|
CFG_LIB_DSYM_GLOB=lib$(1)-*.dylib.dSYM
|
2011-05-01 20:18:52 +00:00
|
|
|
CFG_UNIXY := 1
|
|
|
|
CFG_LDENV := DYLD_LIBRARY_PATH
|
2011-12-18 08:41:26 +00:00
|
|
|
CFG_GCCISH_LINK_FLAGS += -dynamiclib -lpthread -framework CoreServices -Wl,-no_compact_unwind
|
2011-05-09 04:10:04 +00:00
|
|
|
CFG_GCCISH_DEF_FLAG := -Wl,-exported_symbols_list,
|
2011-05-01 20:18:52 +00:00
|
|
|
# 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.
|
2011-11-01 23:50:47 +00:00
|
|
|
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
|
2011-05-01 20:18:52 +00:00
|
|
|
CFG_DSYMUTIL := dsymutil
|
|
|
|
CFG_DEF_SUFFIX := .darwin.def
|
2011-10-06 20:09:00 +00:00
|
|
|
# Mac requires this flag to make rpath work
|
|
|
|
CFG_INSTALL_NAME = -Wl,-install_name,@rpath/$(1)
|
2011-05-01 20:18:52 +00:00
|
|
|
endif
|
|
|
|
|
2012-02-03 20:22:53 +00:00
|
|
|
# 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*))
|
|
|
|
|
2011-09-21 18:24:59 +00:00
|
|
|
ifneq ($(findstring mingw,$(CFG_OSTYPE)),)
|
2011-05-01 20:18:52 +00:00
|
|
|
CFG_WINDOWSY := 1
|
|
|
|
endif
|
|
|
|
|
2011-08-23 19:33:42 +00:00
|
|
|
ifdef CFG_DISABLE_OPTIMIZE_CXX
|
|
|
|
$(info cfg: disabling C++ optimization (CFG_DISABLE_OPTIMIZE_CXX))
|
|
|
|
CFG_GCCISH_CFLAGS += -O0
|
|
|
|
else
|
|
|
|
CFG_GCCISH_CFLAGS += -O2
|
|
|
|
endif
|
|
|
|
|
2011-11-29 05:23:42 +00:00
|
|
|
CFG_TESTLIB=$(CFG_BUILD_DIR)/$(2)/$(strip \
|
The Big Test Suite Overhaul
This replaces the make-based test runner with a set of Rust-based test
runners. I believe that all existing functionality has been
preserved. The primary objective is to dogfood the Rust test
framework.
A few main things happen here:
1) The run-pass/lib-* tests are all moved into src/test/stdtest. This
is a standalone test crate intended for all standard library tests. It
compiles to build/test/stdtest.stageN.
2) rustc now compiles into yet another build artifact, this one a test
runner that runs any tests contained directly in the rustc crate. This
allows much more fine-grained unit testing of the compiler. It
compiles to build/test/rustctest.stageN.
3) There is a new custom test runner crate at src/test/compiletest
that reproduces all the functionality for running the compile-fail,
run-fail, run-pass and bench tests while integrating with Rust's test
framework. It compiles to build/test/compiletest.stageN.
4) The build rules have been completely changed to use the new test
runners, while also being less redundant, following the example of the
recent stageN.mk rewrite.
It adds two new features to the cfail/rfail/rpass/bench tests:
1) Tests can specify multiple 'error-pattern' directives which must be
satisfied in order.
2) Tests can specify a 'compile-flags' directive which will make the
test runner provide additional command line arguments to rustc.
There are some downsides, the primary being that Rust has to be
functioning pretty well just to run _any_ tests, which I imagine will
be the source of some frustration when the entire test suite
breaks. Will also cause some headaches during porting.
Not having individual make rules, each rpass, etc test no longer
remembers between runs whether it completed successfully. As a result,
it's not possible to incrementally fix multiple tests by just running
'make check', fixing a test, and repeating without re-running all the
tests contained in the test runner. Instead you can filter just the
tests you want to run by using the TESTNAME environment variable.
This also dispenses with the ability to run stage0 tests, but they
tended to be broken more often than not anyway.
2011-07-13 02:01:09 +00:00
|
|
|
$(if $(findstring stage0,$(1)), \
|
2012-01-11 01:45:03 +00:00
|
|
|
stage0/$(CFG_LIBDIR), \
|
The Big Test Suite Overhaul
This replaces the make-based test runner with a set of Rust-based test
runners. I believe that all existing functionality has been
preserved. The primary objective is to dogfood the Rust test
framework.
A few main things happen here:
1) The run-pass/lib-* tests are all moved into src/test/stdtest. This
is a standalone test crate intended for all standard library tests. It
compiles to build/test/stdtest.stageN.
2) rustc now compiles into yet another build artifact, this one a test
runner that runs any tests contained directly in the rustc crate. This
allows much more fine-grained unit testing of the compiler. It
compiles to build/test/rustctest.stageN.
3) There is a new custom test runner crate at src/test/compiletest
that reproduces all the functionality for running the compile-fail,
run-fail, run-pass and bench tests while integrating with Rust's test
framework. It compiles to build/test/compiletest.stageN.
4) The build rules have been completely changed to use the new test
runners, while also being less redundant, following the example of the
recent stageN.mk rewrite.
It adds two new features to the cfail/rfail/rpass/bench tests:
1) Tests can specify multiple 'error-pattern' directives which must be
satisfied in order.
2) Tests can specify a 'compile-flags' directive which will make the
test runner provide additional command line arguments to rustc.
There are some downsides, the primary being that Rust has to be
functioning pretty well just to run _any_ tests, which I imagine will
be the source of some frustration when the entire test suite
breaks. Will also cause some headaches during porting.
Not having individual make rules, each rpass, etc test no longer
remembers between runs whether it completed successfully. As a result,
it's not possible to incrementally fix multiple tests by just running
'make check', fixing a test, and repeating without re-running all the
tests contained in the test runner. Instead you can filter just the
tests you want to run by using the TESTNAME environment variable.
This also dispenses with the ability to run stage0 tests, but they
tended to be broken more often than not anyway.
2011-07-13 02:01:09 +00:00
|
|
|
$(if $(findstring stage1,$(1)), \
|
2012-01-11 01:45:03 +00:00
|
|
|
stage1/$(CFG_LIBDIR), \
|
The Big Test Suite Overhaul
This replaces the make-based test runner with a set of Rust-based test
runners. I believe that all existing functionality has been
preserved. The primary objective is to dogfood the Rust test
framework.
A few main things happen here:
1) The run-pass/lib-* tests are all moved into src/test/stdtest. This
is a standalone test crate intended for all standard library tests. It
compiles to build/test/stdtest.stageN.
2) rustc now compiles into yet another build artifact, this one a test
runner that runs any tests contained directly in the rustc crate. This
allows much more fine-grained unit testing of the compiler. It
compiles to build/test/rustctest.stageN.
3) There is a new custom test runner crate at src/test/compiletest
that reproduces all the functionality for running the compile-fail,
run-fail, run-pass and bench tests while integrating with Rust's test
framework. It compiles to build/test/compiletest.stageN.
4) The build rules have been completely changed to use the new test
runners, while also being less redundant, following the example of the
recent stageN.mk rewrite.
It adds two new features to the cfail/rfail/rpass/bench tests:
1) Tests can specify multiple 'error-pattern' directives which must be
satisfied in order.
2) Tests can specify a 'compile-flags' directive which will make the
test runner provide additional command line arguments to rustc.
There are some downsides, the primary being that Rust has to be
functioning pretty well just to run _any_ tests, which I imagine will
be the source of some frustration when the entire test suite
breaks. Will also cause some headaches during porting.
Not having individual make rules, each rpass, etc test no longer
remembers between runs whether it completed successfully. As a result,
it's not possible to incrementally fix multiple tests by just running
'make check', fixing a test, and repeating without re-running all the
tests contained in the test runner. Instead you can filter just the
tests you want to run by using the TESTNAME environment variable.
This also dispenses with the ability to run stage0 tests, but they
tended to be broken more often than not anyway.
2011-07-13 02:01:09 +00:00
|
|
|
$(if $(findstring stage2,$(1)), \
|
2012-01-11 01:45:03 +00:00
|
|
|
stage2/$(CFG_LIBDIR), \
|
The Big Test Suite Overhaul
This replaces the make-based test runner with a set of Rust-based test
runners. I believe that all existing functionality has been
preserved. The primary objective is to dogfood the Rust test
framework.
A few main things happen here:
1) The run-pass/lib-* tests are all moved into src/test/stdtest. This
is a standalone test crate intended for all standard library tests. It
compiles to build/test/stdtest.stageN.
2) rustc now compiles into yet another build artifact, this one a test
runner that runs any tests contained directly in the rustc crate. This
allows much more fine-grained unit testing of the compiler. It
compiles to build/test/rustctest.stageN.
3) There is a new custom test runner crate at src/test/compiletest
that reproduces all the functionality for running the compile-fail,
run-fail, run-pass and bench tests while integrating with Rust's test
framework. It compiles to build/test/compiletest.stageN.
4) The build rules have been completely changed to use the new test
runners, while also being less redundant, following the example of the
recent stageN.mk rewrite.
It adds two new features to the cfail/rfail/rpass/bench tests:
1) Tests can specify multiple 'error-pattern' directives which must be
satisfied in order.
2) Tests can specify a 'compile-flags' directive which will make the
test runner provide additional command line arguments to rustc.
There are some downsides, the primary being that Rust has to be
functioning pretty well just to run _any_ tests, which I imagine will
be the source of some frustration when the entire test suite
breaks. Will also cause some headaches during porting.
Not having individual make rules, each rpass, etc test no longer
remembers between runs whether it completed successfully. As a result,
it's not possible to incrementally fix multiple tests by just running
'make check', fixing a test, and repeating without re-running all the
tests contained in the test runner. Instead you can filter just the
tests you want to run by using the TESTNAME environment variable.
This also dispenses with the ability to run stage0 tests, but they
tended to be broken more often than not anyway.
2011-07-13 02:01:09 +00:00
|
|
|
$(if $(findstring stage3,$(1)), \
|
2012-01-11 01:45:03 +00:00
|
|
|
stage3/$(CFG_LIBDIR), \
|
|
|
|
)))))/rustc/$(CFG_HOST_TRIPLE)/$(CFG_LIBDIR)
|
2011-05-01 20:18:52 +00:00
|
|
|
|
|
|
|
ifdef CFG_UNIXY
|
|
|
|
CFG_INFO := $(info cfg: unix-y environment)
|
|
|
|
|
|
|
|
CFG_PATH_MUNGE := true
|
|
|
|
CFG_EXE_SUFFIX :=
|
The Big Test Suite Overhaul
This replaces the make-based test runner with a set of Rust-based test
runners. I believe that all existing functionality has been
preserved. The primary objective is to dogfood the Rust test
framework.
A few main things happen here:
1) The run-pass/lib-* tests are all moved into src/test/stdtest. This
is a standalone test crate intended for all standard library tests. It
compiles to build/test/stdtest.stageN.
2) rustc now compiles into yet another build artifact, this one a test
runner that runs any tests contained directly in the rustc crate. This
allows much more fine-grained unit testing of the compiler. It
compiles to build/test/rustctest.stageN.
3) There is a new custom test runner crate at src/test/compiletest
that reproduces all the functionality for running the compile-fail,
run-fail, run-pass and bench tests while integrating with Rust's test
framework. It compiles to build/test/compiletest.stageN.
4) The build rules have been completely changed to use the new test
runners, while also being less redundant, following the example of the
recent stageN.mk rewrite.
It adds two new features to the cfail/rfail/rpass/bench tests:
1) Tests can specify multiple 'error-pattern' directives which must be
satisfied in order.
2) Tests can specify a 'compile-flags' directive which will make the
test runner provide additional command line arguments to rustc.
There are some downsides, the primary being that Rust has to be
functioning pretty well just to run _any_ tests, which I imagine will
be the source of some frustration when the entire test suite
breaks. Will also cause some headaches during porting.
Not having individual make rules, each rpass, etc test no longer
remembers between runs whether it completed successfully. As a result,
it's not possible to incrementally fix multiple tests by just running
'make check', fixing a test, and repeating without re-running all the
tests contained in the test runner. Instead you can filter just the
tests you want to run by using the TESTNAME environment variable.
This also dispenses with the ability to run stage0 tests, but they
tended to be broken more often than not anyway.
2011-07-13 02:01:09 +00:00
|
|
|
CFG_LDPATH :=
|
2011-10-09 22:23:41 +00:00
|
|
|
CFG_RUN=$(2)
|
|
|
|
CFG_RUN_TARG=$(call CFG_RUN,,$(2))
|
|
|
|
CFG_RUN_TEST=$(call CFG_RUN,,$(CFG_VALGRIND) $(1))
|
2011-08-04 21:11:33 +00:00
|
|
|
CFG_LIBUV_LINK_FLAGS=-lpthread
|
2011-05-01 20:18:52 +00:00
|
|
|
|
2011-06-27 18:53:04 +00:00
|
|
|
ifdef CFG_ENABLE_MINGW_CROSS
|
2011-06-27 19:43:45 +00:00
|
|
|
CFG_WINDOWSY := 1
|
2011-05-01 20:18:52 +00:00
|
|
|
CFG_INFO := $(info cfg: mingw-cross)
|
2011-05-09 04:10:04 +00:00
|
|
|
CFG_GCCISH_CROSS := i586-mingw32msvc-
|
2011-05-01 20:18:52 +00:00
|
|
|
ifdef CFG_VALGRIND
|
|
|
|
CFG_VALGRIND += wine
|
|
|
|
endif
|
2011-06-27 18:53:04 +00:00
|
|
|
|
2011-08-23 19:33:42 +00:00
|
|
|
CFG_GCCISH_CFLAGS := -fno-strict-aliasing -march=i586
|
2011-06-27 18:53:04 +00:00
|
|
|
CFG_GCCISH_PRE_LIB_FLAGS :=
|
|
|
|
CFG_GCCISH_POST_LIB_FLAGS :=
|
|
|
|
CFG_GCCISH_DEF_FLAG :=
|
2011-05-09 04:10:04 +00:00
|
|
|
CFG_GCCISH_LINK_FLAGS := -shared
|
2011-06-27 18:53:04 +00:00
|
|
|
|
2011-05-01 20:18:52 +00:00
|
|
|
ifeq ($(CFG_CPUTYPE), x86_64)
|
2011-05-09 04:10:04 +00:00
|
|
|
CFG_GCCISH_CFLAGS += -m32
|
|
|
|
CFG_GCCISH_LINK_FLAGS += -m32
|
2011-05-01 20:18:52 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifdef CFG_VALGRIND
|
2012-03-02 22:07:43 +00:00
|
|
|
CFG_VALGRIND += --error-exitcode=100 \
|
2012-02-03 20:22:53 +00:00
|
|
|
--quiet \
|
|
|
|
--suppressions=$(CFG_SRC_DIR)src/etc/x86.supp \
|
|
|
|
$(OS_SUPP)
|
2012-03-02 22:07:43 +00:00
|
|
|
ifdef CFG_ENABLE_HELGRIND
|
|
|
|
CFG_VALGRIND += --tool=helgrind
|
|
|
|
else
|
|
|
|
CFG_VALGRIND += --tool=memcheck \
|
|
|
|
--leak-check=full
|
|
|
|
endif
|
2011-05-01 20:18:52 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-06-28 18:18:25 +00:00
|
|
|
|
|
|
|
ifdef CFG_WINDOWSY
|
|
|
|
CFG_INFO := $(info cfg: windows-y environment)
|
|
|
|
|
|
|
|
CFG_EXE_SUFFIX := .exe
|
|
|
|
CFG_LIB_NAME=$(1).dll
|
2011-12-02 16:51:59 +00:00
|
|
|
CFG_LIB_GLOB=$(1)-*.dll
|
2011-06-28 18:18:25 +00:00
|
|
|
CFG_DEF_SUFFIX := .def
|
2012-02-17 21:25:14 +00:00
|
|
|
ifdef MSYSTEM
|
2011-06-28 18:18:25 +00:00
|
|
|
CFG_LDPATH :=$(CFG_LDPATH):$$PATH
|
The Big Test Suite Overhaul
This replaces the make-based test runner with a set of Rust-based test
runners. I believe that all existing functionality has been
preserved. The primary objective is to dogfood the Rust test
framework.
A few main things happen here:
1) The run-pass/lib-* tests are all moved into src/test/stdtest. This
is a standalone test crate intended for all standard library tests. It
compiles to build/test/stdtest.stageN.
2) rustc now compiles into yet another build artifact, this one a test
runner that runs any tests contained directly in the rustc crate. This
allows much more fine-grained unit testing of the compiler. It
compiles to build/test/rustctest.stageN.
3) There is a new custom test runner crate at src/test/compiletest
that reproduces all the functionality for running the compile-fail,
run-fail, run-pass and bench tests while integrating with Rust's test
framework. It compiles to build/test/compiletest.stageN.
4) The build rules have been completely changed to use the new test
runners, while also being less redundant, following the example of the
recent stageN.mk rewrite.
It adds two new features to the cfail/rfail/rpass/bench tests:
1) Tests can specify multiple 'error-pattern' directives which must be
satisfied in order.
2) Tests can specify a 'compile-flags' directive which will make the
test runner provide additional command line arguments to rustc.
There are some downsides, the primary being that Rust has to be
functioning pretty well just to run _any_ tests, which I imagine will
be the source of some frustration when the entire test suite
breaks. Will also cause some headaches during porting.
Not having individual make rules, each rpass, etc test no longer
remembers between runs whether it completed successfully. As a result,
it's not possible to incrementally fix multiple tests by just running
'make check', fixing a test, and repeating without re-running all the
tests contained in the test runner. Instead you can filter just the
tests you want to run by using the TESTNAME environment variable.
This also dispenses with the ability to run stage0 tests, but they
tended to be broken more often than not anyway.
2011-07-13 02:01:09 +00:00
|
|
|
CFG_RUN=PATH="$(CFG_LDPATH):$(1)" $(2)
|
2012-02-17 21:25:14 +00:00
|
|
|
else
|
|
|
|
CFG_LDPATH :=
|
|
|
|
CFG_RUN=$(2)
|
|
|
|
endif
|
2011-11-29 05:23:42 +00:00
|
|
|
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))
|
2011-08-04 21:11:33 +00:00
|
|
|
CFG_LIBUV_LINK_FLAGS=-lWs2_32
|
2011-06-28 18:18:25 +00:00
|
|
|
|
|
|
|
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;')
|
2011-08-23 19:33:42 +00:00
|
|
|
CFG_GCCISH_CFLAGS += -march=i686
|
2011-06-28 18:18:25 +00:00
|
|
|
CFG_GCCISH_LINK_FLAGS += -shared -fPIC
|
|
|
|
endif
|
2011-10-06 20:09:00 +00:00
|
|
|
CFG_INSTALL_NAME =
|
2011-06-28 18:18:25 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2011-08-05 15:57:39 +00:00
|
|
|
CFG_INFO := $(info cfg: using $(CFG_C_COMPILER))
|
|
|
|
ifeq ($(CFG_C_COMPILER),clang)
|
2012-03-28 21:13:00 +00:00
|
|
|
ifeq ($(origin CC),default)
|
|
|
|
CC=clang
|
|
|
|
endif
|
|
|
|
ifeq ($(origin CXX),default)
|
|
|
|
CXX=clang++
|
|
|
|
endif
|
|
|
|
ifeq ($(origin CPP),default)
|
|
|
|
CPP=cpp
|
|
|
|
endif
|
2012-03-13 01:03:10 +00:00
|
|
|
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -g
|
2011-05-09 04:10:04 +00:00
|
|
|
CFG_GCCISH_LINK_FLAGS += -g
|
2011-08-05 18:40:00 +00:00
|
|
|
CFG_DEPEND_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) -MT "$(1)" \
|
2011-05-09 04:10:04 +00:00
|
|
|
-MM $(2)
|
2011-11-01 23:50:47 +00:00
|
|
|
|
|
|
|
define CFG_MAKE_CC
|
|
|
|
CFG_COMPILE_C_$(1) = $$(CFG_GCCISH_CROSS)$$(CXX) \
|
|
|
|
$$(CFG_GCCISH_CFLAGS) $$(CFG_CLANG_CFLAGS) \
|
|
|
|
$$(CFG_GCCISH_CFLAGS_$$(HOST_$(1))) \
|
|
|
|
$$(CFG_CLANG_CFLAGS_$$(HOST_$(1))) \
|
|
|
|
-c -o $$(1) $$(2)
|
|
|
|
CFG_LINK_C_$(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))))
|
2011-05-09 04:10:04 +00:00
|
|
|
else
|
2011-08-05 15:57:39 +00:00
|
|
|
ifeq ($(CFG_C_COMPILER),gcc)
|
2012-03-28 21:13:00 +00:00
|
|
|
ifeq ($(origin CC),default)
|
|
|
|
CC=gcc
|
|
|
|
endif
|
|
|
|
ifeq ($(origin CXX),default)
|
|
|
|
CXX=g++
|
|
|
|
endif
|
|
|
|
ifeq ($(origin CPP),default)
|
|
|
|
CPP=cpp
|
|
|
|
endif
|
2011-09-04 22:48:22 +00:00
|
|
|
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -g
|
2011-05-09 04:10:04 +00:00
|
|
|
CFG_GCCISH_LINK_FLAGS += -g
|
2011-08-05 18:40:00 +00:00
|
|
|
CFG_DEPEND_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) -MT "$(1)" \
|
2011-05-09 04:10:04 +00:00
|
|
|
-MM $(2)
|
2011-11-01 23:50:47 +00:00
|
|
|
|
|
|
|
define CFG_MAKE_CC
|
|
|
|
CFG_COMPILE_C_$(1) = $$(CFG_GCCISH_CROSS)$$(CXX) \
|
|
|
|
$$(CFG_GCCISH_CFLAGS) \
|
|
|
|
$$(CFG_GCCISH_CFLAGS_$$(HOST_$(1))) \
|
|
|
|
$$(CFG_GCC_CFLAGS) \
|
|
|
|
$$(CFG_GCC_CFLAGS_$$(HOST_$(1))) \
|
|
|
|
-c -o $$(1) $$(2)
|
|
|
|
CFG_LINK_C_$(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))))
|
2011-05-01 20:18:52 +00:00
|
|
|
else
|
2011-05-09 04:10:04 +00:00
|
|
|
CFG_ERR := $(error please try on a system with gcc or clang)
|
|
|
|
endif
|
2011-05-01 20:18:52 +00:00
|
|
|
endif
|
2011-11-01 23:50:47 +00:00
|
|
|
|
2011-12-10 00:02:50 +00:00
|
|
|
# We're using llvm-mc as our assembler because it supports
|
|
|
|
# .cfi pseudo-ops on mac
|
|
|
|
define CFG_MAKE_ASSEMBLER
|
|
|
|
CFG_ASSEMBLE_$(1)=$$(CPP) $$(2) | \
|
|
|
|
$$(LLVM_MC_$$(CFG_HOST_TRIPLE)) \
|
|
|
|
-assemble \
|
|
|
|
-filetype=obj \
|
|
|
|
-triple=$(1) \
|
|
|
|
-o=$$(1)
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach target,$(CFG_TARGET_TRIPLES),\
|
2011-12-30 08:18:55 +00:00
|
|
|
$(eval $(call CFG_MAKE_ASSEMBLER,$(target))))
|