2011-03-16 17:17:32 +01:00
|
|
|
######################################################################
|
|
|
|
# Residual auto-configuration
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
include config.mk
|
|
|
|
MKFILES := Makefile config.mk
|
|
|
|
|
|
|
|
ifneq ($(MAKE_RESTARTS),)
|
|
|
|
CFG_INFO := $(info cfg: make restarts: $(MAKE_RESTARTS))
|
|
|
|
endif
|
|
|
|
|
|
|
|
CFG_INFO := $(info cfg: building on $(CFG_OSTYPE) $(CFG_CPUTYPE))
|
|
|
|
|
2011-04-08 03:14:13 +02:00
|
|
|
CFG_GCC_CFLAGS := -fno-strict-aliasing
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_GCC_LINK_FLAGS :=
|
|
|
|
CFG_BOOT_FLAGS := $(BOOT_FLAGS)
|
2011-04-07 21:42:06 +02:00
|
|
|
CFG_RUSTC_FLAGS := -nowarn -O
|
2011-03-18 07:51:45 +01: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)
|
2011-03-19 00:05:56 +01:00
|
|
|
CFG_LIB_NAME=lib$(1).so
|
2011-04-08 03:14:13 +02:00
|
|
|
CFG_GCC_CFLAGS += -fPIC -march=i686 -I/usr/local/include -O2
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_GCC_LINK_FLAGS += -shared -fPIC -lpthread -lrt
|
|
|
|
ifeq ($(CFG_CPUTYPE), x86_64)
|
|
|
|
CFG_GCC_CFLAGS += -m32
|
|
|
|
CFG_GCC_LINK_FLAGS += -m32
|
|
|
|
endif
|
|
|
|
CFG_UNIXY := 1
|
2011-03-23 21:10:30 +01:00
|
|
|
CFG_LDENV := LD_LIBRARY_PATH
|
2011-03-24 19:26:46 +01:00
|
|
|
CFG_DEF_SUFFIX := .bsd.def
|
2011-03-18 07:51:45 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CFG_OSTYPE), Linux)
|
2011-03-19 00:05:56 +01:00
|
|
|
CFG_LIB_NAME=lib$(1).so
|
2011-04-08 03:14:13 +02:00
|
|
|
CFG_GCC_CFLAGS += -fPIC -march=i686 -O2
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_GCC_LINK_FLAGS += -shared -fPIC -ldl -lpthread -lrt
|
2011-03-24 22:17:29 +01:00
|
|
|
CFG_GCC_DEF_FLAG := -Wl,-whole-archive,--export-dynamic,--dynamic-list=
|
|
|
|
CFG_GCC_POST_LIB_FLAGS := -Wl,-no-whole-archive
|
2011-03-18 07:51:45 +01:00
|
|
|
ifeq ($(CFG_CPUTYPE), x86_64)
|
|
|
|
CFG_GCC_CFLAGS += -m32
|
|
|
|
CFG_GCC_LINK_FLAGS += -m32
|
|
|
|
endif
|
|
|
|
CFG_UNIXY := 1
|
2011-03-23 21:10:30 +01:00
|
|
|
CFG_LDENV := LD_LIBRARY_PATH
|
2011-03-24 19:26:46 +01:00
|
|
|
CFG_DEF_SUFFIX := .linux.def
|
2011-03-18 07:51:45 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CFG_OSTYPE), Darwin)
|
2011-03-19 00:05:56 +01:00
|
|
|
CFG_LIB_NAME=lib$(1).dylib
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_UNIXY := 1
|
2011-03-23 21:10:30 +01:00
|
|
|
CFG_LDENV := DYLD_LIBRARY_PATH
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_GCC_LINK_FLAGS += -dynamiclib -lpthread
|
2011-03-24 19:43:51 +01:00
|
|
|
CFG_GCC_DEF_FLAG := -Wl,-exported_symbols_list,
|
2011-03-18 07:51:45 +01: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!
|
2011-04-08 03:14:13 +02:00
|
|
|
#
|
|
|
|
# NB: Currently GCC's optimizer breaks rustrt (task-comm-1 hangs) on Darwin.
|
|
|
|
CFG_GCC_CFLAGS += -m32 -O0
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_GCC_LINK_FLAGS += -m32
|
|
|
|
CFG_DSYMUTIL := dsymutil
|
2011-03-24 19:26:46 +01:00
|
|
|
CFG_DEF_SUFFIX := .darwin.def
|
2011-03-18 07:51:45 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(findstring MINGW,$(CFG_OSTYPE)),)
|
|
|
|
CFG_WINDOWSY := 1
|
|
|
|
endif
|
|
|
|
|
2011-03-20 02:34:19 +01:00
|
|
|
CFG_LDPATH :=$(CFG_BUILD_DIR)/rt
|
2011-03-22 07:06:42 +01:00
|
|
|
CFG_LDPATH :=$(CFG_LDPATH):$(CFG_BUILD_DIR)/rustllvm
|
2011-03-29 23:56:24 +02:00
|
|
|
CFG_TESTLIB=$(dir $(firstword $(1))):$(patsubst .%,%,$(suffix $(1)))
|
2011-03-30 00:21:39 +02:00
|
|
|
CFG_EXE_TESTLIB=$(call CFG_TESTLIB,$(patsubst %.exe,%,$(1)))
|
2011-03-20 02:34:19 +01:00
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
ifdef CFG_WINDOWSY
|
|
|
|
CFG_INFO := $(info cfg: windows-y environment)
|
|
|
|
|
|
|
|
CFG_EXE_SUFFIX := .exe
|
|
|
|
CFG_LIB_NAME=$(1).dll
|
2011-03-20 02:34:19 +01:00
|
|
|
CFG_LDPATH :=$(CFG_LDPATH):$(CFG_LLVM_BINDIR)
|
|
|
|
CFG_LDPATH :=$(CFG_LDPATH):$$PATH
|
2011-03-29 23:56:24 +02:00
|
|
|
CFG_RUN_TEST=PATH="$(CFG_LDPATH):$(call CFG_EXE_TESTLIB,$(1))" $(1)
|
2011-03-21 19:55:17 +01:00
|
|
|
CFG_RUN_TARG=PATH="$(CFG_LDPATH)" $(1)
|
2011-03-18 07:51:45 +01:00
|
|
|
|
2011-03-23 22:35:28 +01:00
|
|
|
CFG_PATH_MUNGE := $(strip perl -i.bak -p \
|
|
|
|
-e 's@\\(\S)@/\1@go;' \
|
2011-03-20 02:33:16 +01:00
|
|
|
-e 's@^/([a-zA-Z])/@\1:/@o;')
|
2011-03-18 07:51:45 +01:00
|
|
|
ifdef CFG_FLEXLINK
|
|
|
|
CFG_BOOT_NATIVE := 1
|
|
|
|
endif
|
2011-04-08 03:14:13 +02:00
|
|
|
CFG_GCC_CFLAGS += -march=i686 -O2
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_GCC_LINK_FLAGS += -shared -fPIC
|
2011-03-24 19:26:46 +01:00
|
|
|
CFG_DEF_SUFFIX := .def
|
2011-03-18 07:51:45 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef CFG_UNIXY
|
|
|
|
CFG_INFO := $(info cfg: unix-y environment)
|
|
|
|
|
2011-03-24 20:40:07 +01:00
|
|
|
CFG_PATH_MUNGE := true
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_EXE_SUFFIX :=
|
2011-03-20 02:34:19 +01:00
|
|
|
CFG_LDPATH :=$(CFG_LDPATH):$(CFG_LLVM_LIBDIR)
|
2011-03-25 02:43:32 +01:00
|
|
|
CFG_RUN_TARG=$(CFG_LDENV)=$(CFG_LDPATH) $(1)
|
2011-03-21 19:02:37 +01:00
|
|
|
CFG_RUN_TEST=\
|
2011-03-29 23:56:24 +02:00
|
|
|
$(CFG_LDENV)=$(call CFG_TESTLIB,$(1)):$(CFG_LDPATH) \
|
2011-03-21 23:29:59 +01:00
|
|
|
$(CFG_VALGRIND) $(1)
|
2011-03-18 07:51:45 +01:00
|
|
|
|
|
|
|
CFG_BOOT_NATIVE := 1
|
|
|
|
|
|
|
|
ifdef MINGW_CROSS
|
|
|
|
CFG_EXE_SUFFIX := .exe
|
|
|
|
CFG_LIB_NAME=$(1).dll
|
2011-03-20 02:34:19 +01:00
|
|
|
CFG_LDPATH :=$(CFG_LDPATH):$(CFG_LLVM_BINDIR)
|
|
|
|
CFG_LDPATH :=$(CFG_LDPATH):$$PATH
|
2011-03-20 09:12:26 +01:00
|
|
|
CFG_RUN_TARG=PATH=$(CFG_LDPATH) $(1)
|
2011-03-29 23:56:24 +02:00
|
|
|
CFG_RUN_TEST=PATH=$(CFG_LDPATH):$(call CFG_EXE_TESTLIB,$(1)) $(1)
|
2011-03-18 07:51:45 +01:00
|
|
|
|
|
|
|
CFG_INFO := $(info cfg: mingw-cross)
|
|
|
|
CFG_GCC_CROSS := i586-mingw32msvc-
|
|
|
|
CFG_BOOT_FLAGS += -t win32-x86-pe
|
|
|
|
ifdef CFG_VALGRIND
|
|
|
|
CFG_VALGRIND += wine
|
|
|
|
endif
|
|
|
|
CFG_GCC_CFLAGS := -march=i686
|
|
|
|
CFG_GCC_LINK_FLAGS := -shared
|
|
|
|
ifeq ($(CFG_CPUTYPE), x86_64)
|
|
|
|
CFG_GCC_CFLAGS += -m32
|
|
|
|
CFG_GCC_LINK_FLAGS += -m32
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifdef CFG_VALGRIND
|
|
|
|
CFG_VALGRIND += --leak-check=full \
|
|
|
|
--error-exitcode=1 \
|
|
|
|
--quiet --vex-iropt-level=0 \
|
2011-03-21 19:02:15 +01:00
|
|
|
--suppressions=$(CFG_SRC_DIR)src/etc/x86.supp
|
2011-03-18 07:51:45 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
CFG_RUNTIME :=$(call CFG_LIB_NAME,rustrt)
|
2011-03-22 07:06:42 +01:00
|
|
|
CFG_RUSTLLVM :=$(call CFG_LIB_NAME,rustllvm)
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_STDLIB :=$(call CFG_LIB_NAME,std)
|
|
|
|
|
2011-03-25 02:43:32 +01:00
|
|
|
CFG_LLC_CFLAGS := -march=x86 -relocation-model=pic
|
2011-03-19 02:32:31 +01:00
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
ifdef CFG_GCC
|
|
|
|
CFG_INFO := $(info cfg: using gcc)
|
|
|
|
CFG_GCC_CFLAGS += -Wall -Werror -fno-rtti -fno-exceptions -g
|
|
|
|
CFG_GCC_LINK_FLAGS += -g
|
|
|
|
CFG_COMPILE_C = $(CFG_GCC_CROSS)g++ $(CFG_GCC_CFLAGS) -c -o $(1) $(2)
|
|
|
|
CFG_DEPEND_C = $(CFG_GCC_CROSS)g++ $(CFG_GCC_CFLAGS) -MT "$(1)" -MM $(2)
|
2011-03-24 19:26:46 +01:00
|
|
|
CFG_LINK_C = $(CFG_GCC_CROSS)g++ $(CFG_GCC_LINK_FLAGS) -o $(1) \
|
2011-03-24 19:43:51 +01:00
|
|
|
$(CFG_GCC_DEF_FLAG)$(3) $(2)
|
2011-03-18 07:51:45 +01:00
|
|
|
else
|
|
|
|
CFG_ERR := $(error please try on a system with gcc)
|
|
|
|
endif
|
|
|
|
|
2011-03-16 17:17:32 +01:00
|
|
|
ifdef CFG_OCAMLC_OPT
|
2011-03-18 07:51:45 +01:00
|
|
|
$(info cfg: have ocaml native compiler)
|
2011-03-16 17:17:32 +01:00
|
|
|
OPT=.opt
|
|
|
|
else
|
2011-03-18 07:51:45 +01:00
|
|
|
$(info cfg: have only ocaml bytecode compiler)
|
2011-03-16 17:17:32 +01:00
|
|
|
endif
|
|
|
|
|
2011-03-30 06:45:09 +02:00
|
|
|
ifdef CFG_BOOT_PROFILE
|
|
|
|
$(info cfg: forcing native bootstrap compiler (CFG_BOOT_PROFILE))
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_BOOT_NATIVE := 1
|
2011-03-16 17:17:32 +01:00
|
|
|
CFG_OCAMLOPT_PROFILE_FLAGS := -p
|
|
|
|
endif
|
|
|
|
|
2011-03-30 06:45:09 +02:00
|
|
|
ifdef CFG_BOOT_DEBUG
|
|
|
|
$(info cfg: forcing bytecode bootstrap compiler (CFG_BOOT_DEBUG))
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_BOOT_NATIVE :=
|
2011-03-16 17:17:32 +01:00
|
|
|
endif
|
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
ifdef CFG_BOOT_NATIVE
|
2011-03-16 17:17:32 +01:00
|
|
|
$(info cfg: building native bootstrap compiler)
|
|
|
|
else
|
|
|
|
$(info cfg: building bytecode bootstrap compiler)
|
|
|
|
endif
|
|
|
|
|
2011-03-30 06:45:09 +02:00
|
|
|
ifdef CFG_DISABLE_VALGRIND
|
|
|
|
$(info cfg: disabling valgrind (CFG_DISABLE_VALGRIND))
|
2011-03-18 07:51:45 +01:00
|
|
|
CFG_VALGRIND :=
|
|
|
|
endif
|
|
|
|
|
2011-03-23 18:37:35 +01:00
|
|
|
DOCS :=
|
|
|
|
ifeq ($(CFG_MAKEINFO),)
|
|
|
|
$(info cfg: no makeinfo found, omitting doc/rust.html)
|
|
|
|
else
|
|
|
|
DOCS += doc/rust.html
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CFG_TEXI2PDF),)
|
|
|
|
$(info cfg: no texi2pdf found, omitting doc/rust.pdf)
|
|
|
|
else
|
2011-03-23 21:31:51 +01:00
|
|
|
ifeq ($(CFG_TEX),)
|
|
|
|
$(info cfg: no tex found, omitting doc/rust.pdf)
|
|
|
|
else
|
|
|
|
DOCS += doc/rust.pdf
|
|
|
|
endif
|
2011-03-23 18:37:35 +01:00
|
|
|
endif
|
|
|
|
|
2011-03-30 06:45:09 +02:00
|
|
|
ifdef CFG_DISABLE_DOCS
|
|
|
|
$(info cfg: disabling doc build (CFG_DISABLE_DOCS))
|
|
|
|
DOCS :=
|
|
|
|
endif
|
2011-03-23 18:37:35 +01:00
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
######################################################################
|
|
|
|
# Target-and-rule "utility variables"
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
ifdef VERBOSE
|
|
|
|
Q :=
|
|
|
|
E =
|
|
|
|
else
|
|
|
|
Q := @
|
|
|
|
E = echo $(1)
|
2011-03-16 17:17:32 +01:00
|
|
|
endif
|
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
S := $(CFG_SRC_DIR)
|
|
|
|
X := $(CFG_EXE_SUFFIX)
|
|
|
|
|
|
|
|
# Look in doc and src dirs.
|
|
|
|
VPATH := $(S)doc $(S)src
|
|
|
|
|
|
|
|
# Compilers we build, we now know how to run.
|
2011-03-21 03:42:27 +01:00
|
|
|
BOOT := $(Q)OCAMLRUNPARAM="b1" boot/rustboot$(X) $(CFG_BOOT_FLAGS) -L boot
|
2011-03-21 22:52:02 +01:00
|
|
|
STAGE0 := $(Q)$(call CFG_RUN_TARG,\
|
|
|
|
stage0/rustc$(X) $(CFG_RUSTC_FLAGS) -L stage0)
|
|
|
|
STAGE1 := $(Q)$(call CFG_RUN_TARG,\
|
|
|
|
stage1/rustc$(X) $(CFG_RUSTC_FLAGS) -L stage1)
|
2011-03-18 07:51:45 +01:00
|
|
|
|
|
|
|
# "Source" files we generate in builddir along the way.
|
|
|
|
GENERATED := boot/fe/lexer.ml boot/version.ml
|
|
|
|
|
|
|
|
# Delete the built-in rules.
|
|
|
|
.SUFFIXES:
|
|
|
|
%:: %,v
|
|
|
|
%:: RCS/%,v
|
|
|
|
%:: RCS/%
|
|
|
|
%:: s.%
|
|
|
|
%:: SCCS/s.%
|
2011-03-16 17:17:32 +01:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Bootstrap compiler variables
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
# We must list them in link order.
|
|
|
|
# Nobody calculates the link-order DAG automatically, sadly.
|
|
|
|
|
|
|
|
BOOT_MLS := \
|
|
|
|
$(addsuffix .ml, \
|
2011-03-17 22:26:24 +01:00
|
|
|
boot/version \
|
|
|
|
$(addprefix boot/util/, fmt common bits) \
|
2011-03-16 17:17:32 +01:00
|
|
|
$(addprefix boot/driver/, session) \
|
|
|
|
$(addprefix boot/fe/, ast token lexer parser \
|
|
|
|
extfmt pexp item cexp fuzz) \
|
|
|
|
$(addprefix boot/be/, asm il abi) \
|
|
|
|
$(addprefix boot/me/, walk semant resolve alias \
|
|
|
|
simplify type dead layer effect typestate \
|
|
|
|
loop layout transutil trans dwarf) \
|
|
|
|
$(addprefix boot/be/, x86 ra pe elf macho) \
|
|
|
|
$(addprefix boot/driver/, lib glue main)) \
|
|
|
|
|
|
|
|
BOOT_CMOS := $(BOOT_MLS:.ml=.cmo)
|
|
|
|
BOOT_CMXS := $(BOOT_MLS:.ml=.cmx)
|
|
|
|
BOOT_OBJS := $(BOOT_MLS:.ml=.o)
|
|
|
|
BOOT_CMIS := $(BOOT_MLS:.ml=.cmi)
|
|
|
|
|
2011-03-23 00:57:44 +01:00
|
|
|
BS := $(S)src/boot
|
2011-03-18 07:51:45 +01:00
|
|
|
|
|
|
|
BOOT_ML_DEP_INCS := -I $(BS)/fe -I $(BS)/me \
|
|
|
|
-I $(BS)/be -I $(BS)/driver \
|
|
|
|
-I $(BS)/util -I boot
|
|
|
|
|
|
|
|
BOOT_ML_INCS := -I boot/fe -I boot/me \
|
|
|
|
-I boot/be -I boot/driver \
|
|
|
|
-I boot/util -I boot
|
2011-03-16 17:17:32 +01:00
|
|
|
|
2011-03-17 22:26:24 +01:00
|
|
|
BOOT_ML_LIBS := unix.cma nums.cma bigarray.cma
|
|
|
|
BOOT_ML_NATIVE_LIBS := unix.cmxa nums.cmxa bigarray.cmxa
|
|
|
|
BOOT_OCAMLC_FLAGS := -g $(BOOT_ML_INCS) -w Ael -warn-error Ael
|
2011-03-18 07:51:45 +01:00
|
|
|
BOOT_OCAMLOPT_FLAGS := -g $(BOOT_ML_INCS) -w Ael -warn-error Ael
|
|
|
|
|
2011-03-24 00:36:43 +01:00
|
|
|
ifdef CFG_FLEXLINK
|
|
|
|
BOOT_OCAMLOPT_FLAGS += -cclib -L/usr/lib
|
|
|
|
endif
|
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
######################################################################
|
|
|
|
# Runtime (C++) library variables
|
|
|
|
######################################################################
|
2011-03-16 17:17:32 +01:00
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
RUNTIME_CS := rt/sync/timer.cpp \
|
|
|
|
rt/sync/sync.cpp \
|
|
|
|
rt/sync/lock_and_signal.cpp \
|
|
|
|
rt/rust.cpp \
|
|
|
|
rt/rust_builtin.cpp \
|
|
|
|
rt/rust_run_program.cpp \
|
|
|
|
rt/rust_crate.cpp \
|
|
|
|
rt/rust_crate_cache.cpp \
|
|
|
|
rt/rust_crate_reader.cpp \
|
|
|
|
rt/rust_comm.cpp \
|
|
|
|
rt/rust_dom.cpp \
|
|
|
|
rt/rust_task.cpp \
|
|
|
|
rt/rust_task_list.cpp \
|
|
|
|
rt/rust_proxy.cpp \
|
|
|
|
rt/rust_chan.cpp \
|
|
|
|
rt/rust_port.cpp \
|
|
|
|
rt/rust_upcall.cpp \
|
|
|
|
rt/rust_log.cpp \
|
|
|
|
rt/rust_message.cpp \
|
|
|
|
rt/rust_timer.cpp \
|
|
|
|
rt/circular_buffer.cpp \
|
|
|
|
rt/isaac/randport.cpp \
|
|
|
|
rt/rust_srv.cpp \
|
|
|
|
rt/rust_kernel.cpp \
|
|
|
|
rt/memory_region.cpp \
|
|
|
|
rt/test/rust_test_harness.cpp \
|
|
|
|
rt/test/rust_test_runtime.cpp \
|
|
|
|
rt/test/rust_test_util.cpp
|
|
|
|
|
|
|
|
RUNTIME_HDR := rt/globals.h \
|
|
|
|
rt/rust.h \
|
|
|
|
rt/rust_dwarf.h \
|
|
|
|
rt/rust_internal.h \
|
|
|
|
rt/rust_util.h \
|
|
|
|
rt/rust_chan.h \
|
|
|
|
rt/rust_port.h \
|
|
|
|
rt/rust_dom.h \
|
|
|
|
rt/rust_task.h \
|
|
|
|
rt/rust_task_list.h \
|
|
|
|
rt/rust_proxy.h \
|
|
|
|
rt/rust_log.h \
|
|
|
|
rt/rust_message.h \
|
|
|
|
rt/circular_buffer.h \
|
|
|
|
rt/util/array_list.h \
|
|
|
|
rt/util/indexed_list.h \
|
|
|
|
rt/util/synchronized_indexed_list.h \
|
|
|
|
rt/util/hash_map.h \
|
|
|
|
rt/sync/sync.h \
|
|
|
|
rt/sync/timer.h \
|
2011-03-22 00:16:15 +01:00
|
|
|
rt/sync/lock_and_signal.h \
|
2011-03-18 07:51:45 +01:00
|
|
|
rt/sync/lock_free_queue.h \
|
|
|
|
rt/rust_srv.h \
|
|
|
|
rt/rust_kernel.h \
|
|
|
|
rt/memory_region.h \
|
|
|
|
rt/memory.h \
|
|
|
|
rt/test/rust_test_harness.h \
|
|
|
|
rt/test/rust_test_runtime.h \
|
|
|
|
rt/test/rust_test_util.h
|
|
|
|
|
2011-03-24 20:22:28 +01:00
|
|
|
RUNTIME_DEF := rt/rustrt$(CFG_DEF_SUFFIX)
|
2011-03-18 07:51:45 +01:00
|
|
|
RUNTIME_INCS := -I $(S)src/rt/isaac -I $(S)src/rt/uthash
|
|
|
|
RUNTIME_OBJS := $(RUNTIME_CS:.cpp=.o)
|
2011-03-24 22:17:29 +01:00
|
|
|
RUNTIME_LIBS := $(CFG_GCC_POST_LIB_FLAGS)
|
2011-03-16 17:17:32 +01:00
|
|
|
|
|
|
|
######################################################################
|
2011-03-18 07:51:45 +01:00
|
|
|
# rustc LLVM-extensions (C++) library variables
|
2011-03-16 17:17:32 +01:00
|
|
|
######################################################################
|
|
|
|
|
2011-03-22 07:06:42 +01:00
|
|
|
RUSTLLVM_CS := $(addprefix rustllvm/, \
|
2011-03-18 07:51:45 +01:00
|
|
|
MachOObjectFile.cpp Object.cpp RustWrapper.cpp)
|
2011-03-16 17:17:32 +01:00
|
|
|
|
2011-03-22 07:06:42 +01:00
|
|
|
RUSTLLVM_HDR := rustllvm/include/llvm-c/Object.h
|
2011-03-24 20:22:28 +01:00
|
|
|
RUSTLLVM_DEF := rustllvm/rustllvm$(CFG_DEF_SUFFIX)
|
2011-03-16 17:17:32 +01:00
|
|
|
|
2011-03-22 07:06:42 +01:00
|
|
|
RUSTLLVM_INCS := -iquote $(CFG_LLVM_INCDIR) \
|
|
|
|
-iquote $(S)src/rustllvm/include
|
|
|
|
RUSTLLVM_OBJS := $(RUSTLLVM_CS:.cpp=.o)
|
2011-03-24 22:17:29 +01:00
|
|
|
RUSTLLVM_LIBS := $(CFG_LLVM_LDFLAGS) $(CFG_LLVM_LIBS) \
|
|
|
|
$(CFG_GCC_POST_LIB_FLAGS)
|
2011-03-16 17:17:32 +01:00
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
######################################################################
|
|
|
|
# Standard library variables
|
|
|
|
######################################################################
|
|
|
|
|
2011-03-21 21:42:29 +01:00
|
|
|
STDLIB_CRATE := $(S)src/lib/std.rc
|
2011-03-18 07:51:45 +01:00
|
|
|
STDLIB_INPUTS := $(wildcard $(addprefix $(S)src/lib/,*.rc *.rs */*.rs))
|
2011-03-16 17:17:32 +01:00
|
|
|
|
|
|
|
######################################################################
|
2011-03-18 07:51:45 +01:00
|
|
|
# rustc crate variables
|
2011-03-16 17:17:32 +01:00
|
|
|
######################################################################
|
|
|
|
|
2011-03-21 21:42:29 +01:00
|
|
|
COMPILER_CRATE := $(S)src/comp/rustc.rc
|
2011-03-19 01:30:06 +01:00
|
|
|
COMPILER_INPUTS := $(wildcard $(addprefix $(S)src/comp/, \
|
2011-03-18 07:51:45 +01:00
|
|
|
rustc.rc *.rs */*.rs))
|
|
|
|
|
2011-03-20 09:12:26 +01:00
|
|
|
######################################################################
|
2011-03-23 18:37:35 +01:00
|
|
|
# Test dependency variables
|
2011-03-20 09:12:26 +01:00
|
|
|
######################################################################
|
|
|
|
|
2011-03-22 07:06:42 +01:00
|
|
|
LREQ := rt/$(CFG_RUNTIME) rustllvm/$(CFG_RUSTLLVM)
|
2011-03-20 09:12:26 +01:00
|
|
|
BREQ := boot/rustboot$(X) boot/$(CFG_STDLIB)
|
2011-03-30 02:33:33 +02:00
|
|
|
SREQ0 := stage0/rustc$(X) $(LREQ) stage0/glue.o stage0/$(CFG_STDLIB)
|
|
|
|
SREQ1 := stage1/rustc$(X) $(LREQ) stage1/glue.o stage1/$(CFG_STDLIB)
|
|
|
|
SREQ2 := stage2/rustc$(X) $(LREQ) stage2/glue.o stage2/$(CFG_STDLIB)
|
2011-03-20 09:12:26 +01:00
|
|
|
|
2011-03-23 18:37:35 +01:00
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
######################################################################
|
|
|
|
# Single-target rules
|
|
|
|
######################################################################
|
2011-03-16 17:17:32 +01:00
|
|
|
|
2011-03-19 01:41:32 +01:00
|
|
|
all: boot/rustboot$(X) \
|
2011-03-20 09:12:26 +01:00
|
|
|
boot/$(CFG_STDLIB) \
|
2011-03-19 01:41:32 +01:00
|
|
|
rt/$(CFG_RUNTIME) \
|
2011-03-22 07:06:42 +01:00
|
|
|
rustllvm/$(CFG_RUSTLLVM) \
|
2011-03-19 01:41:32 +01:00
|
|
|
stage0/rustc$(X) \
|
2011-03-19 02:32:31 +01:00
|
|
|
stage0/glue.o \
|
2011-03-20 09:12:26 +01:00
|
|
|
stage0/$(CFG_STDLIB) \
|
2011-03-23 18:37:35 +01:00
|
|
|
$(GENERATED) \
|
|
|
|
$(DOCS)
|
2011-03-18 07:51:45 +01:00
|
|
|
|
2011-03-22 02:05:34 +01:00
|
|
|
rt/$(CFG_RUNTIME): $(RUNTIME_OBJS) $(MKFILES) $(RUNTIME_HDR) $(RUNTIME_DEF)
|
2011-03-18 07:51:45 +01:00
|
|
|
@$(call E, link: $@)
|
2011-03-24 22:17:29 +01:00
|
|
|
$(Q)$(call CFG_LINK_C,$@,$(RUNTIME_LIBS) $(RUNTIME_OBJS),$(RUNTIME_DEF))
|
2011-03-18 07:51:45 +01:00
|
|
|
|
2011-03-22 07:06:42 +01:00
|
|
|
rustllvm/$(CFG_RUSTLLVM): $(RUSTLLVM_OBJS) $(MKFILES) $(RUSTLLVM_HDR) \
|
|
|
|
$(RUSTLLVM_DEF)
|
2011-03-18 07:51:45 +01:00
|
|
|
@$(call E, link: $@)
|
2011-03-24 22:17:29 +01:00
|
|
|
$(Q)$(call CFG_LINK_C,$@,$(RUSTLLVM_LIBS) $(RUSTLLVM_OBJS) \
|
2011-03-22 07:06:42 +01:00
|
|
|
$(CFG_LLVM_LIBS) $(CFG_LLVM_LDFLAGS),$(RUSTLLVM_DEF))
|
2011-03-18 07:51:45 +01:00
|
|
|
|
|
|
|
ifdef CFG_BOOT_NATIVE
|
2011-03-17 22:26:24 +01:00
|
|
|
boot/rustboot$(X): $(BOOT_CMXS) $(MKFILES)
|
2011-03-18 07:51:45 +01:00
|
|
|
@$(call E, link: $@)
|
|
|
|
$(Q)ocamlopt$(OPT) -o $@ $(BOOT_OCAMLOPT_FLAGS) $(BOOT_ML_NATIVE_LIBS) \
|
2011-03-16 17:17:32 +01:00
|
|
|
$(BOOT_CMXS)
|
|
|
|
else
|
2011-03-17 22:26:24 +01:00
|
|
|
boot/rustboot$(X): $(BOOT_CMOS) $(MKFILES)
|
2011-03-18 07:51:45 +01:00
|
|
|
@$(call E, link: $@)
|
2011-03-17 22:26:24 +01:00
|
|
|
$(Q)ocamlc$(OPT) -o $@ $(BOOT_OCAMLC_FLAGS) $(BOOT_ML_LIBS) $(BOOT_CMOS)
|
2011-03-16 17:17:32 +01:00
|
|
|
endif
|
|
|
|
|
2011-03-17 22:26:24 +01:00
|
|
|
boot/version.ml: $(MKFILES)
|
|
|
|
@$(call E, git: $@)
|
2011-03-23 19:34:10 +01:00
|
|
|
$(Q)(cd $(S) && git log -1 \
|
|
|
|
--pretty=format:'let version = "prerelease (%h %ci)";;') >$@ || exit 1
|
2011-03-16 17:17:32 +01:00
|
|
|
|
2011-03-20 06:55:28 +01:00
|
|
|
|
2011-03-21 03:42:27 +01:00
|
|
|
|
2011-03-21 21:42:29 +01:00
|
|
|
boot/$(CFG_STDLIB): $(STDLIB_CRATE) $(STDLIB_INPUTS) \
|
2011-03-20 09:12:26 +01:00
|
|
|
boot/rustboot$(X) $(MKFILES)
|
2011-03-19 01:41:32 +01:00
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(BOOT) -shared -o $@ $<
|
|
|
|
|
2011-03-25 02:43:32 +01:00
|
|
|
stage0/std.bc: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage0/rustc$(X) $(MKFILES)
|
2011-03-20 06:55:28 +01:00
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(STAGE0) -shared -o $@ $<
|
|
|
|
|
2011-03-25 02:43:32 +01:00
|
|
|
stage0/$(CFG_STDLIB): stage0/std.o stage0/glue.o
|
|
|
|
@$(call E, link: $@)
|
|
|
|
$(Q)gcc $(CFG_GCC_CFLAGS) stage0/glue.o $(CFG_GCC_LINK_FLAGS) -o $@ $< \
|
|
|
|
-Lstage0 -Lrt -lrustrt
|
|
|
|
|
|
|
|
stage1/std.bc: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage1/rustc$(X) $(MKFILES)
|
2011-03-21 03:42:27 +01:00
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(STAGE1) -shared -o $@ $<
|
|
|
|
|
2011-03-25 02:43:32 +01:00
|
|
|
stage1/$(CFG_STDLIB): stage1/std.o stage1/glue.o
|
|
|
|
@$(call E, link: $@)
|
|
|
|
$(Q)gcc $(CFG_GCC_CFLAGS) stage1/glue.o $(CFG_GCC_LINK_FLAGS) -o $@ $< \
|
|
|
|
-Lstage1 -Lrt -lrustrt
|
|
|
|
|
|
|
|
stage2/std.bc: $(STDLIB_CRATE) $(STDLIB_INPUTS) stage2/rustc$(X) $(MKFILES)
|
2011-03-21 03:42:27 +01:00
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(STAGE2) -shared -o $@ $<
|
|
|
|
|
2011-03-25 02:43:32 +01:00
|
|
|
stage2/$(CFG_STDLIB): stage2/std.o stage2/glue.o
|
|
|
|
@$(call E, link: $@)
|
|
|
|
$(Q)gcc $(CFG_GCC_CFLAGS) stage2/glue.o $(CFG_GCC_LINK_FLAGS) -o $@ $< \
|
|
|
|
-Lstage2 -Lrt -lrustrt
|
|
|
|
|
2011-03-21 03:42:27 +01:00
|
|
|
|
2011-03-20 06:55:28 +01:00
|
|
|
|
2011-03-30 02:33:33 +02:00
|
|
|
stage0/rustc$(X): $(COMPILER_CRATE) $(COMPILER_INPUTS) $(BREQ)
|
2011-03-19 01:41:32 +01:00
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(BOOT) -minimal -o $@ $<
|
|
|
|
$(Q)chmod 0755 $@
|
|
|
|
|
2011-03-30 02:33:33 +02:00
|
|
|
stage1/rustc$(X): $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ0)
|
2011-03-20 06:55:28 +01:00
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(STAGE0) -o $@ $<
|
|
|
|
$(Q)chmod 0755 $@
|
|
|
|
|
2011-03-30 02:33:33 +02:00
|
|
|
stage2/rustc$(X): $(COMPILER_CRATE) $(COMPILER_INPUTS) $(SREQ1)
|
2011-03-21 03:42:27 +01:00
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(STAGE1) -o $@ $<
|
|
|
|
$(Q)chmod 0755 $@
|
|
|
|
|
|
|
|
|
2011-03-20 06:55:28 +01:00
|
|
|
|
2011-03-25 02:43:32 +01:00
|
|
|
stage0/glue.bc: stage0/rustc$(X) boot/$(CFG_STDLIB) \
|
2011-03-22 07:06:42 +01:00
|
|
|
rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
|
2011-03-19 01:41:32 +01:00
|
|
|
@$(call E, generate: $@)
|
|
|
|
$(STAGE0) -o $@ -glue
|
2011-03-18 07:51:45 +01:00
|
|
|
|
2011-03-25 02:43:32 +01:00
|
|
|
stage1/glue.bc: stage1/rustc$(X) stage0/$(CFG_STDLIB) \
|
2011-03-22 07:06:42 +01:00
|
|
|
rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
|
2011-03-20 06:55:28 +01:00
|
|
|
@$(call E, generate: $@)
|
|
|
|
$(STAGE1) -o $@ -glue
|
|
|
|
|
2011-03-25 02:43:32 +01:00
|
|
|
stage2/glue.bc: stage2/rustc$(X) stage1/$(CFG_STDLIB) \
|
2011-03-22 07:06:42 +01:00
|
|
|
rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
|
2011-03-21 03:42:27 +01:00
|
|
|
@$(call E, generate: $@)
|
|
|
|
$(STAGE2) -o $@ -glue
|
|
|
|
|
2011-03-31 23:58:17 +02:00
|
|
|
# Due to make not wanting to run the same implicit rules twice on the same
|
|
|
|
# rule tree (implicit-rule recursion prevention, see "Chains of Implicit
|
|
|
|
# Rules" in GNU Make manual) we have to re-state the %.o and %.s patterns here
|
|
|
|
# for different directories, to handle cases where (say) a test relies on a
|
|
|
|
# compiler that relies on a .o file.
|
|
|
|
|
|
|
|
stage0/%.o: stage0/%.s
|
|
|
|
@$(call E, assemble [llvm]: $@)
|
|
|
|
$(Q)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
|
|
|
|
|
|
|
|
stage0/%.s: stage0/%.bc
|
|
|
|
@$(call E, compile [llvm]: $@)
|
|
|
|
$(Q)$(CFG_LLVM_BINDIR)/llc $(CFG_LLC_CFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
stage1/%.o: stage1/%.s
|
|
|
|
@$(call E, assemble [llvm]: $@)
|
|
|
|
$(Q)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
|
|
|
|
|
|
|
|
stage1/%.s: stage1/%.bc
|
|
|
|
@$(call E, compile [llvm]: $@)
|
|
|
|
$(Q)$(CFG_LLVM_BINDIR)/llc $(CFG_LLC_CFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
stage2/%.o: stage2/%.s
|
|
|
|
@$(call E, assemble [llvm]: $@)
|
|
|
|
$(Q)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
|
|
|
|
|
|
|
|
stage2/%.s: stage2/%.bc
|
|
|
|
@$(call E, compile [llvm]: $@)
|
|
|
|
$(Q)$(CFG_LLVM_BINDIR)/llc $(CFG_LLC_CFLAGS) -o $@ $<
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
######################################################################
|
2011-03-20 09:12:26 +01:00
|
|
|
# Library and boot rules
|
2011-03-18 07:51:45 +01:00
|
|
|
######################################################################
|
|
|
|
|
|
|
|
rt/%.o: rt/%.cpp $(MKFILES)
|
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(Q)$(call CFG_COMPILE_C, $@, $(RUNTIME_INCS)) $<
|
|
|
|
|
2011-03-22 07:06:42 +01:00
|
|
|
rustllvm/%.o: rustllvm/%.cpp $(MKFILES)
|
2011-03-18 07:51:45 +01:00
|
|
|
@$(call E, compile: $@)
|
2011-03-22 07:06:42 +01:00
|
|
|
$(Q)$(call CFG_COMPILE_C, $@, $(CFG_LLVM_CXXFLAGS) $(RUSTLLVM_INCS)) $<
|
2011-03-18 07:51:45 +01:00
|
|
|
|
2011-03-16 17:17:32 +01:00
|
|
|
%.cmo: %.ml $(MKFILES)
|
|
|
|
@$(call E, compile: $@)
|
2011-03-17 22:26:24 +01:00
|
|
|
$(Q)ocamlc$(OPT) -c -o $@ $(BOOT_OCAMLC_FLAGS) $<
|
2011-03-16 17:17:32 +01:00
|
|
|
|
|
|
|
%.cmo: %.cmi $(MKFILES)
|
2011-03-17 22:26:24 +01:00
|
|
|
|
2011-03-18 07:51:45 +01:00
|
|
|
%.cmx %.o: %.ml $(MKFILES)
|
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(Q)ocamlopt$(OPT) -c -o $@ $(BOOT_OCAMLOPT_FLAGS) $<
|
|
|
|
|
|
|
|
%.ml: %.mll $(MKFILES)
|
|
|
|
@$(call E, lex-gen: $@)
|
|
|
|
$(Q)ocamllex$(OPT) -q -o $@ $<
|
2011-03-17 22:26:24 +01:00
|
|
|
|
2011-03-20 09:12:26 +01:00
|
|
|
|
2011-03-24 20:22:28 +01:00
|
|
|
%.linux.def: %.def.in $(MKFILES)
|
|
|
|
@$(call E, def: $@)
|
|
|
|
$(Q)echo "{" > $@
|
|
|
|
$(Q)sed 's/.$$/&;/' $< >> $@
|
|
|
|
$(Q)echo "};" >> $@
|
|
|
|
|
|
|
|
%.darwin.def: %.def.in $(MKFILES)
|
|
|
|
@$(call E, def: $@)
|
|
|
|
$(Q)sed 's/^./_&/' $< > $@
|
|
|
|
|
|
|
|
ifdef CFG_WINDOWSY
|
|
|
|
%.def: %.def.in $(MKFILES)
|
|
|
|
@$(call E, def: $@)
|
|
|
|
$(Q)echo LIBRARY $* > $@
|
|
|
|
$(Q)echo EXPORTS >> $@
|
|
|
|
$(Q)sed 's/^./ &/' $< >> $@
|
|
|
|
endif
|
|
|
|
|
2011-03-23 18:37:35 +01:00
|
|
|
######################################################################
|
|
|
|
# Doc rules
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
doc/version.texi: $(MKFILES) rust.texi
|
2011-03-23 19:34:10 +01:00
|
|
|
(cd $(S) && git log -1 \
|
|
|
|
--pretty=format:'@macro gitversion%n%h %ci%n@end macro%n') >$@
|
2011-03-23 18:37:35 +01:00
|
|
|
|
|
|
|
doc/%.pdf: %.texi doc/version.texi
|
|
|
|
texi2pdf -I doc -o $@ --clean $<
|
|
|
|
|
|
|
|
doc/%.html: %.texi doc/version.texi
|
|
|
|
makeinfo -I doc --html --ifhtml --force --no-split --output=$@ $<
|
|
|
|
|
|
|
|
docsnap: doc/rust.pdf
|
|
|
|
mv $< doc/rust-$(shell date +"%Y-%m-%d")-snap.pdf
|
|
|
|
|
|
|
|
|
2011-03-21 21:41:56 +01:00
|
|
|
######################################################################
|
|
|
|
# Testing variables
|
|
|
|
######################################################################
|
|
|
|
|
2011-03-27 01:35:26 +01:00
|
|
|
ALL_TEST_INPUTS = $(wildcard $(S)src/test/*/*.rs \
|
|
|
|
$(S)src/test/*/*/*.rs \
|
|
|
|
$(S)src/test/*/*.rc)
|
|
|
|
|
|
|
|
TEST_XFAILS_BOOT = $(shell grep -l xfail-boot $(ALL_TEST_INPUTS))
|
|
|
|
TEST_XFAILS_STAGE0 = $(shell grep -l xfail-stage0 $(ALL_TEST_INPUTS))
|
2011-03-21 21:41:56 +01:00
|
|
|
|
|
|
|
ifdef MINGW_CROSS
|
|
|
|
TEST_XFAILS_BOOT += $(S)src/test/run-pass/native-mod.rc
|
|
|
|
TEST_XFAILS_STAGE0 += $(S)src/test/run-pass/native-mod.rc
|
|
|
|
endif
|
|
|
|
ifdef CFG_WINDOWSY
|
|
|
|
TEST_XFAILS_BOOT += $(S)src/test/run-pass/native-mod.rc
|
|
|
|
TEST_XFAILS_STAGE0 += $(S)src/test/run-pass/native-mod.rc
|
|
|
|
endif
|
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
BENCH_RS = $(wildcard $(S)src/test/bench/shootout/*.rs) \
|
2011-03-21 21:41:56 +01:00
|
|
|
$(wildcard $(S)src/test/bench/99-bottles/*.rs)
|
2011-03-25 20:19:20 +01:00
|
|
|
RPASS_RC = $(wildcard $(S)src/test/run-pass/*.rc)
|
|
|
|
RPASS_RS = $(wildcard $(S)src/test/run-pass/*.rs) $(BENCH_RS)
|
|
|
|
RFAIL_RC = $(wildcard $(S)src/test/run-fail/*.rc)
|
|
|
|
RFAIL_RS = $(wildcard $(S)src/test/run-fail/*.rs)
|
|
|
|
CFAIL_RC = $(wildcard $(S)src/test/compile-fail/*.rc)
|
|
|
|
CFAIL_RS = $(wildcard $(S)src/test/compile-fail/*.rs)
|
2011-03-21 21:41:56 +01:00
|
|
|
|
|
|
|
ifdef CHECK_XFAILS
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RPASS_CRATES_BOOT = $(filter $(TEST_XFAILS_BOOT), $(RPASS_RC))
|
|
|
|
TEST_RPASS_CRATES_STAGE0 = $(filter $(TEST_XFAILS_STAGE0), $(RPASS_RC))
|
|
|
|
TEST_RPASS_SOURCES_BOOT = $(filter $(TEST_XFAILS_BOOT), $(RPASS_RS))
|
|
|
|
TEST_RPASS_SOURCES_STAGE0 = $(filter $(TEST_XFAILS_STAGE0), $(RPASS_RS))
|
2011-03-21 21:41:56 +01:00
|
|
|
else
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RPASS_CRATES_BOOT = $(filter-out $(TEST_XFAILS_BOOT), $(RPASS_RC))
|
|
|
|
TEST_RPASS_CRATES_STAGE0 = $(filter-out $(TEST_XFAILS_STAGE0), $(RPASS_RC))
|
|
|
|
TEST_RPASS_SOURCES_BOOT = $(filter-out $(TEST_XFAILS_BOOT), $(RPASS_RS))
|
|
|
|
TEST_RPASS_SOURCES_STAGE0 = $(filter-out $(TEST_XFAILS_STAGE0), $(RPASS_RS))
|
2011-03-21 21:41:56 +01:00
|
|
|
endif
|
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RPASS_EXES_BOOT = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(subst $(S)src/,,$(TEST_RPASS_CRATES_BOOT:.rc=.boot$(X))) \
|
|
|
|
$(subst $(S)src/,,$(TEST_RPASS_SOURCES_BOOT:.rs=.boot$(X)))
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RPASS_EXES_STAGE0 = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(subst $(S)src/,,$(TEST_RPASS_CRATES_STAGE0:.rc=.stage0$(X))) \
|
|
|
|
$(subst $(S)src/,,$(TEST_RPASS_SOURCES_STAGE0:.rs=.stage0$(X)))
|
2011-03-21 21:41:56 +01:00
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RPASS_OUTS_BOOT = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(TEST_RPASS_EXES_BOOT:.boot$(X)=.boot.out)
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RPASS_OUTS_STAGE0 = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(TEST_RPASS_EXES_STAGE0:.stage0$(X)=.stage0.out)
|
2011-03-21 21:41:56 +01:00
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RPASS_TMPS_BOOT = \
|
2011-03-21 21:41:56 +01:00
|
|
|
$(TEST_RPASS_EXES_BOOT:.boot$(X)=.boot$(X).tmp)
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RPASS_TMPS_STAGE0 = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(TEST_RPASS_EXES_STAGE0:.stage0$(X)=.stage0$(X).tmp)
|
2011-03-21 21:41:56 +01:00
|
|
|
|
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RFAIL_CRATES_BOOT = $(filter-out $(TEST_XFAILS_BOOT), $(RFAIL_RC))
|
|
|
|
TEST_RFAIL_CRATES_STAGE0 = $(filter-out $(TEST_XFAILS_STAGE0), $(RFAIL_RC))
|
|
|
|
TEST_RFAIL_SOURCES_BOOT = $(filter-out $(TEST_XFAILS_BOOT), $(RFAIL_RS))
|
|
|
|
TEST_RFAIL_SOURCES_STAGE0 = $(filter-out $(TEST_XFAILS_STAGE0), $(RFAIL_RS))
|
2011-03-21 21:41:56 +01:00
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RFAIL_EXES_BOOT = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(subst $(S)src/,,$(TEST_RFAIL_CRATES_BOOT:.rc=.boot$(X))) \
|
|
|
|
$(subst $(S)src/,,$(TEST_RFAIL_SOURCES_BOOT:.rs=.boot$(X)))
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RFAIL_EXES_STAGE0 = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(subst $(S)src/,,$(TEST_RFAIL_CRATES_STAGE0:.rc=.stage0$(X))) \
|
|
|
|
$(subst $(S)src/,,$(TEST_RFAIL_SOURCES_STAGE0:.rs=.stage0$(X)))
|
2011-03-21 21:41:56 +01:00
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RFAIL_OUTS_BOOT = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(TEST_RFAIL_EXES_BOOT:.boot$(X)=.boot.out)
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RFAIL_OUTS_STAGE0 = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(TEST_RFAIL_EXES_STAGE0:.stage0$(X)=.stage0.out)
|
2011-03-21 21:41:56 +01:00
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RFAIL_TMPS_BOOT = \
|
2011-03-21 21:41:56 +01:00
|
|
|
$(TEST_RFAIL_EXES_BOOT:.boot$(X)=.boot$(X).tmp)
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_RFAIL_TMPS_STAGE0 = \
|
2011-03-21 23:53:08 +01:00
|
|
|
$(TEST_RFAIL_EXES_STAGE0:.stage0$(X)=.stage0$(X).tmp)
|
2011-03-21 21:41:56 +01:00
|
|
|
|
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_CFAIL_CRATES_BOOT = $(filter-out $(TEST_XFAILS_BOOT), $(CFAIL_RC))
|
|
|
|
TEST_CFAIL_CRATES_STAGE0 = $(filter-out $(TEST_XFAILS_STAGE0), $(CFAIL_RC))
|
|
|
|
TEST_CFAIL_SOURCES_BOOT = $(filter-out $(TEST_XFAILS_BOOT), $(CFAIL_RS))
|
|
|
|
TEST_CFAIL_SOURCES_STAGE0 = $(filter-out $(TEST_XFAILS_STAGE0), $(CFAIL_RS))
|
2011-03-21 21:41:56 +01:00
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_CFAIL_EXES_BOOT = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(subst $(S)src/,,$(TEST_CFAIL_CRATES_BOOT:.rc=.boot$(X))) \
|
|
|
|
$(subst $(S)src/,,$(TEST_CFAIL_SOURCES_BOOT:.rs=.boot$(X)))
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_CFAIL_EXES_STAGE0 = \
|
2011-03-21 23:53:08 +01:00
|
|
|
$(subst $(S)src/,,$(TEST_CFAIL_CRATES_STAGE0:.rc=.stage0$(X))) \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(subst $(S)src/,,$(TEST_CFAIL_SOURCES_STAGE0:.rs=.stage0$(X)))
|
2011-03-21 21:41:56 +01:00
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_CFAIL_OUTS_BOOT = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(TEST_CFAIL_EXES_BOOT:.boot$(X)=.boot.out)
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_CFAIL_OUTS_STAGE0 = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(TEST_CFAIL_EXES_STAGE0:.stage0$(X)=.stage0.out)
|
2011-03-21 21:41:56 +01:00
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_CFAIL_TMPS_BOOT = \
|
2011-03-21 21:41:56 +01:00
|
|
|
$(TEST_CFAIL_EXES_BOOT:.boot$(X)=.boot$(X).tmp)
|
2011-03-25 20:19:20 +01:00
|
|
|
TEST_CFAIL_TMPS_STAGE0 = \
|
2011-03-21 22:02:01 +01:00
|
|
|
$(TEST_CFAIL_EXES_STAGE0:.stage0$(X)=.stage0$(X).tmp)
|
2011-03-21 21:41:56 +01:00
|
|
|
|
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
ALL_TEST_CRATES = $(TEST_CFAIL_CRATES_BOOT) \
|
2011-03-21 21:41:56 +01:00
|
|
|
$(TEST_RFAIL_CRATES_BOOT) \
|
|
|
|
$(TEST_RPASS_CRATES_BOOT) \
|
|
|
|
$(TEST_CFAIL_CRATES_STAGE0) \
|
|
|
|
$(TEST_RFAIL_CRATES_STAGE0) \
|
|
|
|
$(TEST_RPASS_CRATES_STAGE0)
|
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
ALL_TEST_SOURCES = $(TEST_CFAIL_SOURCES_BOOT) \
|
2011-03-21 21:41:56 +01:00
|
|
|
$(TEST_RFAIL_SOURCES_BOOT) \
|
|
|
|
$(TEST_RPASS_SOURCES_BOOT) \
|
|
|
|
$(TEST_CFAIL_SOURCES_STAGE0) \
|
|
|
|
$(TEST_RFAIL_SOURCES_STAGE0) \
|
|
|
|
$(TEST_RPASS_SOURCES_STAGE0)
|
|
|
|
|
|
|
|
# The test suite currently relies on logging to validate results so
|
|
|
|
# make sure that logging uses the default configuration
|
|
|
|
unexport RUST_LOG
|
|
|
|
|
|
|
|
|
|
|
|
check_nocompile: $(TEST_CFAIL_OUTS_BOOT) \
|
|
|
|
$(TEST_CFAIL_OUTS_STAGE0)
|
|
|
|
|
|
|
|
check: tidy \
|
|
|
|
$(TEST_RPASS_EXES_BOOT) $(TEST_RFAIL_EXES_BOOT) \
|
|
|
|
$(TEST_RPASS_OUTS_BOOT) $(TEST_RFAIL_OUTS_BOOT) \
|
|
|
|
$(TEST_CFAIL_OUTS_BOOT) \
|
|
|
|
$(TEST_RPASS_EXES_STAGE0) $(TEST_RFAIL_EXES_STAGE0) \
|
|
|
|
$(TEST_RPASS_OUTS_STAGE0) $(TEST_RFAIL_OUTS_STAGE0) \
|
|
|
|
$(TEST_CFAIL_OUTS_STAGE0)
|
|
|
|
|
|
|
|
|
|
|
|
compile-check: tidy \
|
|
|
|
$(TEST_RPASS_EXES_BOOT) $(TEST_RFAIL_EXES_BOOT) \
|
|
|
|
$(TEST_RPASS_EXES_STAGE0) $(TEST_RFAIL_EXES_STAGE0)
|
|
|
|
|
|
|
|
|
2011-03-20 09:12:26 +01:00
|
|
|
######################################################################
|
|
|
|
# Testing rules
|
|
|
|
######################################################################
|
|
|
|
|
2011-03-30 02:33:33 +02:00
|
|
|
%.stage0$(X): %.stage0.o $(SREQ0)
|
2011-03-21 05:05:31 +01:00
|
|
|
@$(call E, link [gcc]: $@)
|
2011-03-29 23:56:24 +02:00
|
|
|
$(Q)gcc $(CFG_GCC_CFLAGS) stage0/glue.o -o $@ $< \
|
|
|
|
-Lstage0 -Lrt -lrustrt -lstd
|
2011-03-20 09:12:26 +01:00
|
|
|
@# dsymutil sometimes fails or prints a warning, but the
|
|
|
|
@# program still runs. Since it simplifies debugging other
|
|
|
|
@# programs, I\'ll live with the noise.
|
2011-03-21 05:05:49 +01:00
|
|
|
-$(Q)$(CFG_DSYMUTIL) $@
|
2011-03-20 09:12:26 +01:00
|
|
|
|
2011-03-30 02:33:33 +02:00
|
|
|
%.stage1(X): %.stage1.o $(SREQ1)
|
2011-03-21 05:05:31 +01:00
|
|
|
@$(call E, link [gcc]: $@)
|
2011-03-29 23:56:24 +02:00
|
|
|
$(Q)gcc $(CFG_GCC_CFLAGS) stage1/glue.o -o $@ $< \
|
|
|
|
-Lstage1 -Lrt -lrustrt -lstd
|
2011-03-21 03:42:27 +01:00
|
|
|
@# dsymutil sometimes fails or prints a warning, but the
|
|
|
|
@# program still runs. Since it simplifies debugging other
|
|
|
|
@# programs, I\'ll live with the noise.
|
2011-03-21 05:05:49 +01:00
|
|
|
-$(Q)$(CFG_DSYMUTIL) $@
|
2011-03-21 03:42:27 +01:00
|
|
|
|
2011-03-30 02:33:33 +02:00
|
|
|
%.stage2$(X): %.stage2.o $(SREQ2)
|
2011-03-21 05:05:31 +01:00
|
|
|
@$(call E, link [gcc]: $@)
|
2011-03-29 23:56:24 +02:00
|
|
|
$(Q)gcc $(CFG_GCC_CFLAGS) stage2/glue.o -o $@ $< \
|
|
|
|
-Lstage2 -Lrt -lrustrt -lstd
|
2011-03-21 03:42:27 +01:00
|
|
|
@# dsymutil sometimes fails or prints a warning, but the
|
|
|
|
@# program still runs. Since it simplifies debugging other
|
|
|
|
@# programs, I\'ll live with the noise.
|
2011-03-21 05:05:49 +01:00
|
|
|
-$(Q)$(CFG_DSYMUTIL) $@
|
2011-03-21 03:42:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%.boot$(X): %.rs $(BREQ)
|
|
|
|
@$(call E, compile [boot]: $@)
|
|
|
|
$(BOOT) -o $@ $<
|
|
|
|
|
|
|
|
%.boot$(X): %.rc $(BREQ)
|
|
|
|
@$(call E, compile [boot]: $@)
|
|
|
|
$(BOOT) -o $@ $<
|
|
|
|
|
2011-03-20 09:12:26 +01:00
|
|
|
%.stage0.bc: %.rc $(SREQ0)
|
|
|
|
@$(call E, compile [stage0]: $@)
|
|
|
|
$(STAGE0) -o $@ $<
|
|
|
|
|
|
|
|
%.stage0.bc: %.rs $(SREQ0)
|
|
|
|
@$(call E, compile [stage0]: $@)
|
|
|
|
$(STAGE0) -o $@ $<
|
|
|
|
|
2011-03-21 03:42:27 +01:00
|
|
|
%.stage1.bc: %.rc $(SREQ1)
|
|
|
|
@$(call E, compile [stage1]: $@)
|
|
|
|
$(STAGE1) -o $@ $<
|
|
|
|
|
|
|
|
%.stage1.bc: %.rs $(SREQ1)
|
|
|
|
@$(call E, compile [stage1]: $@)
|
|
|
|
$(STAGE1) -o $@ $<
|
|
|
|
|
|
|
|
%.stage2.bc: %.rc $(SREQ2)
|
|
|
|
@$(call E, compile [stage2]: $@)
|
|
|
|
$(STAGE2) -o $@ $<
|
|
|
|
|
|
|
|
%.stage2.bc: %.rs $(SREQ2)
|
|
|
|
@$(call E, compile [stage2]: $@)
|
|
|
|
$(STAGE2) -o $@ $<
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-03-19 02:32:31 +01:00
|
|
|
%.o: %.s
|
|
|
|
@$(call E, assemble [llvm]: $@)
|
|
|
|
$(Q)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
|
|
|
|
|
|
|
|
%.ll: %.bc
|
|
|
|
@$(call E, dis [llvm]: $@)
|
|
|
|
$(Q)$(CFG_LLVM_BINDIR)/llvm-dis -o $@ $<
|
|
|
|
|
|
|
|
%.s: %.bc
|
|
|
|
@$(call E, compile [llvm]: $@)
|
|
|
|
$(Q)$(CFG_LLVM_BINDIR)/llc $(CFG_LLC_CFLAGS) -o $@ $<
|
|
|
|
|
2011-03-20 09:12:26 +01:00
|
|
|
# Cancel the implicit .out rule in GNU make.
|
|
|
|
%.out: %
|
|
|
|
|
|
|
|
%.out: %.out.tmp
|
|
|
|
$(Q)mv $< $@
|
|
|
|
|
2011-03-21 21:42:29 +01:00
|
|
|
test/run-pass/%.out.tmp: test/run-pass/%$(X) rt/$(CFG_RUNTIME)
|
2011-03-20 09:12:26 +01:00
|
|
|
$(Q)rm -f $<.tmp
|
|
|
|
@$(call E, run: $@)
|
2011-03-21 22:52:02 +01:00
|
|
|
$(Q)$(call CFG_RUN_TEST, $<) > $@
|
2011-03-20 09:12:26 +01:00
|
|
|
|
|
|
|
test/bench/shootout/%.out.tmp: test/bench/shootout/%$(X) \
|
|
|
|
rt/$(CFG_RUNTIME)
|
|
|
|
$(Q)rm -f $<.tmp
|
|
|
|
@$(call E, run: $@)
|
2011-03-21 22:52:02 +01:00
|
|
|
$(Q)$(call CFG_RUN_TEST, $<) > $@
|
2011-03-20 09:12:26 +01:00
|
|
|
|
|
|
|
test/bench/99-bottles/%.out.tmp: test/bench/99-bottles/%$(X) \
|
|
|
|
rt/$(CFG_RUNTIME)
|
|
|
|
$(Q)rm -f $<.tmp
|
|
|
|
@$(call E, run: $@)
|
2011-03-21 22:52:02 +01:00
|
|
|
$(Q)$(call CFG_RUN_TEST, $<) > $@
|
2011-03-20 09:12:26 +01:00
|
|
|
|
|
|
|
test/run-fail/%.out.tmp: test/run-fail/%$(X) \
|
|
|
|
rt/$(CFG_RUNTIME)
|
|
|
|
$(Q)rm -f $<.tmp
|
|
|
|
@$(call E, run: $@)
|
|
|
|
$(Q)grep -q error-pattern $(S)src/test/run-fail/$(basename $*).rs
|
|
|
|
$(Q)rm -f $@
|
2011-03-21 22:52:02 +01:00
|
|
|
$(Q)$(call CFG_RUN_TEST, $<) >$@ 2>&1 ; X=$$? ; \
|
2011-03-20 09:12:26 +01:00
|
|
|
if [ $$X -eq 0 ] ; then exit 1 ; else exit 0 ; fi
|
|
|
|
$(Q)grep --text --quiet \
|
|
|
|
"$$(grep error-pattern $(S)src/test/run-fail/$(basename $*).rs \
|
|
|
|
| cut -d : -f 2- | tr -d '\n\r')" $@
|
|
|
|
|
|
|
|
test/compile-fail/%.boot.out.tmp: test/compile-fail/%.rs $(BREQ)
|
|
|
|
@$(call E, compile [boot]: $@)
|
|
|
|
$(Q)grep -q error-pattern $<
|
|
|
|
$(Q)rm -f $@
|
|
|
|
$(BOOT) -o $(@:.out=$(X)) $< >$@ 2>&1; test $$? -ne 0
|
|
|
|
$(Q)grep --text --quiet \
|
|
|
|
"$$(grep error-pattern $< | cut -d : -f 2- | tr -d '\n\r')" $@
|
|
|
|
|
|
|
|
test/compile-fail/%.stage0.out.tmp: test/compile-fail/%.rs $(SREQ0)
|
|
|
|
@$(call E, compile [stage0]: $@)
|
|
|
|
$(Q)grep -q error-pattern $<
|
|
|
|
$(Q)rm -f $@
|
|
|
|
$(STAGE0) -o $(@:.out=$(X)) $< >$@ 2>&1; test $$? -ne 0
|
|
|
|
$(Q)grep --text --quiet \
|
|
|
|
"$$(grep error-pattern $< | cut -d : -f 2- | tr -d '\n\r')" $@
|
|
|
|
|
2011-03-23 00:57:31 +01:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Auto-dependency
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
ML_DEPFILES := $(BOOT_MLS:%.ml=%.d)
|
|
|
|
C_DEPFILES := $(RUNTIME_CS:%.cpp=%.d) $(RUSTLLVM_CS:%.cpp=%.d)
|
|
|
|
|
|
|
|
rt/%.d: rt/%.cpp $(MKFILES)
|
|
|
|
@$(call E, dep: $@)
|
|
|
|
$(Q)$(call CFG_DEPEND_C, $@ \
|
|
|
|
$(subst $(S)src/,,$(patsubst %.cpp, %.o, $<)), \
|
|
|
|
$(RUNTIME_INCS)) $< >$@.tmp
|
|
|
|
$(Q)$(CFG_PATH_MUNGE) $@.tmp
|
2011-03-23 22:35:28 +01:00
|
|
|
$(Q)rm -f $@.tmp.bak
|
2011-03-23 00:57:31 +01:00
|
|
|
$(Q)mv $@.tmp $@
|
|
|
|
|
|
|
|
rustllvm/%.d: rustllvm/%.cpp $(MKFILES)
|
|
|
|
@$(call E, dep: $@)
|
|
|
|
$(Q)$(call CFG_DEPEND_C, $@ \
|
|
|
|
$(subst $(S)src/,,$(patsubst %.cpp, %.o, $<)), \
|
|
|
|
$(CFG_LLVM_CXXFLAGS) $(RUSTLLVM_INCS)) $< >$@.tmp
|
|
|
|
$(Q)$(CFG_PATH_MUNGE) $@.tmp
|
2011-03-23 22:35:28 +01:00
|
|
|
$(Q)rm -f $@.tmp.bak
|
2011-03-23 00:57:31 +01:00
|
|
|
$(Q)mv $@.tmp $@
|
|
|
|
|
|
|
|
%.d: %.ml $(MKFILES)
|
|
|
|
@$(call E, dep: $@)
|
|
|
|
$(Q)ocamldep$(OPT) -slash $(BOOT_ML_DEP_INCS) $< >$@.tmp
|
|
|
|
$(Q)$(CFG_PATH_MUNGE) $@.tmp
|
2011-03-23 22:35:28 +01:00
|
|
|
$(Q)rm -f $@.tmp.bak
|
|
|
|
$(Q)perl -i.bak -pe "s@$(S)src/@@go" $@.tmp
|
|
|
|
$(Q)rm -f $@.tmp.bak
|
2011-03-23 00:57:31 +01:00
|
|
|
$(Q)mv $@.tmp $@
|
|
|
|
|
|
|
|
%.d: %.mli $(MKFILES)
|
|
|
|
@$(call E, dep: $@)
|
|
|
|
$(Q)ocamldep$(OPT) -slash $(BOOT_ML_DEP_INCS) $< >$@.tmp
|
|
|
|
$(Q)$(CFG_PATH_MUNGE) $@.tmp
|
2011-03-23 22:35:28 +01:00
|
|
|
$(Q)rm -f $@.tmp.bak
|
|
|
|
$(Q)perl -i.bak -pe "s@$(S)src/@@go" $@.tmp
|
|
|
|
$(Q)rm -f $@.tmp.bak
|
2011-03-23 00:57:31 +01:00
|
|
|
$(Q)mv $@.tmp $@
|
|
|
|
|
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
|
|
|
-include $(ML_DEPFILES) $(C_DEPFILES)
|
|
|
|
endif
|
|
|
|
|
|
|
|
RUSTBOOT_PROBE := $(wildcard boot/rustboot$(X))
|
|
|
|
|
|
|
|
ifneq ($(RUSTBOOT_PROBE),)
|
|
|
|
CFG_INFO := $(info cfg: using built boot/rustboot$(X) for rust deps)
|
|
|
|
CRATE_DEPFILES := $(subst $(S)src/,,$(ALL_TEST_CRATES:%.rc=%.d)) \
|
|
|
|
boot/$(CFG_STDLIB).d \
|
|
|
|
stage0/rustc$(X).d \
|
|
|
|
stage0/$(CFG_STDLIB).d
|
|
|
|
|
|
|
|
boot/$(CFG_STDLIB).d: $(STDLIB_CRATE) $(STDLIB_INPUTS) \
|
|
|
|
$(MKFILES) boot/rustboot$(X)
|
|
|
|
@$(call E, dep: $@)
|
2011-03-25 08:09:20 +01:00
|
|
|
$(BOOT) -o $(patsubst %.d,%$(X),$@) -shared -rdeps $< >$@.tmp
|
2011-03-23 00:57:31 +01:00
|
|
|
$(Q)$(CFG_PATH_MUNGE) $@.tmp
|
2011-03-23 22:35:28 +01:00
|
|
|
$(Q)rm -f $@.tmp.bak
|
2011-03-23 00:57:31 +01:00
|
|
|
$(Q)mv $@.tmp $@
|
|
|
|
|
|
|
|
stage0/rustc$(X).d: $(COMPILER_CRATE) $(COMPILER_INPUTS) \
|
|
|
|
$(STDLIB_CRATE) $(MKFILES) boot/rustboot$(X)
|
|
|
|
@$(call E, dep: $@)
|
2011-03-25 08:09:20 +01:00
|
|
|
$(BOOT) -o $(patsubst %.d,%$(X),$@) -shared -rdeps $< >$@.tmp
|
2011-03-23 00:57:31 +01:00
|
|
|
$(Q)$(CFG_PATH_MUNGE) $@.tmp
|
2011-03-23 22:35:28 +01:00
|
|
|
$(Q)rm -f $@.tmp.bak
|
2011-03-23 00:57:31 +01:00
|
|
|
$(Q)mv $@.tmp $@
|
|
|
|
|
|
|
|
%.d: %.rc $(MKFILES) boot/rustboot$(X)
|
|
|
|
@$(call E, dep: $@)
|
2011-03-25 08:09:20 +01:00
|
|
|
$(BOOT) -o $(patsubst %.d,%$(X),$@) -rdeps $< >$@.tmp
|
2011-03-23 00:57:31 +01:00
|
|
|
$(Q)$(CFG_PATH_MUNGE) $@.tmp
|
2011-03-23 22:35:28 +01:00
|
|
|
$(Q)rm -f $@.tmp.bak
|
2011-03-23 00:57:31 +01:00
|
|
|
$(Q)mv $@.tmp $@
|
|
|
|
|
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
|
|
|
-include $(CRATE_DEPFILES)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
depend: boot/rustboot$(X) $(CRATE_DEPFILES) $(ML_DEPFILES) $(C_DEPFILES)
|
|
|
|
|
2011-03-25 18:29:45 +01:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Re-configuration
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
config.mk: $(S)configure $(S)Makefile.in
|
|
|
|
@$(call E, cfg: reconfiguring)
|
|
|
|
$(S)configure $(CFG_CONFIGURE_ARGS)
|
|
|
|
|
|
|
|
|
2011-03-21 19:23:19 +01:00
|
|
|
######################################################################
|
|
|
|
# Distribution
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
PKG_NAME := rust
|
|
|
|
PKG_VER = $(shell date +"%Y-%m-%d")-snap
|
|
|
|
PKG_DIR = $(PKG_NAME)-$(PKG_VER)
|
|
|
|
PKG_TAR = $(PKG_DIR).tar.gz
|
|
|
|
|
2011-03-21 21:42:14 +01:00
|
|
|
PKG_3RDPARTY := rt/valgrind.h rt/memcheck.h \
|
|
|
|
rt/isaac/rand.h rt/isaac/standard.h \
|
|
|
|
rt/uthash/uthash.h rt/uthash/utlist.h \
|
|
|
|
rt/bigint/bigint.h rt/bigint/bigint_int.cpp \
|
|
|
|
rt/bigint/bigint_ext.cpp rt/bigint/low_primes.h
|
|
|
|
|
2011-03-25 20:19:20 +01:00
|
|
|
PKG_FILES = \
|
2011-03-21 21:42:14 +01:00
|
|
|
$(wildcard $(S)src/etc/*.*) \
|
|
|
|
$(S)LICENSE.txt $(S)README \
|
|
|
|
$(S)configure $(S)Makefile.in \
|
|
|
|
$(addprefix $(S)src/, \
|
|
|
|
README boot/README comp/README \
|
|
|
|
$(filter-out $(GENERATED), $(BOOT_MLS)) \
|
|
|
|
$(RUNTIME_CS) $(RUNTIME_HDR) \
|
2011-03-22 07:06:42 +01:00
|
|
|
$(RUSTLLVM_CS) $(RUSTLLVM_HDR) \
|
2011-03-21 21:42:14 +01:00
|
|
|
$(PKG_3RDPARTY)) \
|
2011-03-22 00:16:15 +01:00
|
|
|
$(GENERATED) \
|
|
|
|
$(S)src/boot/fe/lexer.ml \
|
2011-03-21 21:42:14 +01:00
|
|
|
$(COMPILER_INPUTS) \
|
|
|
|
$(STDLIB_INPUTS) \
|
|
|
|
$(ALL_TEST_INPUTS) \
|
|
|
|
$(GENERATED)
|
|
|
|
|
|
|
|
dist: $(PKG_TAR)
|
|
|
|
|
2011-03-22 00:16:15 +01:00
|
|
|
$(PKG_TAR): $(GENERATED)
|
2011-03-21 21:42:14 +01:00
|
|
|
@$(call E, making dist dir)
|
|
|
|
$(Q)rm -Rf dist
|
|
|
|
$(Q)mkdir -p dist/$(PKG_DIR)
|
|
|
|
$(Q)tar -c $(PKG_FILES) | tar -x -C dist/$(PKG_DIR)
|
|
|
|
$(Q)tar -czf $(PKG_TAR) -C dist $(PKG_DIR)
|
|
|
|
$(Q)rm -Rf dist
|
|
|
|
|
|
|
|
distcheck: $(PKG_TAR)
|
2011-03-22 00:16:15 +01:00
|
|
|
$(Q)rm -Rf dist
|
|
|
|
$(Q)mkdir -p dist
|
|
|
|
@$(call E, unpacking $(PKG_TAR) in dist/$(PKG_DIR))
|
|
|
|
$(Q)cd dist && tar -xzf ../$(PKG_TAR)
|
2011-03-21 21:42:14 +01:00
|
|
|
@$(call E, configuring in dist/$(PKG_DIR)-build)
|
2011-03-22 00:16:15 +01:00
|
|
|
$(Q)mkdir -p dist/$(PKG_DIR)-build
|
2011-03-21 21:42:14 +01:00
|
|
|
$(Q)cd dist/$(PKG_DIR)-build && ../$(PKG_DIR)/configure
|
|
|
|
@$(call E, making 'check' in dist/$(PKG_DIR)-build)
|
|
|
|
$(Q)make -C dist/$(PKG_DIR)-build check
|
|
|
|
@$(call E, making 'clean' in dist/$(PKG_DIR)-build)
|
|
|
|
$(Q)make -C dist/$(PKG_DIR)-build clean
|
|
|
|
$(Q)rm -Rf dist
|
|
|
|
@echo
|
|
|
|
@echo -----------------------------------------------
|
|
|
|
@echo $(PKG_TAR) ready for distribution
|
|
|
|
@echo -----------------------------------------------
|
|
|
|
|
2011-03-17 22:26:24 +01:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# Cleanup
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
2011-03-21 21:42:14 +01:00
|
|
|
tidy:
|
|
|
|
@$(call E, check: formatting)
|
2011-03-23 23:05:54 +01:00
|
|
|
$(Q)echo \
|
2011-03-22 00:16:15 +01:00
|
|
|
$(filter-out $(GENERATED) $(addprefix $(S)src/, $(GENERATED)) \
|
2011-03-22 07:06:42 +01:00
|
|
|
$(addprefix $(S)src/, $(RUSTLLVM_CS) $(RUSTLLVM_HDR) \
|
|
|
|
$(PKG_3RDPARTY)) \
|
2011-03-23 23:05:54 +01:00
|
|
|
$(S)src/etc/%, $(PKG_FILES)) \
|
|
|
|
| xargs -n 10 python $(S)src/etc/tidy.py
|
2011-03-21 21:42:14 +01:00
|
|
|
|
2011-03-17 22:26:24 +01:00
|
|
|
clean:
|
|
|
|
@$(call E, cleaning)
|
2011-03-31 23:03:43 +02:00
|
|
|
$(Q)rm -f $(RUNTIME_OBJS) $(RUNTIME_DEF)
|
|
|
|
$(Q)rm -f $(RUSTLLVM_OBJS) $(RUSTLLVM_DEF)
|
2011-03-21 19:23:19 +01:00
|
|
|
$(Q)rm -f $(BOOT_CMOS) $(BOOT_CMIS) $(BOOT_CMXS) $(BOOT_OBJS)
|
|
|
|
$(Q)rm -f $(ML_DEPFILES) $(C_DEPFILES) $(CRATE_DEPFILES)
|
|
|
|
$(Q)rm -f $(ML_DEPFILES:%.d=%.d.tmp)
|
|
|
|
$(Q)rm -f $(C_DEPFILES:%.d=%.d.tmp)
|
|
|
|
$(Q)rm -f $(CRATE_DEPFILES:%.d=%.d.tmp)
|
|
|
|
$(Q)rm -f $(GENERATED)
|
|
|
|
$(Q)rm -f boot/rustboot$(X) boot/$(CFG_STDLIB)
|
|
|
|
$(Q)rm -f stage0/rustc$(X) stage0/$(CFG_STDLIB) stage0/glue*
|
|
|
|
$(Q)rm -f stage1/rustc$(X) stage1/$(CFG_STDLIB) stage1/glue*
|
|
|
|
$(Q)rm -f stage2/rustc$(X) stage2/$(CFG_STDLIB) stage2/glue*
|
2011-03-22 07:06:42 +01:00
|
|
|
$(Q)rm -f rustllvm/$(CFG_RUSTLLVM) rt/$(CFG_RUNTIME)
|
2011-03-21 19:23:19 +01:00
|
|
|
$(Q)rm -Rf $(PKG_NAME)-*.tar.gz dist
|
|
|
|
$(Q)rm -f $(foreach ext,cmx cmi cmo cma bc o a d exe,\
|
|
|
|
$(wildcard boot/*/*.$(ext) boot/*/*/*.$(ext)))
|
2011-03-31 23:03:43 +02:00
|
|
|
$(Q)rm -f $(foreach ext,o a d bc s exe,$(wildcard stage*/*.$(ext)))
|
2011-03-21 19:23:19 +01:00
|
|
|
$(Q)rm -Rf $(foreach ext,out out.tmp \
|
|
|
|
boot$(X) stage0$(X) stage1$(X) stage2$(X) \
|
|
|
|
bc o s exe dSYM, \
|
2011-03-23 00:58:08 +01:00
|
|
|
$(wildcard test/*/*.$(ext) test/bench/*/*.$(ext)))
|
2011-03-23 18:37:35 +01:00
|
|
|
$(Q)rm -Rf $(foreach ext, \
|
2011-03-25 15:35:59 +01:00
|
|
|
aux cp fn ky log pdf html pg toc tp vr cps, \
|
2011-03-23 18:37:35 +01:00
|
|
|
$(wildcard doc/*.$(ext)))
|
2011-03-25 15:35:59 +01:00
|
|
|
$(Q)rm -Rf doc/version.texi
|