2011-05-01 15:18:52 -05:00
|
|
|
######################################################################
|
|
|
|
# Runtime (C++) library variables
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
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_cache.cpp \
|
2011-07-27 16:34:39 -05:00
|
|
|
rt/rust_env.cpp \
|
2011-06-28 14:15:41 -05:00
|
|
|
rt/rust_scheduler.cpp \
|
2011-05-01 15:18:52 -05:00
|
|
|
rt/rust_task.cpp \
|
|
|
|
rt/rust_task_list.cpp \
|
|
|
|
rt/rust_chan.cpp \
|
|
|
|
rt/rust_port.cpp \
|
|
|
|
rt/rust_upcall.cpp \
|
2011-06-16 00:04:31 -05:00
|
|
|
rt/rust_uv.cpp \
|
2011-05-01 15:18:52 -05:00
|
|
|
rt/rust_log.cpp \
|
|
|
|
rt/rust_timer.cpp \
|
|
|
|
rt/circular_buffer.cpp \
|
|
|
|
rt/isaac/randport.cpp \
|
|
|
|
rt/rust_srv.cpp \
|
|
|
|
rt/rust_kernel.cpp \
|
2011-08-03 22:25:44 -05:00
|
|
|
rt/rust_shape.cpp \
|
2011-08-16 21:48:47 -05:00
|
|
|
rt/rust_obstack.cpp \
|
2011-08-18 20:48:32 -05:00
|
|
|
rt/rust_gc.cpp \
|
2011-08-20 16:22:09 -05:00
|
|
|
rt/rust_abi.cpp \
|
2011-09-20 18:47:59 -05:00
|
|
|
rt/rust_cc.cpp \
|
2011-09-23 13:42:20 -05:00
|
|
|
rt/rust_debug.cpp \
|
2011-05-01 15:18:52 -05:00
|
|
|
rt/memory_region.cpp \
|
2011-06-28 14:54:41 -05:00
|
|
|
rt/test/rust_test_harness.cpp \
|
|
|
|
rt/test/rust_test_runtime.cpp \
|
2011-10-13 19:11:28 -05:00
|
|
|
rt/test/rust_test_util.cpp \
|
|
|
|
rt/arch/i386/context.cpp
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2011-06-15 20:03:15 -05:00
|
|
|
RUNTIME_LL :=
|
2011-05-18 14:43:48 -05:00
|
|
|
|
2011-09-28 14:26:36 -05:00
|
|
|
RUNTIME_S := rt/arch/i386/_context.S \
|
2011-10-31 15:31:04 -05:00
|
|
|
rt/arch/i386/ccall.S \
|
|
|
|
rt/arch/i386/morestack.S
|
2011-05-24 16:00:45 -05:00
|
|
|
|
2011-05-01 15:18:52 -05:00
|
|
|
RUNTIME_HDR := rt/globals.h \
|
|
|
|
rt/rust.h \
|
2011-10-05 19:41:01 -05:00
|
|
|
rt/rust_abi.h \
|
|
|
|
rt/rust_cc.h \
|
|
|
|
rt/rust_debug.h \
|
|
|
|
rt/rust_gc.h \
|
2011-05-01 15:18:52 -05:00
|
|
|
rt/rust_internal.h \
|
|
|
|
rt/rust_util.h \
|
|
|
|
rt/rust_chan.h \
|
2011-07-27 16:34:39 -05:00
|
|
|
rt/rust_env.h \
|
2011-10-05 19:41:01 -05:00
|
|
|
rt/rust_obstack.h \
|
|
|
|
rt/rust_unwind.h \
|
|
|
|
rt/rust_upcall.h \
|
2011-05-01 15:18:52 -05:00
|
|
|
rt/rust_port.h \
|
2011-06-28 14:15:41 -05:00
|
|
|
rt/rust_scheduler.h \
|
2011-10-05 19:41:01 -05:00
|
|
|
rt/rust_shape.h \
|
2011-05-01 15:18:52 -05:00
|
|
|
rt/rust_task.h \
|
|
|
|
rt/rust_task_list.h \
|
|
|
|
rt/rust_log.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 \
|
|
|
|
rt/sync/lock_and_signal.h \
|
|
|
|
rt/sync/lock_free_queue.h \
|
|
|
|
rt/rust_srv.h \
|
|
|
|
rt/rust_kernel.h \
|
|
|
|
rt/memory_region.h \
|
|
|
|
rt/memory.h \
|
2011-06-28 14:54:41 -05:00
|
|
|
rt/test/rust_test_harness.h \
|
|
|
|
rt/test/rust_test_runtime.h \
|
|
|
|
rt/test/rust_test_util.h \
|
2011-10-13 14:23:50 -05:00
|
|
|
rt/arch/i386/context.h
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2011-09-23 18:13:14 -05:00
|
|
|
ifeq ($(CFG_WINDOWSY), 1)
|
|
|
|
LIBUV_OSTYPE := win
|
2011-10-13 19:20:54 -05:00
|
|
|
LIBUV_ARCH := ia32
|
2011-09-23 18:13:14 -05:00
|
|
|
LIBUV_LIB := rt/libuv/Default/obj.target/src/rt/libuv/libuv.a
|
|
|
|
else ifeq ($(CFG_OSTYPE), apple-darwin)
|
|
|
|
LIBUV_OSTYPE := mac
|
2011-10-13 19:20:54 -05:00
|
|
|
LIBUV_ARCH := ia32
|
2011-09-23 18:13:14 -05:00
|
|
|
LIBUV_LIB := rt/libuv/Default/libuv.a
|
|
|
|
else
|
|
|
|
LIBUV_OSTYPE := unix
|
2011-10-13 19:20:54 -05:00
|
|
|
LIBUV_ARCH := ia32
|
2011-09-23 18:13:14 -05:00
|
|
|
LIBUV_LIB := rt/libuv/Default/obj.target/src/rt/libuv/libuv.a
|
|
|
|
endif
|
|
|
|
|
2011-05-01 15:18:52 -05:00
|
|
|
RUNTIME_DEF := rt/rustrt$(CFG_DEF_SUFFIX)
|
2011-05-31 19:44:54 -05:00
|
|
|
RUNTIME_INCS := -I $(S)src/rt/isaac -I $(S)src/rt/uthash \
|
2011-10-13 19:20:54 -05:00
|
|
|
-I $(S)src/rt/arch/i386 \
|
2011-10-13 19:11:28 -05:00
|
|
|
-I $(S)src/rt/libuv/include
|
2011-08-11 14:26:23 -05:00
|
|
|
RUNTIME_OBJS := $(RUNTIME_CS:.cpp=.o) $(RUNTIME_LL:.ll=.o) $(RUNTIME_S:.S=.o)
|
2011-09-23 18:13:14 -05:00
|
|
|
RUNTIME_LIBS := $(LIBUV_LIB)
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2011-10-14 13:31:40 -05:00
|
|
|
RT_COMPILE_C := $(call CFG_COMPILE_C, $(0), $(1) -I $(S)src/rt/arch/$(2))
|
|
|
|
|
2011-05-01 15:18:52 -05:00
|
|
|
rt/%.o: rt/%.cpp $(MKFILES)
|
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(Q)$(call CFG_COMPILE_C, $@, $(RUNTIME_INCS)) $<
|
|
|
|
|
2011-08-11 14:26:23 -05:00
|
|
|
rt/%.o: rt/%.S $(MKFILES)
|
2011-05-24 16:00:45 -05:00
|
|
|
@$(call E, compile: $@)
|
|
|
|
$(Q)$(call CFG_COMPILE_C, $@, $(RUNTIME_INCS)) $<
|
|
|
|
|
2011-05-18 14:43:48 -05:00
|
|
|
rt/%.o: rt/%.ll $(MKFILES)
|
|
|
|
@$(call E, llc: $@)
|
|
|
|
$(Q)$(LLC) -filetype=obj -relocation-model=pic -march=x86 -o $@ $<
|
2011-05-01 15:18:52 -05:00
|
|
|
|
2011-06-14 10:28:10 -05:00
|
|
|
rt/$(CFG_RUNTIME): $(RUNTIME_OBJS) $(MKFILES) $(RUNTIME_HDR) $(RUNTIME_DEF) $(RUNTIME_LIBS)
|
2011-05-01 15:18:52 -05:00
|
|
|
@$(call E, link: $@)
|
2011-08-04 13:44:23 -05:00
|
|
|
$(Q)$(call CFG_LINK_C,$@, $(RUNTIME_OBJS) \
|
2011-08-04 16:11:33 -05:00
|
|
|
$(CFG_GCCISH_POST_LIB_FLAGS) $(RUNTIME_LIBS) \
|
2011-10-06 15:09:00 -05:00
|
|
|
$(CFG_LIBUV_LINK_FLAGS),$(RUNTIME_DEF),$(CFG_RUNTIME))
|
2011-06-14 10:28:10 -05:00
|
|
|
|
2011-08-04 16:11:33 -05:00
|
|
|
# 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 explicitly using gcc. Also, we
|
|
|
|
# have to list environment variables first on windows... mysterious
|
2011-09-23 18:13:14 -05:00
|
|
|
$(LIBUV_LIB): $(wildcard \
|
2011-08-04 20:26:54 -05:00
|
|
|
$(S)src/rt/libuv/* \
|
|
|
|
$(S)src/rt/libuv/*/* \
|
|
|
|
$(S)src/rt/libuv/*/*/* \
|
|
|
|
$(S)src/rt/libuv/*/*/*/*)
|
2011-10-13 14:23:50 -05:00
|
|
|
$(Q)$(MAKE) -C $(S)mk/libuv/$(LIBUV_ARCH)/$(LIBUV_OSTYPE) \
|
2011-09-23 18:13:14 -05:00
|
|
|
CFLAGS="-m32" LDFLAGS="-m32" \
|
|
|
|
CC="$(CFG_GCCISH_CROSS)$(CC)" \
|
|
|
|
CXX="$(CFG_GCCISH_CROSS)$(CXX)" \
|
|
|
|
AR="$(CFG_GCCISH_CROSS)$(AR)" \
|
|
|
|
builddir_name="$(CFG_BUILD_DIR)/rt/libuv" \
|
|
|
|
V=$(VERBOSE) FLOCK= uv
|
2011-05-01 15:18:52 -05:00
|
|
|
|
|
|
|
# These could go in rt.mk or rustllvm.mk, they're needed for both.
|
|
|
|
|
|
|
|
%.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
|