2011-05-04 03:09:18 +02:00
|
|
|
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_GCCISH_CFLAGS := -fno-strict-aliasing
|
|
|
|
CFG_GCCISH_LINK_FLAGS :=
|
2011-05-01 22:18:52 +02: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
|
|
|
|
|
|
|
|
ifeq ($(CFG_OSTYPE), FreeBSD)
|
|
|
|
CFG_LIB_NAME=lib$(1).so
|
2011-08-23 21:33:42 +02:00
|
|
|
CFG_GCCISH_CFLAGS += -fPIC -march=i686 -I/usr/local/include
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_GCCISH_LINK_FLAGS += -shared -fPIC -lpthread -lrt
|
2011-05-01 22:18:52 +02:00
|
|
|
ifeq ($(CFG_CPUTYPE), x86_64)
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_GCCISH_CFLAGS += -m32
|
|
|
|
CFG_GCCISH_LINK_FLAGS += -m32
|
2011-05-01 22:18:52 +02:00
|
|
|
endif
|
|
|
|
CFG_UNIXY := 1
|
|
|
|
CFG_LDENV := LD_LIBRARY_PATH
|
|
|
|
CFG_DEF_SUFFIX := .bsd.def
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CFG_OSTYPE), Linux)
|
|
|
|
CFG_LIB_NAME=lib$(1).so
|
2011-08-23 21:33:42 +02:00
|
|
|
CFG_GCCISH_CFLAGS += -fPIC -march=i686
|
2011-05-09 06:10:04 +02: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
|
|
|
|
CFG_GCCISH_POST_LIB_FLAGS := -Wl,-no-whole-archive
|
2011-05-01 22:18:52 +02:00
|
|
|
ifeq ($(CFG_CPUTYPE), x86_64)
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_GCCISH_CFLAGS += -m32
|
|
|
|
CFG_GCCISH_LINK_FLAGS += -m32
|
2011-05-01 22:18:52 +02:00
|
|
|
endif
|
|
|
|
CFG_UNIXY := 1
|
|
|
|
CFG_LDENV := LD_LIBRARY_PATH
|
|
|
|
CFG_DEF_SUFFIX := .linux.def
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CFG_OSTYPE), Darwin)
|
|
|
|
CFG_LIB_NAME=lib$(1).dylib
|
|
|
|
CFG_UNIXY := 1
|
|
|
|
CFG_LDENV := DYLD_LIBRARY_PATH
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_GCCISH_LINK_FLAGS += -dynamiclib -lpthread
|
|
|
|
CFG_GCCISH_DEF_FLAG := -Wl,-exported_symbols_list,
|
2011-05-01 22:18:52 +02: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-08-23 21:33:42 +02:00
|
|
|
CFG_GCC_CFLAGS += -m32
|
|
|
|
CFG_CLANG_CFLAGS += -m32
|
2011-05-09 06:10:04 +02:00
|
|
|
ifeq ($(CFG_CPUTYPE), x86_64)
|
|
|
|
CFG_GCCISH_CFLAGS += -arch i386
|
|
|
|
CFG_GCCISH_LINK_FLAGS += -arch i386
|
|
|
|
endif
|
|
|
|
CFG_GCCISH_LINK_FLAGS += -m32
|
2011-05-01 22:18:52 +02:00
|
|
|
CFG_DSYMUTIL := dsymutil
|
|
|
|
CFG_DEF_SUFFIX := .darwin.def
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(findstring MINGW,$(CFG_OSTYPE)),)
|
|
|
|
CFG_WINDOWSY := 1
|
|
|
|
endif
|
|
|
|
|
2011-08-23 21:33:42 +02: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
|
|
|
|
|
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 04:01:09 +02:00
|
|
|
CFG_TESTLIB=$(CFG_BUILD_DIR)/$(strip \
|
|
|
|
$(if $(findstring stage0,$(1)), \
|
|
|
|
stage0/lib, \
|
|
|
|
$(if $(findstring stage1,$(1)), \
|
|
|
|
stage1/lib, \
|
|
|
|
$(if $(findstring stage2,$(1)), \
|
|
|
|
stage2/lib, \
|
|
|
|
$(if $(findstring stage3,$(1)), \
|
|
|
|
stage3/lib, \
|
|
|
|
)))))
|
2011-05-01 22:18:52 +02: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 04:01:09 +02:00
|
|
|
CFG_LDPATH :=
|
|
|
|
CFG_RUN=$(CFG_LDENV)=$(1) $(2)
|
|
|
|
CFG_RUN_TARG=$(call CFG_RUN,$(CFG_BUILD_DIR)/$(1),$(2))
|
|
|
|
CFG_RUN_TEST=$(call CFG_RUN,$(call CFG_TESTLIB,$(1)),\
|
|
|
|
$(CFG_VALGRIND) $(1))
|
2011-08-04 23:11:33 +02:00
|
|
|
CFG_LIBUV_LINK_FLAGS=-lpthread
|
2011-05-01 22:18:52 +02:00
|
|
|
|
2011-06-27 20:53:04 +02:00
|
|
|
ifdef CFG_ENABLE_MINGW_CROSS
|
2011-06-27 21:43:45 +02:00
|
|
|
CFG_WINDOWSY := 1
|
2011-05-01 22:18:52 +02:00
|
|
|
CFG_INFO := $(info cfg: mingw-cross)
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_GCCISH_CROSS := i586-mingw32msvc-
|
2011-05-01 22:18:52 +02:00
|
|
|
ifdef CFG_VALGRIND
|
|
|
|
CFG_VALGRIND += wine
|
|
|
|
endif
|
2011-06-27 20:53:04 +02:00
|
|
|
|
2011-08-23 21:33:42 +02:00
|
|
|
CFG_GCCISH_CFLAGS := -fno-strict-aliasing -march=i586
|
2011-06-27 20:53:04 +02:00
|
|
|
CFG_GCCISH_PRE_LIB_FLAGS :=
|
|
|
|
CFG_GCCISH_POST_LIB_FLAGS :=
|
|
|
|
CFG_GCCISH_DEF_FLAG :=
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_GCCISH_LINK_FLAGS := -shared
|
2011-06-27 20:53:04 +02:00
|
|
|
|
2011-05-01 22:18:52 +02:00
|
|
|
ifeq ($(CFG_CPUTYPE), x86_64)
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_GCCISH_CFLAGS += -m32
|
|
|
|
CFG_GCCISH_LINK_FLAGS += -m32
|
2011-05-01 22:18:52 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifdef CFG_VALGRIND
|
|
|
|
CFG_VALGRIND += --leak-check=full \
|
|
|
|
--error-exitcode=1 \
|
2011-06-27 21:39:37 +02:00
|
|
|
--quiet --suppressions=$(CFG_SRC_DIR)src/etc/x86.supp
|
2011-05-01 22:18:52 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2011-06-28 20:18:25 +02:00
|
|
|
|
|
|
|
ifdef CFG_WINDOWSY
|
|
|
|
CFG_INFO := $(info cfg: windows-y environment)
|
|
|
|
|
|
|
|
CFG_EXE_SUFFIX := .exe
|
|
|
|
CFG_LIB_NAME=$(1).dll
|
|
|
|
CFG_DEF_SUFFIX := .def
|
2011-07-07 15:39:11 +02:00
|
|
|
CFG_LDPATH :=$(CFG_LLVM_BINDIR)
|
2011-06-28 20:18:25 +02: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 04:01:09 +02:00
|
|
|
CFG_RUN=PATH="$(CFG_LDPATH):$(1)" $(2)
|
|
|
|
CFG_RUN_TARG=$(call CFG_RUN,,$(2))
|
|
|
|
CFG_RUN_TEST=$(call CFG_RUN,$(call CFG_TESTLIB,$(1)),$(1))
|
2011-08-04 23:11:33 +02:00
|
|
|
CFG_LIBUV_LINK_FLAGS=-lWs2_32
|
2011-06-28 20:18:25 +02: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 21:33:42 +02:00
|
|
|
CFG_GCCISH_CFLAGS += -march=i686
|
2011-06-28 20:18:25 +02:00
|
|
|
CFG_GCCISH_LINK_FLAGS += -shared -fPIC
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2011-08-05 17:57:39 +02:00
|
|
|
CFG_INFO := $(info cfg: using $(CFG_C_COMPILER))
|
|
|
|
ifeq ($(CFG_C_COMPILER),clang)
|
2011-08-05 20:40:00 +02:00
|
|
|
CC=clang
|
|
|
|
CXX=clang++
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -fno-exceptions -g
|
|
|
|
CFG_GCCISH_LINK_FLAGS += -g
|
2011-08-05 20:40:00 +02:00
|
|
|
CFG_COMPILE_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) \
|
2011-05-09 06:10:04 +02:00
|
|
|
$(CFG_CLANG_CFLAGS) -c -o $(1) $(2)
|
2011-08-05 20:40:00 +02:00
|
|
|
CFG_DEPEND_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) -MT "$(1)" \
|
2011-05-09 06:10:04 +02:00
|
|
|
-MM $(2)
|
2011-08-05 20:40:00 +02:00
|
|
|
CFG_LINK_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_LINK_FLAGS) -o $(1) \
|
2011-05-09 06:10:04 +02:00
|
|
|
$(CFG_GCCISH_DEF_FLAG)$(3) $(2)
|
|
|
|
else
|
2011-08-05 17:57:39 +02:00
|
|
|
ifeq ($(CFG_C_COMPILER),gcc)
|
2011-08-05 20:40:00 +02:00
|
|
|
CC=gcc
|
|
|
|
CXX=g++
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_GCCISH_CFLAGS += -Wall -Werror -fno-rtti -fno-exceptions -g
|
|
|
|
CFG_GCCISH_LINK_FLAGS += -g
|
2011-08-05 20:40:00 +02:00
|
|
|
CFG_COMPILE_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) \
|
2011-05-09 06:10:04 +02:00
|
|
|
$(CFG_GCC_CFLAGS) -c -o $(1) $(2)
|
2011-08-05 20:40:00 +02:00
|
|
|
CFG_DEPEND_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_CFLAGS) -MT "$(1)" \
|
2011-05-09 06:10:04 +02:00
|
|
|
-MM $(2)
|
2011-08-05 20:40:00 +02:00
|
|
|
CFG_LINK_C = $(CFG_GCCISH_CROSS)$(CXX) $(CFG_GCCISH_LINK_FLAGS) -o $(1) \
|
2011-05-09 06:10:04 +02:00
|
|
|
$(CFG_GCCISH_DEF_FLAG)$(3) $(2)
|
2011-05-01 22:18:52 +02:00
|
|
|
else
|
2011-05-09 06:10:04 +02:00
|
|
|
CFG_ERR := $(error please try on a system with gcc or clang)
|
|
|
|
endif
|
2011-05-01 22:18:52 +02:00
|
|
|
endif
|